Flask App Deployment with AWS CI/CD

Adarsha Dinda
3 min readFeb 26, 2023

--

Objectives

  1. Build a DevOps pipeline with the help of AWS Developer tools.
  2. Deploy the Flask app in Elastic Beanstalk.

LET'S GET STARTED!

STEP 1: Create the Elastic Beanstalk Env

Go to Elastic Beanstalk and click on create an application. Give the name of your application.

In the platform, give it as Python; for now, we will go with sample application code.

Once the application and env are created successfully it will show like below

Click on the URL and check whether the app is working or not.

STEP 2: Build the CodePipeline

In the source choose where your code is present. For me, I am choosing codecommit.

In the repo, we have two files application.py and requirements.txt

application.py

requirements.txt

As we deploy this app into Elastic Beanstalk we don't require the build stage.

Create the deploy stage

Before running the pipeline, ensure you give the proper permission to the pipeline service role. I am using the codecommit and Elastic Beanstalk so I put these two policy.

Now run the pipeline

When the pipeline run is successful. Go to the Elastic Beanstalk

Now hit the URL and you will see your app is deployed

Now let's change the code and see if the pipeline is triggering automatically or not

as soon as we change the source code pipeline trigger automatically and deploy the new app

After successful deployment, if you hit the URL again it will show the updated app

Here you go. We successfully built a CI/CD pipeline for flask app deployment in Elastic Beanstalk.

Thank You.

Feel free to reach me

https://www.linkedin.com/in/adarsha-dinda/

--

--