Created
December 9, 2019 14:19
-
-
Save jacepark12/28807d651fcdf6fb20f73bff3bed2ae6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: '2010-09-09' | |
| Transform: AWS::Serverless-2016-10-31 | |
| Description: 'SAM Sample' | |
| Globals: | |
| Function: | |
| Timeout: 3 | |
| Api: | |
| Cors: | |
| AllowMethods: "'GET,POST,OPTIONS,PUT,DELETE'" | |
| AllowHeaders: "'content-type'" | |
| AllowOrigin: "'*'" | |
| AllowCredentials: "'*'" | |
| Parameters: | |
| Stage: | |
| Type: String | |
| AllowedValues: | |
| - dev | |
| - v1 | |
| DATABASE: | |
| Type: String | |
| Default: test_database | |
| AllowedValues: | |
| - test_database | |
| - production_database | |
| Resources: | |
| Sample API: | |
| Type: AWS::Serverless::Api | |
| Properties: | |
| StageName: !Ref Stage | |
| RDSLayer: | |
| Type: AWS::Serverless::LayerVersion | |
| Properties: | |
| LayerName: RDSLayer | |
| Description: Dependencies for sam app | |
| ContentUri: util/ | |
| CompatibleRuntimes: | |
| - python3.7 | |
| UsersSignup: | |
| Type: AWS::Serverless::Function | |
| Properties: | |
| CodeUri: ./users | |
| Handler: app.signup_handler | |
| Layers: | |
| - !Ref RDSLayer | |
| Runtime: python3.7 | |
| Role: arn:aws:iam::155087259035:role/LambdaRole | |
| Events: | |
| RequestUserSignup: | |
| Type: Api | |
| Properties: | |
| RestApiId: !Ref SampleAPI | |
| Path: /users/signup | |
| Method: post | |
| Environment: | |
| Variables: | |
| DATABASE: !Ref DATABASE | |
| UsersLogin: | |
| Type: AWS::Serverless::Function | |
| Properties: | |
| CodeUri: ./users | |
| Handler: app.login_handler | |
| Layers: | |
| - !Ref RDSLayer | |
| Runtime: python3.7 | |
| Role: arn:aws:iam::155087259035:role/LambdaRole | |
| Events: | |
| RequestUsersLogin: | |
| Type: Api | |
| Properties: | |
| RestApiId: !Ref SampleAPI | |
| Path: /users/login | |
| Method: post | |
| Environment: | |
| Variables: | |
| DATABASE: !Ref DATABASE | |
| Outputs: | |
| SniperAPI: | |
| Description: API Gateway endpoint URL | |
| Value: | |
| Fn::Sub: https://${SampleAPI}.execute-api.${AWS::Region}.amazonaws.com/${Stage} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment