AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: APPNAMEHERE Lambda (REST API) Parameters: RailsEnv: Type: String Default: production AllowedValues: - staging - production Resources: RailsApi: Type: AWS::Serverless::Api Properties: StageName: !Ref RailsEnv EndpointConfiguration: REGIONAL DefinitionBody: swagger: 2.0 info: { title: !Ref 'AWS::StackName' } basePath: !Join [ '', [ '/', !Ref RailsEnv ] ] schemes: [ 'https' ] paths: /: x-amazon-apigateway-any-method: x-amazon-apigateway-integration: uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${RailsLambda.Arn}:live/invocations httpMethod: POST type: aws_proxy /{resource+}: x-amazon-apigateway-any-method: parameters: - name: resource in: path required: true type: string x-amazon-apigateway-integration: uri: Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${RailsLambda.Arn}:live/invocations httpMethod: POST type: aws_proxy x-amazon-apigateway-binary-media-types: - '*/*' RailsLambda: Type: AWS::Serverless::Function Metadata: DockerContext: ./.lamby/RailsLambda Dockerfile: Dockerfile Properties: MemorySize: 512 Timeout: 30 Environment: Variables: RAILS_ENV: !Ref RailsEnv FunctionName: !Join [ '', [ 'APPNAMEHERE-', !Ref RailsEnv, '-', !Ref 'AWS::Region' ] ] Events: Root: Type: Api Properties: Path: / Method: ANY RestApiId: !Ref RailsApi RailsAppAll: Type: Api Properties: Path: /{resource+} Method: ANY RestApiId: !Ref RailsApi PackageType: Image Outputs: RailsApiUrl: Description: API Gateway Endpoint Value: !Sub "https://${RailsApi}.execute-api.${AWS::Region}.amazonaws.com/${RailsEnv}/" RailsLambdaArn: Description: Lambda ARN Value: !GetAtt RailsLambda.Arn