AWSTemplateFormatVersion: 2010-09-09 Transform: AWS::Serverless-2016-10-31 Description: AWS-SAM-APIGW-Lambda-DDB Globals: Function: Runtime: java11 MemorySize: 1024 Timeout: 25 Api: OpenApiVersion: '3.0.1' Resources: #Ticket API Gateway #Stage name: dev ticketAPIGateway: Type: AWS::Serverless::Api Properties: StageName: dev Name: ticket-api-gateway TracingEnabled: true #Ticket Lambda Function ticketLambdaPublisher: Type: AWS::Serverless::Function Properties: FunctionName: ticketPublisher Handler: com.example.TicketFunction::handleRequest CodeUri: TicketsFunction Tracing: Active Environment: Variables: JAVA_TOOL_OPTIONS: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 Policies: - DynamoDBCrudPolicy: TableName: !Ref ticketDDBTable Events: ApiEvents: Type: Api Properties: Path: /ticket Method: POST RestApiId: !Ref ticketAPIGateway #Ticket DynamoDB table ticketDDBTable: Type: AWS::Serverless::SimpleTable Properties: TableName: tickets PrimaryKey: Name: ticketId Type: String Outputs: ApiEndpoint: Description: API Gateway Ticket Endpoint Value: Fn::Sub: https://${ticketAPIGateway}.execute-api.${AWS::Region}.amazonaws.com/dev