Skip to content

Instantly share code, notes, and snippets.

@M1ke
Last active May 15, 2019 13:36
Show Gist options
  • Save M1ke/3a328470cb799d9c65209b055f488f8e to your computer and use it in GitHub Desktop.
Save M1ke/3a328470cb799d9c65209b055f488f8e to your computer and use it in GitHub Desktop.
A guide to prepare for the AWS workshop on Friday 22nd Feb at PHPUK conference

In order to get the most from the workshop you'll benefit from being able to follow along on your own machine. The setup for this is not complicated but it will require you to have carried out a few tasks beforehand to save time during the workshop - we only have 2 hours after all.

All the steps below should take you no more than 30 minutes, more likely around 15! If you need help Tweet me @m1ke

You can pre-register for the session here and you'll need a code that was emailed to you with subject "PHP UK Conference - Info for Attendees"

The key aspect is this: you must have CLI access to a working AWS account with billing enabled. You will incur some costs during the workshop but if you stick to the advice given these costs are likely to be in the region of cents to a dollar at most. Be aware that once you have an AWS account with billing enabled you should do your best to keep the credentials used to access that account secure. If you are concerned about this you can always remove your billing details after the workshop.

If you are using somebody else's AWS account (e.g. a work account) ensure that your user or role has admin rights - you won't need every possible permission in the workhsop but it helps for us not to have to list them.

Configuring AWS

Sign up for a new AWS account here and come back when you're done.

The next thing you'll need is the awscli package, letting you run aws commands from your terminal. There are a variety of ways to install it and they can all be found here but I recommend installing via Python's "pip" package manager as this also installs useful python tools we can use later.

To set up access via CLI you need an access key and secret key for your account. As usual there's a really good AWS guide for this but the long and short of it is that you go to the IAM dashbpard when signed in and get your keys from the drop down. Alternatively, visit the "Users" menu on the left and create a new user with the "AdministratorAccess" permission.

Once you have the text of an access key and secret key you can configure your cli by running aws configure. If asked about region I recommend "eu-west-1" and output type as "json"

To confirm your CLI works run aws sts get-caller-identity which should return some account and user information.

Installing tools

You'll need git, python3, pip3 and some sort of text editor - I'll consider you can probably figure out installing these for yourselves!

We will use two "infrastructure as code" programs, Packer and Terraform, both by HashiCorp. Both of these are distributed as precompiled binaries, meaning they are relatively simple to install but not available via package managers.

Download packer Download Terraform

For both the download will be a zip file. Unzip it and you'll have a single binary. On a unix system the easiest way to make this executable is to do:

chmod +x packer
sudo mv packer /usr/local/bin/
packer -v

(then the same again for terraform). The final command shows you the installed version.

Installing boto

Boto is a python library for interacting with AWS. If you installed awscli via pip you should already have it. Run:

pip3 list | grep boto

If the list shows two packages (botocore and boto3) then you're good. If not run sudo pip3 install boto3 and try again. Once you've installed boto check awscli still works using aws sts get-caller-identity. Get in touch if it doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment