Solution: ML Model Using AWS Step Functions
Let's take a look at the solution for this exercise.
We'll cover the following
Solution
Here are the steps required to reproduce this solution:
- 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
iss3://BUCKET_NAME/
. Replace theBUCKET_NAME
with a bucket name of your choice. - 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 inprovider
section). This gives the Lambda function additional minimal privileges to list all buckets, and basic data operations on the created bucket. - Substitute
SERVERLESS_ORG
,AWS_BUCKET_NAME
, andDATA_PATH
, and then deploy your own service. - 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 1400+ tech skills courses.