> For the complete documentation index, see [llms.txt](https://arav-yadav.gitbook.io/project-hosting-static-website-on-aws./llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://arav-yadav.gitbook.io/project-hosting-static-website-on-aws./o.md).

# Project :Hosting static website on AWS using S3 bucket

1. Sign in to the AWS Management Console and navigate to the S3 service

<figure><img src="https://2940119001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe4nUT8Ka4E7VUDQL7A25%2Fuploads%2FFtSijMbjRRTF9uA3SF5e%2FScreenshot%202023-03-30%20052615.png?alt=media&amp;token=98ee4c53-f5d7-4fe8-b8f6-f6d7b1a2aa01" alt=""><figcaption></figcaption></figure>

2. Create a new S3 bucket by clicking on the "Create bucket" button. Give it a unique name and select the region where you want to host your website.

<figure><img src="https://2940119001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe4nUT8Ka4E7VUDQL7A25%2Fuploads%2F34PJW1kKOFRtYPQzUFKU%2FScreenshot%202023-03-30%20054155.png?alt=media&amp;token=71919831-e41c-409f-becc-539bea1202b5" alt=""><figcaption></figcaption></figure>

3. the bucket properties, enable static website hosting by selecting the "Static website hosting" option and providing the index and error documents (e.g., index.html and error.html).

<figure><img src="https://2940119001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe4nUT8Ka4E7VUDQL7A25%2Fuploads%2F5DMhqmPMSKeqHFlRmV6K%2Fscreencapture-s3-console-aws-amazon-s3-bucket-myprojectons3-property-website-edit-2023-03-30-06_08_36.jpg?alt=media&amp;token=0d9de68c-40a7-460f-8dec-f5d7b70e3e44" alt=""><figcaption></figcaption></figure>

4. Click on the name of the bucket to open it, and then click on the "Upload" button to upload your website files. You can either drag and drop your files into the upload window or click on the "Add files" buttom to select them from your computer.

<figure><img src="https://2940119001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe4nUT8Ka4E7VUDQL7A25%2Fuploads%2FP8oenJlMx6etDZ1yErpM%2Fscreencapture-s3-console-aws-amazon-s3-upload-myprojectons3-2023-03-30-06_15_40.jpg?alt=media&amp;token=ae7b7a50-65c3-4f72-b25f-d7892366668b" alt=""><figcaption></figcaption></figure>

5. &#x20;In **Permissions** section of your  bucket, you can also configure Block Public Access settings. Under tab, select "Block public access"Under the Permissions tab, select "Block public access" and turn off the following settings:

<figure><img src="https://2940119001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe4nUT8Ka4E7VUDQL7A25%2Fuploads%2FCBu1hHBZF0SRzOVmRHo9%2Fscreencapture-s3-console-aws-amazon-s3-bucket-gjhfghgfhgd-property-bpa-edit-2023-03-30-07_14_54.jpg?alt=media&amp;token=1b39cb55-2ac2-4fcf-a0a0-4c7831b178eb" alt=""><figcaption></figcaption></figure>

6. To control access to your website, you can set up ACLs on your bucket. Under the Permissions tab, you can add a Bucket Policy to allow or deny access to specific users or IP addresses. For example, to make your website public, you can add the following Bucket Policy:

```
{
  "Id": "Policy1680141251799",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1680141246447",
      "Action": [
        "s3:GetObject"
      ],
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::myprojectons3",
      "Principal": "*"
    }
  ]
}

```

Now you can Open the URL in a new tab and .You will now be able to see your websiteThat's it! Your static website is now hosted in your S3 bucket and accessible to the public

<figure><img src="https://2940119001-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe4nUT8Ka4E7VUDQL7A25%2Fuploads%2FFdpUAQPQgSTraFFX4mqe%2FScreenshot%202023-03-25%20033412.png?alt=media&amp;token=23df0865-6e14-428b-8a39-eedd8b5b69c8" alt=""><figcaption></figcaption></figure>
