0% found this document useful (0 votes)
24 views

Hosting a static website on AWS S3

Uploaded by

mypolmadhuk
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Hosting a static website on AWS S3

Uploaded by

mypolmadhuk
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

How to host a static website on AWS S3?

Hosting a static website on AWS S3 is a straightforward process. Here are the general steps:

Step 1: Prepare Your Website Files.

Step 2: Create an S3 Bucket.

1. Go to the AWS S3 Console:

2. Create a New Bucket:

3. Configure Bucket Settings: Here turn on “ACL enabled”

4. Upload Folder:
5. Configure Properties: Enable static website hosting by going to the "Properties" tab and
selecting "Static website hosting." Choose an index document (e.g., index.html) and an
optional error document.
6. Set Permissions: Configure bucket permissions by adding a bucket policy that allows
public read access. This is necessary for users to view your website.

Example Bucket Policy:

"Version": "2012-10-17",

"Id": "Policy1706857670574",

"Statement": [
{

"Sid": "Stmt1706857668899",

"Effect": "Allow",

"Principal": "*",

"Action": "s3:GetObject",

"Resource": "arn:aws:s3:::camphelpinfo/*"

Set Permissions for Individual Files:

1. Select the file in the S3 bucket.


2. Click "Actions" > "Make public" (or "Make private" if you want to restrict
access).

Go to Powershell in your local machine : Run Command :

After these two command you’ll be able to access website

How to edit a page on a website hosted on AWS S3?

1. Download the File:

Download the file from S3 to your local machine. You can use the AWS S3 console, AWS
CLI . eg: aws s3 cp s3://your-bucket/path/to/your-file.html .
OR,
Simply you can download particular file from aws s3 .
2. Edit the File:

Note: After changing in mkdocs don’t forget to run command

1. mkdocs build
2. mkdocs serve.

3. Upload the Updated File:


Upload the edited file back to the same location in your S3 bucket. You can use the AWS
S3 console, AWS CLI, or an S3 client:

Eg: aws s3 cp your-file.html s3://your-bucket/path/to/your-file.html

Or,

Or
aws s3 sync site/ s3://camphelp.info/

How to transferring the objects from the old bucket to the new one on
AWS S3?

1. Create a New Bucket: Make All changes like we do for new bucket
creation.
2. Transfer Objects: Use AWS CLI

aws s3 sync s3://old-bucket-name s3://new-bucket-


name.(You can use cp also in place of sync )

Again update using


aws s3 sync ./site s3://camphelp.info

How to delete a bucket in AWS S3?

1. Empty the bucket


2. Then, delete the bucket.

How to map a static website on AWS S3 with a domain name (using


BigRock)?

• Created hosted zone- Route 53- to point to domain: Note: For this process your domain
name must be same as bucket name.

a) Give domain name same as your domain name and type should be “public hosted
zone”
b) Now create record See Screenshort

c) Now copy paste NS record from aws rote 53 to domain provider website :

See Screenshot:
It will reflect after sometime, you can check on cmd use command : ping
domain name , if it return reply means your domain is linked with your aws s3
website successfully.

• Issued SSL Certificate: (Secure Sockets Layer)

In short, SSL certificates:

1. Encrypt data transmitted between a web server and a user's browser.


2. Authenticate the identity of the website to visitors.
3. Ensure data integrity during transmission.
4. Improve search engine rankings.
5. Help meet compliance requirements for handling sensitive information.

AWS Certificate Manager is a way to manage SSL Certificate.

https://www.youtube.com/watch?v=aWjCKHn27r8

View this video for SSL CERTICATE OR CLOUDFRONT. In fact for all whole process.

• Cloud front- For super-fast delivery. (Protect from cyber-attack)

You might also like