This is the multi-page printable view of this section.
Click here to print.
Return to the regular view of this page.
Concepts
What you need to know!
Whilst reading the sections you’ll be presented with the Well Architected Bar, this is to tell you which parts of the Well-Architected Framework is applicaple to the content you are about to read. The example below indicates that Security is the main focus of the content but the content is also applicable to Operational Excellence as a secondary catergory.
OpEx
Sec
Rel
Perf
Cost
Sus
This book includes code samples and command line (CLI) instructions to run as you go through it. The code blocks will be Terraform or Python code, the code blocks will always be tagged with the correct language like so:
import boto3, botocore
import base64, os, json, requests
from aws_lambda_powertools import Tracer
from aws_lambda_powertools.logging.logger import set_package_logger
set_package_logger()
# POWERTOOLS_SERVICE_NAME defined
tracer = Tracer(service="s3r")
def check_safeurl(url):
''' check url to make sure its not on a blocked list'''
if os.environ['SafeBrowsing'] == 'true':
……
Command Line instructions will be indented on their own line, for example
aws s3 ls
Should you need to change a variable in the code or CLI instruction it will be highlighted in bold and <> for example <AWS_REGION>
1 - Getting Setup
Getting your environment ready for working with this book
I recommend that unless you have everything ready to go on your local machine that you use the AWS cloud console shell to run the examples in this book. It comes pre-configured with you IAM keys for access to your account and already has the aws CLI and python installed. Be warned python defaults to version 2.7.18 at the time of writing however version 3.7 is installed and that’s what we will use.
To open the cloud shell simply click on the shell icon in the top right hand corner once you log into your AWS account:
You should tehn be prompted with the following screen after 30 seconds whilst it spins up:
I now recommend you run some updates to get us all on the same track:
Finally in the setup section lets install terraform. Terraform is a Infrastructure as code tool produced by hashicorp and is an alternative to Amazon’s own CloudFormation. I’m including both in this book as which one you prefer is down to your preference.
Let us install unzip first so you can extract the terraform file:
Find the latest release version of terraform from here: https://github.com/hashicorp/terraform/releases in my case its 1.1.2
This sets the variable $release for the following commands
sudo wget https://releases.hashicorp.com/terraform/${release}/terraform_${release}_linux_amd64.zip
You should see the output of wget downloading the file here. Now lets unzip the file and put it somewhere useful.
unzip terraform_${release}_linux_amd64.zip
sudo unzip terraform_${release}_linux_amd64.zip
sudo mv terraform /usr/local/bin/
terraform version
The final command should return the current version of terraform, in my case, it’s 1.1.2