Demo application where a file upload to S3 indirectly triggers a workflow which will to some image recognition, either automatically "approve" the image or notify a moderator and, finally, for approved images, will create thumbnails and grayscale images.
The SAM CLI beta feature for esbuild
enables native TypeScript support for Lambda. The normal SAM build will thus also
compile the functions. Run the following commands:
- sam validate to verify the validity of the SAM template.
- sam invoke
to invoke a specific Lambda function. Add the
-e
/--event
argument to specify a custom event to invoke the function. Generate events using sam local generate-event to generate sample events. - sam local start-api to start the API gateway locally.
- sam local start-lambda to start the Lambda service locally.
sam sync --watch --stack-name <unique-stack-name>
to use SAM accelerate. Don't use the same stack name as for the deployment!
The SAM CLI beta feature for esbuild
enables native TypeScript support for Lambda. The normal SAM build will thus also
compile the functions. Run the following commands:
- sam validate to verify the validity of the SAM template.
- sam build to compile the Lambda functions and SAM template.
- sam deploy
to deploy the CloudFormation stack. Add
--guided
for the initial deployment or to update the saved deployment configuration in samconfig.toml.
-
Once triggered, retrieve active tasks:
aws stepfunctions get-activity-task --activity-arn arn:aws:states:<region>:<account>:activity:ImageModerationActivity
-
Either approve
aws stepfunctions send-task-success --task-output="{\"allowed\":true}" --task-token="<token>"