Setting Up an S3 Static Website Using AWS CLI
- Open a terminal session and log in to the provided EC2 instance via SSH using the credentials provided on the lab page:
2. Create an S3 Bucket from AWS CLI- Create an S3 bucket in the us-east-1 region, replacing with a unique bucket name, and using the S3 API:
3. Modify the Newly Created Bucket to Be an S3 Website Bucket
– Issue the AWS S3 API CLI command to enable the “Static website hosting” property of your bucket. In
this same command, you’ll also provide the index.html page, which is what your bucket URL will serve:
4. Modify Provided S3 Policy File and Use It to Modify the Bucket Policy
-Open the policy_s3.json file:
-Copy the json file content in it.
-Save and exit the file.
5. Use the S3 policy file to modify the bucket policy so your objects are publicly accessible, which is a
requirement for S3 static websites:
6. Clone our web site from github Page and Upload File to S3 Website Bucket
7. Upload the all files to your S3 website bucket:
8. Verify Your S3 Static Website Is Working
-Enter the S3 website URL for your bucket in the browser to ensure it’s working.
You can also test from the terminal using the curl command:
9. To delete all the objects from an S3 bucket, –recursive option can be used after the specified bucket
name as shown below.
10. To delete the bucket give command shown below.
11. Instead of 8th and 9th step you can force to delete, so you can imply that command shown below.
Thank You!