Skip to content

Commit 0abd6f5

Browse files
committed
amlify added with s3 deployment settings
1 parent 47d4f93 commit 0abd6f5

File tree

10 files changed

+384
-2
lines changed

10 files changed

+384
-2
lines changed

.gitignore

+21-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,24 @@ npm-debug.log*
2121
yarn-debug.log*
2222
yarn-error.log*
2323

24-
doc
24+
doc
25+
26+
#amplify
27+
amplify/\#current-cloud-backend
28+
amplify/.config/local-*
29+
amplify/logs
30+
amplify/mock-data
31+
amplify/backend/amplify-meta.json
32+
amplify/backend/awscloudformation
33+
amplify/backend/.temp
34+
build/
35+
dist/
36+
node_modules/
37+
aws-exports.js
38+
awsconfiguration.json
39+
amplifyconfiguration.json
40+
amplifyconfiguration.dart
41+
amplify-build-config.json
42+
amplify-gradle-config.json
43+
amplifytools.xcconfig
44+
.secret-*

amplify/.config/project-config.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"projectName": "cognitoAmplifyReact2",
3+
"version": "3.1",
4+
"frontend": "javascript",
5+
"javascript": {
6+
"framework": "react",
7+
"config": {
8+
"SourceDir": "src",
9+
"DistributionDir": "build",
10+
"BuildCommand": "npm run-script build",
11+
"StartCommand": "npm run-script start"
12+
}
13+
},
14+
"providers": [
15+
"awscloudformation"
16+
]
17+
}

amplify/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Getting Started with Amplify CLI
2+
This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli).
3+
4+
Helpful resources:
5+
- Amplify documentation: https://docs.amplify.aws
6+
- Amplify CLI documentation: https://docs.amplify.aws/cli
7+
- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files
8+
- Join Amplify's community: https://amplify.aws/community/

amplify/backend/backend-config.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"hosting": {
3+
"S3AndCloudFront": {
4+
"service": "S3AndCloudFront",
5+
"providerPlugin": "awscloudformation"
6+
}
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"bucketName": "amplifyreactcognito"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
{
2+
"AWSTemplateFormatVersion": "2010-09-09",
3+
"Description": "Hosting resource stack creation using Amplify CLI",
4+
"Parameters": {
5+
"env": {
6+
"Type": "String"
7+
},
8+
"bucketName": {
9+
"Type": "String"
10+
}
11+
},
12+
"Conditions": {
13+
"ShouldNotCreateEnvResources": {
14+
"Fn::Equals": [
15+
{
16+
"Ref": "env"
17+
},
18+
"NONE"
19+
]
20+
}
21+
},
22+
"Resources": {
23+
"S3Bucket": {
24+
"Type": "AWS::S3::Bucket",
25+
"DeletionPolicy": "Retain",
26+
"Properties": {
27+
"BucketName": {
28+
"Fn::If": [
29+
"ShouldNotCreateEnvResources",
30+
{
31+
"Ref": "bucketName"
32+
},
33+
{
34+
"Fn::Join": [
35+
"",
36+
[
37+
{
38+
"Ref": "bucketName"
39+
},
40+
"-",
41+
{
42+
"Ref": "env"
43+
}
44+
]
45+
]
46+
}
47+
]
48+
},
49+
"WebsiteConfiguration": {
50+
"IndexDocument": "index.html",
51+
"ErrorDocument": "index.html"
52+
},
53+
"CorsConfiguration": {
54+
"CorsRules": [
55+
{
56+
"AllowedHeaders": [
57+
"Authorization",
58+
"Content-Length"
59+
],
60+
"AllowedMethods": [
61+
"GET"
62+
],
63+
"AllowedOrigins": [
64+
"*"
65+
],
66+
"MaxAge": 3000
67+
}
68+
]
69+
}
70+
}
71+
},
72+
"PrivateBucketPolicy": {
73+
"Type": "AWS::S3::BucketPolicy",
74+
"DependsOn": "OriginAccessIdentity",
75+
"Properties": {
76+
"PolicyDocument": {
77+
"Id": "MyPolicy",
78+
"Version": "2012-10-17",
79+
"Statement": [
80+
{
81+
"Sid": "APIReadForGetBucketObjects",
82+
"Effect": "Allow",
83+
"Principal": {
84+
"CanonicalUser": {
85+
"Fn::GetAtt": [
86+
"OriginAccessIdentity",
87+
"S3CanonicalUserId"
88+
]
89+
}
90+
},
91+
"Action": "s3:GetObject",
92+
"Resource": {
93+
"Fn::Join": [
94+
"",
95+
[
96+
"arn:aws:s3:::",
97+
{
98+
"Ref": "S3Bucket"
99+
},
100+
"/*"
101+
]
102+
]
103+
}
104+
}
105+
]
106+
},
107+
"Bucket": {
108+
"Ref": "S3Bucket"
109+
}
110+
}
111+
},
112+
"OriginAccessIdentity": {
113+
"Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
114+
"Properties": {
115+
"CloudFrontOriginAccessIdentityConfig": {
116+
"Comment": "CloudFrontOriginAccessIdentityConfig"
117+
}
118+
}
119+
},
120+
"CloudFrontDistribution": {
121+
"Type": "AWS::CloudFront::Distribution",
122+
"DependsOn": [
123+
"S3Bucket",
124+
"OriginAccessIdentity"
125+
],
126+
"Properties": {
127+
"DistributionConfig": {
128+
"HttpVersion": "http2",
129+
"Origins": [
130+
{
131+
"DomainName": {
132+
"Fn::GetAtt": [
133+
"S3Bucket",
134+
"DomainName"
135+
]
136+
},
137+
"Id": "hostingS3Bucket",
138+
"S3OriginConfig": {
139+
"OriginAccessIdentity": {
140+
"Fn::Join": [
141+
"",
142+
[
143+
"origin-access-identity/cloudfront/",
144+
{
145+
"Ref": "OriginAccessIdentity"
146+
}
147+
]
148+
]
149+
}
150+
}
151+
}
152+
],
153+
"Enabled": "true",
154+
"DefaultCacheBehavior": {
155+
"AllowedMethods": [
156+
"DELETE",
157+
"GET",
158+
"HEAD",
159+
"OPTIONS",
160+
"PATCH",
161+
"POST",
162+
"PUT"
163+
],
164+
"TargetOriginId": "hostingS3Bucket",
165+
"ForwardedValues": {
166+
"QueryString": "false"
167+
},
168+
"ViewerProtocolPolicy": "redirect-to-https",
169+
"DefaultTTL": 86400,
170+
"MaxTTL": 31536000,
171+
"MinTTL": 60,
172+
"Compress": true
173+
},
174+
"DefaultRootObject": "index.html",
175+
"CustomErrorResponses": [
176+
{
177+
"ErrorCachingMinTTL": 300,
178+
"ErrorCode": 400,
179+
"ResponseCode": 200,
180+
"ResponsePagePath": "/"
181+
},
182+
{
183+
"ErrorCachingMinTTL": 300,
184+
"ErrorCode": 403,
185+
"ResponseCode": 200,
186+
"ResponsePagePath": "/"
187+
},
188+
{
189+
"ErrorCachingMinTTL": 300,
190+
"ErrorCode": 404,
191+
"ResponseCode": 200,
192+
"ResponsePagePath": "/"
193+
}
194+
]
195+
}
196+
}
197+
}
198+
},
199+
"Outputs": {
200+
"Region": {
201+
"Value": {
202+
"Ref": "AWS::Region"
203+
}
204+
},
205+
"HostingBucketName": {
206+
"Description": "Hosting bucket name",
207+
"Value": {
208+
"Ref": "S3Bucket"
209+
}
210+
},
211+
"WebsiteURL": {
212+
"Value": {
213+
"Fn::GetAtt": [
214+
"S3Bucket",
215+
"WebsiteURL"
216+
]
217+
},
218+
"Description": "URL for website hosted on S3"
219+
},
220+
"S3BucketSecureURL": {
221+
"Value": {
222+
"Fn::Join": [
223+
"",
224+
[
225+
"https://",
226+
{
227+
"Fn::GetAtt": [
228+
"S3Bucket",
229+
"DomainName"
230+
]
231+
}
232+
]
233+
]
234+
},
235+
"Description": "Name of S3 bucket to hold website content"
236+
},
237+
"CloudFrontDistributionID": {
238+
"Value": {
239+
"Ref": "CloudFrontDistribution"
240+
}
241+
},
242+
"CloudFrontDomainName": {
243+
"Value": {
244+
"Fn::GetAtt": [
245+
"CloudFrontDistribution",
246+
"DomainName"
247+
]
248+
}
249+
},
250+
"CloudFrontSecureURL": {
251+
"Value": {
252+
"Fn::Join": [
253+
"",
254+
[
255+
"https://",
256+
{
257+
"Fn::GetAtt": [
258+
"CloudFrontDistribution",
259+
"DomainName"
260+
]
261+
}
262+
]
263+
]
264+
}
265+
},
266+
"CloudFrontOriginAccessIdentity": {
267+
"Value": {
268+
"Ref": "OriginAccessIdentity"
269+
}
270+
}
271+
}
272+
}

amplify/backend/tags.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"Key": "user:Stack",
4+
"Value": "{project-env}"
5+
},
6+
{
7+
"Key": "user:Application",
8+
"Value": "{project-name}"
9+
}
10+
]

amplify/cli.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"features": {
3+
"graphqltransformer": {
4+
"addmissingownerfields": true,
5+
"validatetypenamereservedwords": true,
6+
"useexperimentalpipelinedtransformer": false,
7+
"enableiterativegsiupdates": true,
8+
"secondarykeyasgsi": true,
9+
"skipoverridemutationinputtypes": true
10+
},
11+
"frontend-ios": {
12+
"enablexcodeintegration": true
13+
},
14+
"auth": {
15+
"enablecaseinsensitivity": true,
16+
"useinclusiveterminology": true
17+
},
18+
"codegen": {
19+
"useappsyncmodelgenplugin": true,
20+
"usedocsgeneratorplugin": true,
21+
"usetypesgeneratorplugin": true,
22+
"cleangeneratedmodelsdirectory": true,
23+
"retaincasestyle": true
24+
},
25+
"appsync": {
26+
"generategraphqlpermissions": true
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)