Back to blog
Jul 07, 2024
2 min read

AWS: Deploy static to AWS S3

Build Astro to static page (html)

DEPLOYMENT

Create a new bucket

First, you need to create a new bucket in S3. This is where your static files will be stored.

Attention!!!

Make sure to enable public access to the bucket. This is required for the site to be accessible.

Config policy for bucket

Next, you need to configure the bucket policy to allow public access to the files.

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::www.my-awesome-site.com/*"
        }
    ]
}

Upload files

Now you can upload the files to the bucket. You can use the AWS CLI or the S3 console. Example CLI command here:

aws s3 sync ./dist s3://cv.profille.pro --delete --region us-east-1