- Go to your IAM Console
- Select Users
- Click on the User Name
- Select "Security Credientials" tab
- Select "Create Access Key"
- Select "Show User Security Credentials"
- Select "Download Credentials" which will download a .csv file. SAVE THIS FILE IN A SECURE LOCATION, as you will no longer have access to this information
* Check to see if you have Python Installed (Python version 2.6.5+ or Python 3.3+).
python --version
- If not installed then install:
sudo apt-get install python2.7
- Check pip
pip --help
- If not installed then install:
curl -O https://bootstrap.pypa.io/get-pip.py
- Install AWS CLI
sudo pip install awscli
- If there is an error message, install this way:
sudo pip install awscli --ignore-installed six
- Quick Configuruation:
aws configure
- It will ask for your AWS Access Key ID & Secret Access Key (From your downloaded security credentials CSV file), Default Region Name, Default Output Format (you can leave this blank, default is JSON). Paste in the information.
- If you have multiple users, configure the specific user as follows:
aws configure --profile username
- To update, just run the same command again and update the information
You need to create and configure buckets to use AWS s3 Website Hosting
-
Log in to the AWS Console
-
Create two buckets (the bucket names must match the name of the custom domain you want to use), select US Standard as the region.
- www.example.com
- example.com
-
You can also create the buckets via the AWS Command Line
aws s3 mb s3://new-bucket-name
-
Click on the magnifying glass icon next to the root domain bucket name ((the one without the "www"), and select the "Permissions" tab at the top and select the "Static Website Hosting" section
-
Select "Enable Website Hosting" and set the Index document to be "index.html" and the error document to be "error.html" and Save
-
Click on magnifying glass icon next to the second bucket with the "www" and select the "Permissions" tab at the top and select the "Static Website Hosting" section
-
Select "Redirect all requests to another host name" and then enter example.com.s3-website-us-east-1.amazonaws.com (switch example.com to custom domain name and us-east-1 to appropriate region)
- Upload your website files to the root domain bucket (without the "www"). You can also do this via the Command line:
aws s3 sync filepath/of/local/file s3://bucket-name
-
Create a Hosted Zone for your Domain by logging into the Amazon Route 53 Console
-
Select "Get Started Now" under the "DNS Management" section (If you have not been here before, otherwise this will not show up)
-
Select "Created Hosted Zone"
-
Select "Create Hosted Zone" button at the top and enter a domain name and choose "Create"
-
To configure the alias record set for your root domain
-
On the "Hosted Zones" page, choose the hosted zone that you created for your domain
-
Choose "Go to Record Sets"
-
Choose "Create Record Set"
-
Leave the default name, which is the root domain
-
For Type, choose "A - IPv4 address"
-
For Alias, choose "Yes". An alias enables Amazon Route 53 to associate your domain name with the Amazon S3 bucket that you configured as a website endpoint.
-
Choose "Alias Target". Choose your root domain website endpoint from the list (for example, example.com). Do not select the www subdomain endpoint (for example, www.example.com).
-
For "Routing Policy", choose "Simple"
-
Leave "Evaluate Target Health" set to "No"
-
Choose "Create"
-
-
To configure the alias resource record set for your www subdomain
-
On the "Hosted Zones" page, choose the hosted zone that you created for your domain
-
Choose "Go to Record Sets"
-
Choose "Create Record Set"
-
For "Name", type "www". The root domain is already specified for you, and the connecting period (.) appears when you start typing.
-
For Type, choose "A - IPv4 address"
-
For Alias, choose "Yes".
-
Choose "Alias Target". Select your www subdomain website endpoint from the list (for example, www.example.com). Do not select the root domain endpoint (for example, example.com).
-
For "Routing Policy", choose "Simple"
-
Leave "Evaluate Target Health" set to "No"
-
Choose "Create"
-
-
Give all information in your hosted zone (Name Servers, A Records, etc.) to your Domain provider and ask them to change. It usually takes 2-3 days to propagate.
aws s3 rb s3://bucket-name
- The bucket must be empty to remove, to remove a non-empty bucket:
aws s3 rb s3://bucket-name --force
aws s3 ls