Skip to content

Commit 1132cdb

Browse files
author
Travis Sheppard
authored
chore(storage): add provision script for storage integration test resources (#1605)
1 parent 38bc3a1 commit 1132cdb

File tree

5 files changed

+66
-54
lines changed

5 files changed

+66
-54
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ $ melos run provision_integration_test_resources
222222
Note: you will need to have [`jq`](https://github.com/stedolan/jq) installed, which you can install by running `brew install jq`.
223223
The provisioning script uses the [Amplify CLI headless mode](https://docs.amplify.aws/cli/usage/headless).
224224

225-
Additionally, the storage category requires some manual configuration as the [headless CLI does not yet support storage](https://github.com/aws-amplify/amplify-cli/issues/7378). Those instructions
226-
are notes in the [storage example app](packages/amplify_storage_s3/example/README.md).
227-
228225
## Code of Conduct
229226

230227
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,3 @@
11
# amplify_storage_s3_example
22

33
Example app for the Amplify Flutter Storage plugin with AWS S3 provider.
4-
5-
## How to Configure Amplify Backend
6-
7-
This app (as well as integration tests) depend on an Amplify backend with the storage category
8-
configured for guest access.
9-
10-
First, initialize the Amplify backend with:
11-
12-
```
13-
$ cd packages/amplify_storage_s3/example
14-
$ amplify init
15-
```
16-
17-
After completing the prompts, add storage category.
18-
19-
```
20-
$ amplify add storage
21-
? Please select from one of the below mentioned services: Content (Images, audio, video, etc.)
22-
? You need to add auth (Amazon Cognito) to your project in order to add storage for user files. Do you want to add auth now?
23-
Yes
24-
Using service: Cognito, provided by: awscloudformation
25-
26-
The current configured provider is Amazon Cognito.
27-
28-
Do you want to use the default authentication and security configuration? Default configuration
29-
Warning: you will not be able to edit these selections.
30-
How do you want users to be able to sign in?
31-
Username
32-
Do you want to configure advanced settings?
33-
No, I am done.
34-
Successfully added auth resource MYRESOURCENAME locally
35-
36-
Some next steps:
37-
"amplify push" will build all your local backend resources and provision it in the cloud
38-
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
39-
40-
? Please provide a friendly name for your resource that will be used to label this category in the project:
41-
myGreatProjectNameStorage
42-
? Please provide bucket name:
43-
exampleBucketNameUnique12345
44-
? Who should have access:
45-
Auth and guest users
46-
? What kind of access do you want for Authenticated users?
47-
create/update, read, delete
48-
? What kind of access do you want for Guest users?
49-
create/update, read, delete
50-
? Do you want to add a Lambda Trigger for your S3 Bucket?
51-
No
52-
```
53-
54-
Finally, run `$ amplify push` to provision the storage resource in the cloud.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": 1,
3+
"resourceName": "storageintegrationtestauth",
4+
"serviceConfiguration": {
5+
"serviceName": "Cognito",
6+
"userPoolConfiguration": {
7+
"signinMethod": "USERNAME",
8+
"requiredSignupAttributes": ["EMAIL", "PHONE_NUMBER"]
9+
},
10+
"includeIdentityPool": true,
11+
"identityPoolConfiguration": {
12+
"unauthenticatedLogin": true
13+
}
14+
}
15+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"resourceName": "storageintegrationtests3",
4+
"serviceConfiguration": {
5+
"serviceName": "S3",
6+
"permissions": {
7+
"auth": [],
8+
"guest": ["CREATE_AND_UPDATE", "READ", "DELETE"]
9+
},
10+
"bucketName": "storageintegbucket"
11+
}
12+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -e
3+
IFS='|'
4+
5+
profileName=${AWS_PROFILE:-default}
6+
7+
FLUTTERCONFIG="{\
8+
\"ResDir\":\"./lib/\",\
9+
}"
10+
11+
AMPLIFY="{\
12+
\"projectName\":\"amplifyStorageInteg\",\
13+
\"envName\":\"test\",\
14+
\"defaultEditor\":\"code\"\
15+
}"
16+
17+
FRONTEND="{\
18+
\"frontend\":\"flutter\",\
19+
\"config\":$FLUTTERCONFIG\
20+
}"
21+
22+
AWSCLOUDFORMATIONCONFIG="{\
23+
\"configLevel\":\"project\",\
24+
\"useProfile\":\"true\",\
25+
\"profileName\":\"$profileName\",\
26+
\"region\":\"us-west-2\"\
27+
}"
28+
PROVIDERS="{\
29+
\"awscloudformation\":$AWSCLOUDFORMATIONCONFIG\
30+
}"
31+
32+
amplify init \
33+
--amplify $AMPLIFY \
34+
--frontend $FRONTEND \
35+
--providers $PROVIDERS \
36+
--yes
37+
cat tool/add_auth_request.json | jq -c | amplify add auth --headless
38+
cat tool/add_storage_request.json | jq -c | amplify add storage --headless
39+
amplify push --yes

0 commit comments

Comments
 (0)