We’ll need a place to store all of the photos that get uploaded to our albums. Amazon Simple Storage Service (S3) is a great option for this and Amplify’s Storage module makes setting up and working with S3 very easy.
You can read more about Amplify’s Storage module here.
First, we’ll use the Amplify CLI to enable storage for our app. This will create a bucket on Amazon S3 and set it up with appropriate permissions so that users who are logged in to our app can read from and write to it.
From the photo-albums directory, run
amplify add storage
Select ‘Content’ at the prompt
Enter values or accept defaults for the resource category and bucket name
Configure it so that only authenticated users have access with read/write permissions.
Here is sample output with responses:
$ amplify add storage ? Please select from one of the below mentioned services: Content (Images, audio, video, etc.) ? Please provide a friendly name for your resource that will be used to label this category in the project: photoalbumsstorage ? Please provide bucket name: <accept the default value> ? Who should have access: Auth users only ? What kind of access do you want for Authenticated users: read/write
Now we’ll have Amplify modify our cloud environment, provisioning the storage resources we just added.