Setup Permission, Function, and State Machine
Understand how to set permissions for S3, configure Lambda functions, and connect state machines to automate packaging workflows in AWS Step Functions using the Serverless Framework.
We'll cover the following...
We'll cover the following...
Now, because we have the Lambda function, we can set up permission for S3, set up the Lambda function, and adjust the state machine so we have our packaging step up and running.
First, open the serverless.yml file below:
import {
APIGatewayProxyEvent,
APIGatewayProxyHandler,
APIGatewayProxyResult,
} from "aws-lambda";
import { validate as uuidValidate } from "uuid";
export const handler: APIGatewayProxyHandler = async (
event: APIGatewayProxyEvent
): Promise<APIGatewayProxyResult> => {
const batchId = event.body?.batchId;
if (batchId && uuidValidate(batchId)) {
return { validApiQualityCheck: true };
} else {
throw new Error("Quality check failed: invalid batch ID");
}
};
Project
Permission
First, within ...