Create an S3 bucket as follows:
aws s3api create-bucket
--bucket serverlesscookbook-cognito-files
--profile admin
Upload the amazon-cognito-identity.min.js file:
aws s3 cp amazon-cognito-identity.min.js s3://serverlesscookbook-cognito-files
--profile admin
Execute the bucket policy that allows public read access to the bucket:
aws s3api put-bucket-policy
--bucket serverlesscookbook-cognito-files
--policy file://s3-website-policy.json
--profile admin
The s3-website-policy.json file should have these contents:
{ "Version":"2012-10-17",
"Statement":[
{ "Sid":"PublicReadGetObjectAccess",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::serverlesscookbook-cognito-files/*"]
} ]
}