Created
June 12, 2022 18:32
-
-
Save pacarvalho/2e635dd327586f87e5ad1a6a157fabc0 to your computer and use it in GitHub Desktop.
Medium - Serverless Form - template.yaml
This file contains 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: > | |
serverless-form | |
SAM project for serverless-form | |
Parameters: | |
LambdaVersion: | |
Default: "not-specified" | |
Description: "What is the current code version?" | |
Type: String | |
Resources: | |
FormSubmissionFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
CodeUri: src/ | |
Handler: index.handler | |
Runtime: nodejs12.x | |
MemorySize: 128 | |
Timeout: 3 | |
Environment: | |
Variables: | |
LAMBDA_VERSION: !Ref LambdaVersion | |
Policies: | |
- AWSLambdaBasicExecutionRole | |
- Version: "2012-10-17" # Policy Document | |
Statement: | |
- Effect: Allow | |
Action: | |
- ses:SendEmail | |
- ses:SendRawEmail | |
Resource: "*" | |
Events: | |
APIRoot: | |
Type: Api | |
Properties: | |
Path: / | |
Method: POST | |
RestApiId: !Ref FormSubmissionApi | |
FormSubmissionApi: | |
Type: AWS::Serverless::Api | |
Properties: | |
StageName: Prod | |
Cors: | |
AllowMethods: "'POST'" | |
AllowOrigin: "'https://my-domain.com'" | |
AllowHeaders: "'x-requested-with'" | |
Outputs: | |
FormSubmissionApi: | |
Description: "API Gateway endpoint URL" | |
Value: !Sub "https://${FormSubmissionApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" | |
FormSubmissionFunction: | |
Description: "Lambda Function ARN" | |
Value: !GetAtt FormSubmissionFunction.Arn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment