-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput.yaml
More file actions
114 lines (114 loc) · 2.79 KB
/
output.yaml
File metadata and controls
114 lines (114 loc) · 2.79 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
AWSTemplateFormatVersion: 2010-09-09
Description: Boilerplate SAM template.
Globals:
Api:
Cors:
AllowHeaders: '''*'''
AllowMethods: '''*'''
AllowOrigin:
Fn::Sub: '''https://${DomainName}'''
Parameters:
Certificate:
Default: arn:aws:acm:region:numbers:certificate/uuid
Description: Certificate for custom domain
Type: String
DomainName:
Default: domain.com
Description: Domain name for things
Type: String
Subdomain:
Default: api.
Description: Subdomain of your site
Type: String
Resources:
ApiDomainName:
Properties:
CertificateArn:
Ref: Certificate
DomainName:
Fn::Sub: ${Subdomain}${DomainName}
Type: AWS::ApiGateway::DomainName
BasePathMapping:
DependsOn: RestApiprodStage
Properties:
DomainName:
Fn::Sub: ${Subdomain}${DomainName}
RestApiId:
Ref: RestApi
Stage: prod
Type: AWS::ApiGateway::BasePathMapping
RestApi:
Properties:
Name: RestApi
StageName: prod
Type: AWS::Serverless::Api
fileServerBucket:
Type: AWS::S3::Bucket
lambdaFunction:
Properties:
CodeUri: s3://alex-lambda-functions/dd100c71e2623c4404b2b6814c1587ed
Events:
lambdaAPI:
Properties:
Method: get
Path: /lambdafunction
RestApiId:
Ref: RestApi
Type: Api
Handler: index.handler
Role:
Fn::GetAtt:
- lambdaRole
- Arn
Runtime: nodejs8.10
Type: AWS::Serverless::Function
lambdaRole:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Version: 2012-10-17
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Policies:
- PolicyDocument:
Statement:
- Action:
- s3:GetObject
Effect: Allow
Resource:
- Fn::GetAtt:
- fileServerBucket
- Arn
- Fn::Sub: ${fileServerBucket.Arn}/*
Version: 2012-10-17
PolicyName: s3GetPutPolicy
Type: AWS::IAM::Role
route53Domain:
Properties:
HostedZoneName:
Fn::Sub: ${DomainName}.
RecordSets:
- AliasTarget:
DNSName:
Fn::GetAtt:
- ApiDomainName
- DistributionDomainName
HostedZoneId:
Fn::GetAtt:
- ApiDomainName
- DistributionHostedZoneId
Name:
Fn::Join:
- ''
- - Ref: Subdomain
- Ref: DomainName
- .
Type: A
Type: AWS::Route53::RecordSetGroup
Transform: AWS::Serverless-2016-10-31