This API concerns sales of yummy doughnuts from the Northcoders bakery.
The code should be deployable in any Unix-like OS. The build process outlined below requires Python
be installed along with GNU Make. MacOS users can get access
to the make
command via Homebrew or MacOS Command Line Tools.
To run the API locally:
To run the API locally:
- Fork and clone the repo.
- Ensure that your Python interpreter is Python at least 3.11.x - you may use a tool like
pyenv
. - In the root of the project, create the run environment with:
make requirements
- Set up the required dev tools:
make dev-setup
- Run the tests.
make run-checks
- Start the server by running:
make start-server
- In your browser, navigate to
localhost:8000/docs/
to view the API documentation page. - Then you can navigate to the endpoint of your choice, e.g.
localhost:8000/api/doughnuts
. This could be done in your browser, but a tool like Insomnia is very useful.
API logs are available in logs/app.log
.
This is an exercise for you! You should begin by getting Free Tier access to AWS. You will need to set up local credentials.
Caution: Free Tier access comes with limits - if you exceed them you can be charged!
You can try to do this manually using the console. Use the EC2 wizard to set up an instance as in the demonstration.
However, it is much better to deploy the API via Terraform. You will need to install Terraform first.
This is a tough exercise but it can teach you a lot about AWS and Infrastructure as Code.
Then, working in the terraform
directory, you will need to use the terraform init
command to get started.
Edit the provided .tf
files to create the desired resources. We have already created the provider in main.tf
. Some hints are given in the files. There are lots of challenges here!
You will need to use the Terraform and AWS documentation together to figure out what needs to be done.
Some useful resources:
- The Terraform AWS provider
- Terraform AWS EC2 instance
- Terraform AWS Security Group
- AWS EC2 User Guide
- This article is a somewhat over-complicated version of what might be done.
Good luck! and Happy Clouding!
Don't forget to take down your infrastructure when you are finished!