forked from jbesw/aws-serverless-form-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackaged.yaml
77 lines (76 loc) · 1.98 KB
/
packaged.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: 'Serverless Form Handler - accepts a form submission from a webpage,
saving the data to a DynamoDB table and sending an email via SES.
'
Parameters:
ValidatedEmail:
Type: String
Description: (Required) A validated SES email address for receiving new submissions.
MaxLength: 70
Default: [email protected]
MinLength: 4
ConstraintDescription: Required. Must be a SES verified email address.
Globals:
Function:
Timeout: 10
Api:
EndpointConfiguration: EDGE
Cors:
AllowMethods: '''OPTIONS,POST'''
AllowHeaders: '''Content-Type'''
AllowOrigin: '''*'''
Resources:
FormDataTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: formId
AttributeType: S
KeySchema:
- AttributeName: formId
KeyType: HASH
BillingMode: PAY_PER_REQUEST
SubmitFormFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: s3://jbesw-sar-public-source/ca9794e08c4d09fa76c820b9b8af1089
Handler: app.handler
Runtime: nodejs12.x
MemorySize: 128
Environment:
Variables:
ValidatedEmail:
Ref: ValidatedEmail
FormDataTable:
Ref: FormDataTable
Policies:
- DynamoDBCrudPolicy:
TableName:
Ref: FormDataTable
- SESCrudPolicy:
IdentityName:
Ref: ValidatedEmail
Events:
HttpPost:
Type: Api
Properties:
Path: /submitForm
Method: post
Outputs:
SubmitFormFunction:
Description: Lambda Function ARN
Value:
Fn::GetAtt:
- SubmitFormFunction
- Arn
SubmitFormFunctionIamRole:
Description: Implicit IAM Role created for function
Value:
Fn::GetAtt:
- SubmitFormFunctionRole
- Arn
FormDataTable:
Description: DynamoDB Table
Value:
Ref: FormDataTable