AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: > vaccination_reservation_demo Sample SAM Template for vaccination_reservation_demo # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst Globals: Function: Timeout: 30 Parameters: DDBTableName: Type: String Default: VACCINATION_RESERVATION Resources: ReservationFunction: 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: src/ Handler: app.lambda_handler Runtime: python3.9 Architectures: - x86_64 Environment: Variables: TABLE_NAME: Ref: DDBTableName Policies: - DynamoDBWritePolicy: TableName: Ref: DDBTableName - DynamoDBReadPolicy: TableName: Ref: DDBTableName Events: Reservation: Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api Properties: Path: /reservation Method: post VaccinationReservation: Type: AWS::Serverless::SimpleTable Properties: PrimaryKey: Name: pk Type: String TableName: Ref: DDBTableName 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 HelloWorldApi: Description: "API Gateway endpoint URL for Prod stage for Hello World function" Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/reservation/"