When creating this site I wanted something that was as low maintenance (and as cheap!) as possible, including deployments; that meant creating an automated pipeline to deploy the site when changes were made.
Here’s a short guide on how to create an automated deployment pipeline using existing AWS products. For the purposes of this guide, we’re going to be setting up a website for www.testing-purposes.com
CodeCommit
CodeCommit is AWS’s Git repository server and while you could use GitHub as your repository, I use CodeCommit as it’s free to keep unlimited private repositories for up to 5 users. If you are using GitHub, you can still use CodeBuild, S3, etc. but you won’t have as easy a setup for CloudWatch.
S3
Create the bucket
- Navigate to S3 and click on
Create Bucket. - When creating a new S3 bucket, you have to give it a unique name - as we’re planning on hosting a website from it, we’ll just use the domain name: www.testing-purposes.com.
- Pick your desired region, then hit next and next again and uncheck ‘Block all public access’ as public access will be required to view the site.
- Click next and then create bucket.
Assign permissions
Now that the bucket has public access, we need to assign permissions to it.
- Head into S3 and select the bucket
- Click on the Permissions tab
- Click on the
Bucket Policybutton and paste in the following:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::www.testing-purposes.com/*"
]
}
]
}This will allow public read only (via s3:GetObject) access to the bucket