-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yml
137 lines (131 loc) · 3.86 KB
/
template.yml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Cloud Resume App
Resources:
myDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
-
AttributeName: "pagename"
AttributeType: "S"
KeySchema:
-
AttributeName: "pagename"
KeyType: "HASH"
TableName: "visitor_counter"
ProvisionedThroughput:
ReadCapacityUnits: "5"
WriteCapacityUnits: "5"
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Auth:
UsagePlan:
CreateUsagePlan: PER_API
Description: Usage plan for this API
Quota:
Limit: 500
Period: MONTH
Throttle:
BurstLimit: 100
RateLimit: 50
CloudResumeFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: Lambda/
Handler: getcounterscript.getCounter
Runtime: python3.8
Policies:
# Give DynamoDB Full Access to your Lambda Function
- AmazonDynamoDBFullAccess
Events:
getCounter:
Type: Api
Properties:
Path: /getVisitorCounter
Method: get
RestApiId: !Ref ApiGatewayApi
MyDomainName:
Type: 'AWS::ApiGateway::DomainName'
Properties:
DomainName: api.rajanpanchal.net
EndpointConfiguration:
Types:
- REGIONAL
RegionalCertificateArn: arn:aws:acm:us-east-1:040484382121:certificate/5b061857-8298-47c2-a315-f20ce83402eb
myMapping:
Type: 'AWS::ApiGateway::BasePathMapping'
Properties:
DomainName: !Ref MyDomainName
RestApiId: !Ref ApiGatewayApi
apiDNS:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneId: Z10235982M6XC1GZQT9R0
RecordSets:
- Name: api.rajanpanchal.net
Type: A
AliasTarget:
HostedZoneId: !GetAtt MyDomainName.RegionalHostedZoneId
DNSName: !GetAtt MyDomainName.RegionalDomainName
cloudfrontoriginaccessidentity:
Type: AWS::CloudFront::CloudFrontOriginAccessIdentity
Properties:
CloudFrontOriginAccessIdentityConfig:
Comment: This is origin access identity
myDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Origins:
- DomainName: rajanpanchal.net.s3.amazonaws.com
Id: myS3Origin
S3OriginConfig:
OriginAccessIdentity: !Join [ "", [ "origin-access-identity/cloudfront/", !Ref cloudfrontoriginaccessidentity ] ]
Enabled: 'true'
Comment: Some comment
DefaultRootObject: index.html
Aliases:
- rajanpanchal.net
- www.rajanpanchal.net
DefaultCacheBehavior:
AllowedMethods:
- GET
- HEAD
- OPTIONS
TargetOriginId: myS3Origin
ForwardedValues:
QueryString: 'false'
Cookies:
Forward: none
ViewerProtocolPolicy: redirect-to-https
DefaultTTL: 60
MaxTTL: 120
MinTTL: 30
PriceClass: PriceClass_200
ViewerCertificate:
AcmCertificateArn: arn:aws:acm:us-east-1:040484382121:certificate/5b061857-8298-47c2-a315-f20ce83402eb
SslSupportMethod: sni-only
CFDNSOne:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneId: Z10235982M6XC1GZQT9R0
RecordSets:
- Name: rajanpanchal.net
Type: A
AliasTarget:
HostedZoneId: Z2FDTNDATAQYW2
DNSName: !GetAtt myDistribution.DomainName
CFDNSTwo:
Type: AWS::Route53::RecordSetGroup
Properties:
HostedZoneId: Z10235982M6XC1GZQT9R0
RecordSets:
- Name: www.rajanpanchal.net
Type: A
AliasTarget:
HostedZoneId: Z2FDTNDATAQYW2
DNSName: !GetAtt myDistribution.DomainName