service: ${file(APIDeploymentConfig.json):SERVICE_NAME, "my-api-service"} plugins: - serverless-api-compression custom: NODE_ENV: dev: development prod: production contentEncoding: contentCompression: 100 # Minimum body size required for compression in bytes provider: name: aws runtime: nodejs8.10 stage: ${opt:stage, "dev"} region: ${file(APIDeploymentConfig.json):AWS_REGION, "us-east-1"} apiName: ${self:service}-api profile: ${opt:profile} memorySize: 512 timeout: 30 logRetentionInDays: 14 environment: NODE_ENV: ${self:custom.NODE_ENV.${opt:stage, self:provider.stage}} # Override this value if you want to use a custom domain name API_URL_BASE: { "Fn::Join" : ["", [ "https://", { "Ref" : "ApiGatewayRestApi" }, ".execute-api.${self:provider.region}.amazonaws.com/${self:provider.stage}" ] ] } # Uncomment if you want S3 support for file storage # FILE_STORAGE_SERVICE_PROVIDER: "S3FileService" # S3_FILE_SERVICE_BUCKET_NAME: "my.bucket.name" # Uncomment if you want DynamoDB support for key-value storage # KV_STORAGE_SERVICE_PROVIDER: "DynamoDBKVService" # DYNAMO_KV_STORAGE_TABLE_NAME: ${self:service}-kv-storage # iamRoleStatements: # - Effect: "Allow" # Action: # - dynamodb:DeleteItem # - dynamodb:GetItem # - dynamodb:PutItem # - dynamodb:UpdateItem # - dynamodb:Query # Resource: # Fn::GetAtt: # - kvStorageTable # - Arn package: exclude: - readme.md - node_modules/@types/** - .git - .secrets* - "*.ts" - "*.js.map" functions: API: handler: ${file(APIDeploymentConfig.json):API_HANDLER, "APIHandler.handler"} events: - http: ANY / - http: "ANY {proxy+}" # Uncomment if you want DynamoDB support for key-value storage #resources: # Resources: # kvStorageTable: # Type: AWS::DynamoDB::Table # DeletionPolicy: Retain # Properties: # TableName: ${self:provider.environment.DYNAMO_KV_STORAGE_TABLE_NAME} # AttributeDefinitions: # - AttributeName: namespace # AttributeType: S # - AttributeName: key # AttributeType: S # KeySchema: # - AttributeName: namespace # KeyType: HASH # - AttributeName: key # KeyType: RANGE # ProvisionedThroughput: # ReadCapacityUnits: 5 # WriteCapacityUnits: 5 # SSESpecification: # SSEEnabled: true # TimeToLiveSpecification: # AttributeName: expires # Enabled: true