We will use terraform to create all the resources needed in AWS. If you are not
interestd in having terraform provision the resources, use the links below to
do it manually. The three main components that will be created will the be the
API gateway resources, lambda function, and S3 buckets. To get started checkout
the apporpriate branch. The advanced
branch will contain the terraform code
to create what is needed for the YouTube video (work in progress). The
basic
and master
branches have the terraform code needed for the blog post.
To setup remote state navigate to users/terraform/state-storage
and open
main.tf
. Rename the bucket name to something of your choosing, S3 bucket names
need to be globally unique. Once that is done from users/
run ./deploy.sh --state
.
Once the bucket has been created, edit the bucket
value for the terraform backend in
users/terraform/main.tf
. Use the same value as the bucket for the state
storage. These are the only changes that should be needed to run the other commands
in the blog post!
Since the above describes how to use terraform I have not gone through the steps on provisioning the resources in the AWS console. Instead I've provided links to documentation written by AWS.
- Create a S3 bucket
- Create a lambda function
- API Gateway Developer Guide
- Controlling Access to an API in API Gateway
- DynamoDB Developer Guide
To clean up with terraform, from users/
run ./destroy.sh
and once that is complete
run ./destroy.sh --state
. Those commands will destroy EVERYTHING that was created with deploy.sh
.