This is a companion repo containing the code solutions for the Build Go Apps that Scale on AWS course on Frontend Masters
In order to complete this course, you should create an AWS account, install Go, the AWS CLI and the AWS CDK.
- Download and install Go: Go Download Page
- Create an AWS Account if you don't already have one.
- Install latest version of the AWS CLI
- Verify the installation by running
aws --version
- Verify the installation by running
- Configure an AWS user permissions
- Step 3 : Configure the AWS CLI
- Configure short or long term credentials
- Confirm your setup with:
aws s3 ls
andaws sts get-caller-identity
- 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 in the AWS console or using the following AWS CLI commands:
- Get your
ACCOUNT-NUMBER
using the following AWS CLI commandaws sts get-caller-identity --query Account --output text
- Get your
REGION
using the following AWS CLI commandaws configure get region
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.
If you dont want logging, you can add CloudWatchRole: jsii.Bool(true)
to the RestApiProps object.
Download the Gopls Extension for your editor
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.
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.
curl -X POST AWS_SERVER_URL/register -H "Content-Type: application/json" -d '{"username":"USERNAME", "password":"PASSWORD"}'
curl -X POST AWS_SERVER_URL/login -H "Content-Type: application/json" -d '{"username":"USERNAME", "password":"PASSWORD"}'
curl -X GET AWS_SERVER_URL/protected -H "Content-Type: application/json" -H "Authorization: Bearer JWT_TOKEN"
To remove the infrastructure created with the AWS CDK, run cdk destory
.
Before running cdk destroy
, you'll want to ensure you've added RemovalPolicy: awscdk.RemovalPolicy_DESTROY
in the awsdynamodb.TableProps
.