Deploying app in Elastic Beanstalk using EB CLI

Reading Time: 5 minutes

Hello Readers! In this blog we will see how to deploy any application in AWS Beanstalk using the EB Command line interface. In my previous blog we have seen how to install EB CLI. So, to follow further steps for deploying an application firstly you need to install its CLI.

Do refer my blog for installation:

So, Let’s get started!

Step 1: Check its version

check version

Step 2: Make an application for Deploying

Here I am making a simple index.html file for deployment in Elastic Beanstalk.

my image

Paste your code in this file.


Step 3: Create Environment

Firstly initialize your environment and it will ask for the region where you want to deploy your application. By default it takes 3 which is Oregon. 

I will select 6 here, which is the Mumbai region.


Then it will ask for the application name. Enter this as per your wish.

app name

It will ask for selecting runtime. Let’s use the latest one.

php version

If you want to set up your ssh for your instance enter yes.

my image

If you have a key pair it will list here otherwise it will ask here the name you want to give for your key pair.

my key

Now, initialization is done!

Step 4: Create EB

Run this command and it will ask a couple of questions. Follow these steps. Enter Environment name here.

eb create

 Then enter the DNS name here. Select a load balancer type: let’s go with the default one which is application.

Now it will create. You can see the events here. It’s starting the environment.

my app

It has actually uploaded an index.html file as a zip file in s3 bucket. It’s creating aws instance. It will take some time and after that it will be finished.

my image

Lets check by listing by following command:

eb list

Step 5: Open EB in your aws account and refresh it. 

aws eb

We can see here that the environment we created is green and healthy. And you will get an url where you can see your application.

my app

If you want to configure your application use the following command:

eb config
eb config

If you want to see logs use following command:

eb logs
eb logs

We can also check the health by command line the command is:

eb health
eb health

If you want to see the health continuously i.e it will auto refresh then use the flag –refresh:

eb health
eb health

If you want to list the events use the following command:

eb events
eb events

We can also check the status of the environment through command line:

eb status

If you want to open your application url from your terminal then follow this command:

eb open
my app

Now at last if you want to terminate your environment the command is:

eb terminate
eb terminate

It will take a little time because it needs to delete a lot of resources created i.e ec2, auto scaling group, target group, load balancer, alarms, security groups etc. However it will not delete s3 bucket you have to delete it manually.

For deleting s3 bucket you have to firstly delete the bucket policy.

bucket policy
delete bucket

And after that you can delete s3 bucket:

delete image

Now you have successfully terminated everything.


In this blog we have seen how to deploy any application in AWS Beanstalk using the EB Command line interface. And we have also seen various commands used in Elasticbeanstalk. Thanks for being with me till the end. If you find this blog helpful do share with your friends.


Scala Future

Written by 

Naincy is currently a Software Intern at Knoldus. She is always ready to learn new technologies and tools. She loves painting and dancing.

Leave a Reply