AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > SAM Template for sqs-lambda # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst Globals: Function: Timeout: 30 MemorySize: 1024 Architectures: - arm64 Runtime: dotnet6 Tracing: Active Environment: Variables: POWERTOOLS_LOG_LEVEL: Information POWERTOOLS_LOGGER_LOG_EVENT: true POWERTOOLS_LOGGER_CASE: PascalCase # Allowed values are: CamelCase, PascalCase and SnakeCase POWERTOOLS_LOGGER_SAMPLE_RATE: 0 POWERTOOLS_METRICS_NAMESPACE: SqsEventHandler Resources: ProcessEmployeeFunction: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Properties: CodeUri: ./SqsEventHandler/ Handler: SqsEventHandler::SqsEventHandler.Functions.ProcessEmployeeFunction::Handler Environment: Variables: POWERTOOLS_SERVICE_NAME: process-employee-function EMPLOYEE_TABLE_NAME: !Ref EmployeeTable Events: SampleSQSEvent: Type: SQS Properties: Queue: !GetAtt ProcessEmployeeQueue.Arn BatchSize: 10 FunctionResponseTypes: - ReportBatchItemFailures Policies: - DynamoDBWritePolicy: TableName: !Ref EmployeeTable ProcessEmployeeQueue: Type: AWS::SQS::Queue Properties: RedrivePolicy: deadLetterTargetArn: !GetAtt ProcessEmployeeQueueDLQ.Arn maxReceiveCount: 5 ProcessEmployeeQueueDLQ: Type: AWS::SQS::Queue EmployeeTable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: - AttributeName: employee_id AttributeType: S ProvisionedThroughput: ReadCapacityUnits: 5 WriteCapacityUnits: 5 KeySchema: - AttributeName: employee_id KeyType: HASH StreamSpecification: StreamViewType: NEW_AND_OLD_IMAGES Outputs: # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function # Find out more about other implicit resources you can reference within SAM # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api ProcessEmployeeFunction: Description: "Process Employee Function ARN" Value: !GetAtt ProcessEmployeeFunction.Arn ProcessEmployeeFunctionIamRole: Description: "Implicit IAM Role created for Process Employee Function" Value: !GetAtt ProcessEmployeeFunctionRole.Arn ProcessEmployeeQueueUrl: Description: "Process Employee Queue Url" Value: !Ref ProcessEmployeeQueue EmployeeTableName: Description: "Employee Table Name" Value: !Ref EmployeeTable