I’ve been going through the excellent AppSync Masterclass by Yan Cui. During the course I wanted to give GitHub Codespaces a try.
While Codespaces will correctly start a container with the the required node tools it doesn’t have the AWS cli which is needed for deployments from the Serverless framework. It tuns out the fix is quite simple and the Github documenation covers a lot of what you need.
The main part of it is you need to create a .devcontainer
folder in your repo. Inside this folder you need a Docker file and a devcontainer.json
file (Notice there is no . in the file name only in the folder name). Github has a repo with the base conatiners for the language you are using.
I used the Node container and created this Dockerfile.
1 | ARG VARIANT=16 |
The devcontainer.json just contains
1 | { |
Which is just copied from the GitHub template.
The next bit was I didn’t really want to store my credenitals in the container and GitHub and thought of that. I created to variables AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
with my credentials from AWS.
The last thing was rebuilding the CodeSpace and Restarting it, both of wich you do in VSCode from the command pallet.
After that try the aws cli.