Sobes.tech
Junior

How to deploy a simple static landing page on AWS?

sobes.tech AI

Answer from AI

Amazon S3 configured for a static website, with AWS CloudFront for CDN and SSL.

  1. Create an S3 bucket with public access.
  2. Upload static website files (index.html, CSS, JS, images).
  3. Enable "Static website hosting" in bucket settings.
  4. Specify index.html as the index document.
  5. (Optional) Configure an error document.
  6. Create a CloudFront distribution.
  7. Choose the created S3 bucket as the Origin Domain (from the list).
  8. Configure caching and behavior as needed.
  9. (Optional) Attach a custom domain and upload an SSL/TLS certificate from AWS Certificate Manager (ACM).
  10. Wait for the CloudFront distribution to deploy.
  11. Use the CloudFront domain name (or the custom domain if attached) to access the site.

Example of a bucket policy for public access:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::YOUR_BUCKET_NAME/*" // Replace YOUR_BUCKET_NAME
        }
    ]
}