Hosting a static website using Amazon S3
Easy to manage and maintain: When necessary, AWS S3 offers a simple console interface for managing and maintaining bucket objects. It also offers API support using the AWS SDKs that are available
The following instructions provide an overview of how to create your buckets for website hosting. For detailed, step-by-step instructions on creating a bucket, see Creating a bucket.
To create a bucket
Sign in to the AWS Management Console and open the Amazon S3 console
Choose Create bucket.
Enter the Bucket name (for example, pradhyuman.com).
Choose the Region where you want to create the bucket.
Choose a Region that is geographically close to you to minimize latency and costs, or to address regulatory requirements. The Region that you choose determines your Amazon S3 website endpoint. For more information,
To accept the default settings and create the bucket, choose Create.
By default, Amazon S3 blocks public access to your account and buckets. If you want to use a bucket to host a static website, you can use these steps to edit your block public access settings.
Warning
Before you complete this step, review Blocking public access to your Amazon S3 storag to ensure that you understand and accept the risks involved with allowing public access. When you turn off block public access settings to make your bucket public, anyone on the internet can access your bucket. We recommend that you block all public access to your buckets.
Open the Amazon S3 console
Choose the name of the bucket that you have configured as a static website.
Choose Permissions.
Under Block public access (bucket settings), choose Edit.
Clear Block all public access, and choose Save changes.
Step 3: Configure an index document
When you enable static website hosting for your bucket, you enter the name of the index document (for example, index.html
). After you enable static website hosting for the bucket, you upload an HTML file with this index document name to your bucket.
To configure the index document
Create an
index.html
file.If you don't have an
index.html
file, you can use the following HTML to create one:Save the index file locally.
<html xmlns="http://www.protechstat.com/" >
<head>
<title>My Website Home Page</title>
</head>
<body>
<h1>Welcome to my website</h1>
<p>pradhyuman ghodela</p>
</body>
</html>
The index document file name must exactly match the index document name that you enter in the Static website hosting dialog box. The index document name is case sensitive. For example, if you enter
index.html
for the Index document name in the Static website hosting dialog box, your index document file name must also beindex.html
and notIndex.html
.Sign in to the AWS Management Console and open the Amazon S
In the Buckets list, choose the name of the bucket that you want to use to host a static website.
Enable static website hosting for your bucket, and enter the exact name of your index document (for example,
index.html
). For more information, see Enabling website hosting.After enabling static website hosting, proceed to step 6.
To upload the index document to your bucket, do one of the following:
Drag and drop the index file into the console bucket listing.
Choose Upload, and follow the prompts to choose and upload the index file.
For step-by-step instructions, see Uploading objects.
(Optional) Upload other website content to your bucket.
After you create a bucket, you can enable static website hosting for your bucket. You can create a new bucket or use an existing bucket.
To enable static website hosting
Sign in to the AWS Management Console and open the Amazon S3
In the Buckets list, choose the name of the bucket that you want to enable static website hosting for.
Choose Properties.
Under Static website hosting, choose Edit.
Choose Use this bucket to host a website.
Under Static website hosting, choose Enable.
In Index document, enter the file name of the index document, typically
index.html
.The index document name is case sensitive and must exactly match the file name of the HTML index document that you plan to upload to your S3 bucket. When you configure a bucket for website hosting, you must specify an index document. Amazon S3 returns this index document when requests are made to the root domain or any of the subfolders. For more information
Step 5: Add a bucket policy that makes your bucket content publicly available
After you edit S3 Block Public Access settings, you can add a bucket policy to grant public read access to your bucket. When you grant public read access, anyone on the internet can access your bucket.
Important
The following policy is an example only and allows full access to the contents of your bucket. Before you proceed with this step, review How can I secure the files in my Amazon S3 bucket to ensure that you understand the best practices for securing the files in your S3 bucket and risks involved in granting public access.
Under Buckets, choose the name of your bucket.
Choose Permissions.
Under Bucket Policy, choose Edit.
To grant public read access for your website, copy the following bucket policy, and paste it in the Bucket policy editor.Update the
Resource
to your bucket name.In the preceding example bucket policy,
Bucket-Name
is a placeholder for the bucket name. To use this bucket policy with your own bucket, you must update this name to match your bucket name.{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::Bucket-Name/*"
]
}
]
}
Choose Save changes.
A message appears indicating that the bucket policy has been successfully added.
If you see an error that says
Policy has invalid resource
, confirm that the bucket name in the bucket policy matches your bucket name. For information about adding a bucket policy, see How do I add an S3 bucket policy?If you get an error message and cannot save the bucket policy, check your account and bucket Block Public Access settings to confirm that you allow public access to the bucket.
Configuring a static website using a custom domain registered with Route 53
example.com
), and you want requests for http://www.example.com
and http://example.com
to be served from your Amazon S3 content. You can use this walkthrough to learn how to host a static website and create redirects on Amazon S3 for a website with a custom domain name that is registered with Route 53. You can work with an existing website that you want to host on Amazon S3, or use this walkthrough to start from scratch.Add alias records for your domain and subdomain
In this step, you create the alias records that you add to the hosted zone for your domain maps example.com
and www.example.com
. Instead of using IP addresses, the alias records use the Amazon S3 website endpoints. Amazon Route 53 maintains a mapping between the alias records and the IP addresses where the Amazon S3 buckets reside. You create two alias records, one for your root domain and one for your subdomain.
https://www.drkkvakildentalclinic.com/
ReplyDeleteDental Excellence visit this site.....
Dental Excellence visit this site.....
ReplyDelete