Coder Social home page Coder Social logo

sample_deployment's Introduction

Source repo: https://github.com/sintaro/CDK_ECSFargate_FastAPI

This repo uses make and cdk to execute the deployment. The later command can be installed by:

npm install -g aws-cdk

Basic use:

  • Populate the variables in the .env file. A mock file is provided with the name .env_example. The assumption is you have created an IAM role that has the appropiate permissions to run the following commands.
  • Run the make deploy-infra command to deploy the model to a Fargate instance (can take around 10 minutes). This command does the following:
    • Create an ECR repository (make create-ecr)
    • Push the dockerized model (make push-container)
    • Deploy model to AWS Fargate (make create-ecs)
  • Once the deployment is complete, you will see a CDKFargateServiceServiceURL in CLI which you can use to access a public facing model.

A sample request can be sent to the created endpoint using the following command: curl -d @sample_request.json -H "Content-Type: application/json" <CDKFargateServiceServiceURL>/predict - The response should be {"prediction":4.1316}

All resources can be removed using make remove-infra

The env variables store the following information

  • ACCOUNT: Your account ID
  • AWS_REGION: The region you want to deploy to
  • AWS_ACCESS_KEY_ID: Your AWS role's access key
  • AWS_SECRET_ACCESS_KEY: Your AWS role's secret key
  • REPOSITORY_NAME: The name of the ECR repository you want to use
  • ROLE_NAME: The name of the role used for Fargate Task

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.