Frontend Masters Course: Build Go Apps that Scale on AWS

This is a companion repo containing the code solutions for the Build Go Apps that Scale on AWS course on Frontend Masters

Setup Instructions

In order to complete this course, you should create an AWS account, install Go, the AWS CLI and the AWS CDK.

Install Go (preferably version > = 1.18)

Install the AWS CLI

CDK installed (use CDK command)

  • Download CDK
  • Make sure you bootstrap your environment with:
cdk bootstrap aws://ACCOUNT-NUMBER/REGION

Here's more info about boostrapping the CDK. Your ACCOUNT-NUMBER and REGION can be found the AWS console.

CloudWatch Logs

Some users received CloudWatch logging errors during the API Gateway lessons. Logging to CloudWatch is not required, but you can prevent these errors by following these steps.

Gopls Extension

Download the Gopls Extension for your editor

Code Solutions

All code for this course is written from scratch. The branches in this repo are code checkpoints for sections within the course:

  • The main branch contains everything you need for the Go Basics section
  • The chapter_0 branch contains the solution to the AWS & CDK section
  • branch chapter_1 branch contains the solution to the DynamoDB & Insertin Users section
  • branch chapter_2 branch contains the solution to the AAPI Gateway & Authentication Routes section
  • branch chapter_3 branch contains the solution to the JSON Web Tokens & Protected URLs section

Note: The code in the above branches may not match what was coded during the course. See the live_workshop branch for the final course code.

cURL Commands

At the end of the course, the API routes are tested with cURL commands. You can copy/paste these commands instead of typing them out.

Register

curl -X POST AWS_SERVER_URL/register -H "Content-Type: application/json" -d '{"username":"USERNAME", "password":"PASSWORD"}'

Login

curl -X POST AWS_SERVER_URL/login -H "Content-Type: application/json" -d '{"username":"USERNAME", "password":"PASSWORD"}'

Access Protected Route

curl -X GET AWS_SERVER_URL/protected -H "Content-Type: application/json" -H "Authorization: Bearer JWT_TOKEN"

Remove infrastructure create with CDK

To remove the infrastructure created with the AWS CDK, run cdk destory.