Files
peggedassets-server/resources/table-and-api.yml
2022-06-30 14:17:28 +01:00

38 lines
1.2 KiB
YAML

Resources:
# DynamoDB
DynamoTable:
Type: AWS::DynamoDB::Table
DeletionPolicy: Retain # Make sure the tables can't be deleted by CloudFormation/Serverless
Properties:
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: PK
AttributeType: S
- AttributeName: SK
AttributeType: N
KeySchema:
- AttributeName: PK
KeyType: HASH
- AttributeName: SK
KeyType: RANGE
# Set the capacity to auto-scale
BillingMode: PAY_PER_REQUEST
# CORS for api gateway errors
GatewayResponseDefault4XX:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: DEFAULT_4XX
RestApiId:
Ref: 'ApiGatewayRestApi'
GatewayResponseDefault5XX:
Type: 'AWS::ApiGateway::GatewayResponse'
Properties:
ResponseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
gatewayresponse.header.Access-Control-Allow-Headers: "'*'"
ResponseType: DEFAULT_5XX
RestApiId:
Ref: 'ApiGatewayRestApi'