Attention

This workshop content is over a year old and AWS Amplify has made a great deal of improvements since this content was originally written.

Instead of this content, please check out some of the more up-to-date Amplify content. One great example is the AWS Serverless Airline Booking project. Besides that, you can find lots more excellent AWS Amplify content on the AWS Amplify Community site.

If you would still like to review the content of this workshop, these instructions should still work, provided you use the specific version of AWS Amplify noted in the Prerequisites section.

Installs & Configs

Before we begin coding, there are a few things we need to install, update, and configure in the Cloud9 environment.

Installing and updating

In the Cloud9 terminal, run the following commands to install and update some software we’ll be using for this workshop:

# Update the AWS CLI
pip install --user --upgrade awscli

# Install and use Node.js v8.11 (to match AWS Lambda)
nvm install v8.11.0
nvm alias default v8.11.0

# Install the AWS Amplify CLI
npm install -g @aws-amplify/cli@1.12.0

# Install jq
sudo yum install jq -y

These commands will take a few minutes to finish.

Configuring a default region

A best practice is to deploy your infrastructure close to your customers, let’s configure a default AWS region for this workshop : Northern Virginia (us-east-1) for North America or Ireland (eu-west-1) for Europe.

Create an AWS config file, run:

cat <<END > ~/.aws/config
[default]
region=us-east-1
END
cat <<END > ~/.aws/config
[default]
region=us-west-2
END
cat <<END > ~/.aws/config
[default]
region=eu-west-1
END
cat <<END > ~/.aws/config
[default]
region=ap-southeast-1
END

The AWS Amplify CLI is a toolchain which includes a robust feature set for simplifying mobile and web application development. The step above took care of installing it, but we also need to configure it. It needs to know what region to work with, and it determines this by looking for the ~/.aws/config file. Cloud9 takes care of making sure we have valid Administrator credentials in the ~/.aws/credentials file, but it doesn’t create ~/.aws/config for us.