S3 Bucket Setup
To use this package, you’ll need to create an S3 bucket and configure it to allow public access. Here are the steps to do that:
Create an S3 bucket
Go to the S3 Management Console and create a new bucket. Ensure the name matches the REBUILT_S3_BUCKET_NAME
environment variable.
Bucket permissions
Once the bucket is created you'll need to go to the permissions tab and make sure that public access is not blocked. https://rebuilt.s3.ca-central-1.amazonaws.com/publi.png (opens in a new tab)
Bucket policy
Next, you'll need to create a bucket policy that allows public access. Copy this policy and replace the BUCKET_NAME with your bucket name:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::BUCKET_NAME/*"
}
]
}
CORS configuration
Next, you'll need to configure CORS to allow cross-origin requests.
[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["PUT", "POST"],
"AllowedOrigins": ["*"],
"ExposeHeaders": ["ETag"]
}
]
IAM and API keys
Finally, you'll need to create an IAM user to get your ACCESS_KEY_ID and SECRET_ACCESS_KEY. You can do this by going to the IAM Management Console and creating a new user with programmatic access.
For the permissions step you'll need to add the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::BUCKET_NAME/*"
}
]
}
Replace BUCKET_NAME with your bucket name.