Sau khi bạn đã tạo tài khoản với Cognito User Pool thành công, chúng ta sẽ dùng tài khoản đó để upload file lên S3 bucket với Amplify trong phần này.
Ấn tổ hợp Ctrl+C trong terminal hoặc command line
Chạy câu lệnh dưới đây tại thư mục gốc của ứng dụng mà bạn clone về để thêm storage cho ứng dụng:
amplify add storage
Chọn và nhập theo các thông tin dưới đây:
? Please select from one of the below mentioned services: Content (Images, audio, video, etc.)
Provide a friendly name for your resource that will be used to label this cateogry in the project: fcjdmsstore
Provide bucket name: fcjdmsstore
Who should have access: Auth users only
What kind of access do you want for Authenticated user? Ấn tổ hợp Ctrl + A
Do you want to add a Lambda Trigger for your S3 Bucket? no
amplify push
npm start
Vậy là bạn đã hoàn thành việc xác thực người dùng và tải tệp lên S3 với Amplify. Trong S3 bucket đã được tạo thư mục protected bởi vì ứng dụng của chúng ta chọn Access Level là protected. Để tìm hiểu thêm về Access Level, bạn hãy chuyển sang phần tiếp theo.