WebStoreBucketName:
Type: String
Default: fcjdmswebstore
Thay đổi giá trị Default để thay đổi tên cho bucket
FcjDMSWebStore:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref WebStoreBucketName
PublicAccessBlockConfiguration:
BlockPublicAcls: "false"
BlockPublicPolicy: "false"
WebsiteConfiguration:
IndexDocument: 'index.html'
FcjDMSWebStorePolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref FcjDMSWebStore
PolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- "s3:GetObject"
Effect: Allow
Principal: "*"
Resource: !Join
- ""
- - "arn:aws:s3:::"
- !Ref FcjDMSWebStore
- /*
sam build
sam deploy
yarn build
aws s3 cp build s3://BUCKET_NAME --recursive
Thay thế BUCKET_NAME
bằng tên bucket bạn vừa tạo để host website, ví dụ: aws s3 cp build s3://fcjdmswebstore --recursive
Bạn đã hoàn thành việc host một website tĩnh trên S3, xác thực người dùng với Cognito, lưu trữ tài liệu trên S3. Tiếp theo chúng tã sẽ thiết lập REST API cho ứng dụng.