Photo gallery using S3 and S3 object tags, hosted here.
This app makes use of S3 buckets, object tagging, access points, and identity pools. The access point and identity pool id should be saved to the .env
file.
- Create an S3 bucket.
- Go the the bucket permissions tab and enter in the
CORS
section:[ { "AllowedHeaders": ["*"], "AllowedMethods": ["GET"], "AllowedOrigins": ["*"], "ExposeHeaders": [] } ]
- Create an access point for the bucket.
- Turn off
Block all public access
for the access point and enter in theAccess Point policy
section:{ "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Principal": "*", "Action": ["s3:ListBucket", "s3:GetObjectTagging", "s3:GetObject"], "Resource": [ "arn:aws:s3:my-region:1234567890:accesspoint/bucket-name", "arn:aws:s3:my-region:1234567890:accesspoint/bucket-name/object/*" ] } ] }
- Create an identity pool, and attach this policy:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": ["s3:GetObject", "s3:GetObjectTagging", "s3:ListBucket"], "Resource": ["arn:aws:s3:::bucket-name/*", "arn:aws:s3:::bucket-name"] } ] }
- Upload photos and tag them. The tag format should be:
The
{ "Key": "adjectives", "Value": "adjective1 adjective2 adjective3" }
Value
is not comma-delimited because of AWS restrictions.