Server Deployment, Containerization, and Testing.
IP address of the running application: aa5938abd5bae11eabad60a1f54c0e64-1526288372.us-west-2.elb.amazonaws.com Click here
In this project you will containerize and deploy a Flask API to a Kubernetes cluster using Docker, AWS EKS, CodePipeline, and CodeBuild.
The Flask app that will be used for this project consists of a simple API with three endpoints:
GET '/'
: This is a simple health check, which returns the response 'Healthy'.POST '/auth'
: This takes a email and password as json arguments and returns a JWT based on a custom secret.GET '/contents'
: This requires a valid JWT, and returns the un-encrpyted contents of that token.
The app relies on a secret set as the environment variable JWT_SECRET
to produce a JWT. The built-in Flask server is adequate for local development, but not production, so you will be using the production-ready Gunicorn server when deploying the app.
export TOKEN=`curl -d '{"email":"janujaishree94@gmail.com","password":"123123"}' -H "Content-Type: application/json" -X POST aa5938abd5bae11eabad60a1f54c0e64-1526288372.us-west-2.elb.amazonaws.com/auth | jq -r '.token'`
curl --request GET 'aa5938abd5bae11eabad60a1f54c0e64-1526288372.us-west-2.elb.amazonaws.com/contents' -H "Authorization: Bearer ${TOKEN}" | jq
Return output as expected:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 71 100 71 0 0 159 0 --:--:-- --:--:-- --:--:-- 158
{
"email": "janujaishree94@gmail.com",
"exp": 1584273241,
"nbf": 1583063641
}
- Fork this project to your Github account.
- Locally clone your forked version to begin working on the project.
- Docker Engine
- AWS Account
- You can create an AWS account by signing up here.
Completing the project involves several steps:
- Write a Dockerfile for a simple Flask API
- Build and test the container locally
- Create an EKS cluster
- Store a secret using AWS Parameter Store
- Create a CodePipeline pipeline triggered by github checkins
- Create a CodeBuild stage which will build, test, and deploy
For more detail about each of these steps, see the project lesson here.