AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > Async invoke a StepFunctions state machine from a Lambda function Globals: Function: MemorySize: 128 Architectures: ["arm64"] Handler: bootstrap Runtime: provided.al2 Timeout: 30 Environment: Variables: RUST_BACKTRACE: 1 RUST_LOG: info Resources: ########################################################################## # Lambda Function # ########################################################################## LambdaProxy: Type: AWS::Serverless::Function Properties: CodeUri: ./build/handler Policies: - StepFunctionsExecutionPolicy: StateMachineName: !GetAtt StateMachine.Name Environment: Variables: STATE_MACHINE_ARN: !GetAtt StateMachine.Arn ########################################################################## # STEP FUNCTION # ########################################################################## StateMachine: Type: AWS::Serverless::StateMachine # More info about State Machine Resource: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-statemachine.html Properties: DefinitionUri: statemachine/stateMachine.asl.json Type: EXPRESS Policies: - Version: "2012-10-17" Statement: - Effect: Allow Action: - "cloudwatch:*" - "logs:*" Resource: "*" Logging: Destinations: - CloudWatchLogsLogGroup: LogGroupArn: !GetAtt StateMachineLogGroup.Arn IncludeExecutionData: false Level: 'ALL' ########################################################################## # STEP FUNCTION LOG GROUP # ########################################################################## StateMachineLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Join [ "/", [ "stepfunctions", StateMachine]] Outputs: StateMachine: Value: !GetAtt StateMachine.Arn Description: Statemachine Arn LambdaFuncton: Value: !Ref LambdaProxy Description: Lambda Function Name