Git Product home page Git Product logo

miniflask's Introduction

Tasks

These are the expected tasks to be delivered:

  1. Create a minimal API that contains the following two endpoints

    time - outputs current unix timestamp

    random - outputs a list of 10 random numbers (range: 0 to 5)

  2. Create a Dockerfile that includes your API and make it runnable as a container.

  3. Create a minimal Terraform config that would deploy your container on AWS ECS/Fargate, you may assume the following:

    Your docker image can be uploaded to a public docker registry You are given the values of the VPC

How to run the project:

  • The app is written in python and the dependencies are stored in the requirements.txt file

  • This is the containerized using the dockerfile in the repository

  • The container is then built using the command:

    docker build -t miniflask-api .

  • An AWS ECR public repository is used for storing the container image. To do this, an authentication token needs to be retrieved and the Docker client to the registry needs to be authenticated. This is done using AWS CLI. The CLI needs to be configured with the appropriate credentials:

    aws configure

    aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/g1s5q2a7

  • After the build completes,the image is then pushed to the repository with the image tag as 'latest':

    docker tag miniflask-api:latest public.ecr.aws/g1s5q2a7/miniflask-api:latest

    docker push public.ecr.aws/g1s5q2a7/miniflask-api:latest

  • After the image has been pushed to the repository, the image URL is then retrieved

  • The infrastructure required to deploy the container on AWS Fargate is then defined in the main.tf file. Then, the following commands are run:

    terraform init - This initializes Terraform in the project directory.

    terraform plan - This helps validate configuration before deploying.

    terraform apply - This deploys the infrastructure in the configured AWS account.

  • After the infrastructure has been deployed, the public IP address of the Fargate instance which hosts the container is gotten. the public IP address in this case is 18.215.160.156.

API Endpoints

These are the API endpoints:

Postman Documentation

The postman documentation can be found here:

Postman Documentation

miniflask's People

Contributors

ogasege avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.