Solution: ML Model Using AWS Step Functions

Let's take a look at the solution for this exercise.

We'll cover the following


Here are the steps required to reproduce this solution:

  1. Create a bucket to store your train/test dataset used for training the model. This way, the Lambda function is aware of this location. The value of the environment variable DATA_PATH is s3://BUCKET_NAME/. Replace the BUCKET_NAME with a bucket name of your choice.
  2. By default, a Lambda function has no permissions except for persisting its logs. So the Lambda function can list and read data from the previously created bucket, the default Lambda role permissions created automatically by Serverless have already been adjusted (see iam block in provider section). This gives the Lambda function additional minimal privileges to list all buckets, and basic data operations on the created bucket.
  3. Substitute SERVERLESS_ORG, AWS_BUCKET_NAME, and DATA_PATH, and then deploy your own service.
  4. Test the service in your Step Functions test window by providing the following payload, where the partition is equal to “test” or “train”. How different is the score?
  "partition": "test"

Get hands-on with 1200+ tech skills courses.