Testing out AWS Elastic Beanstalk

Elastic Beanstalk is the PaaS component of AWS, it will automatically handle the details of capacity provisioning, load balancing, scaling, and application health monitoring.

We will go to AWS Elastic Beanstalk Documentation, look for “Install the EB CLI” to install the eb cli on the cloud9 environment. At the time of writing it was just cloning the Github repo, running the python installation script and adding ‘eb’ to path:

To test it we will create a simple flask page, but let’s prepare the environment first:

Now to add the following simple flask app to app.py

Then just run the app with

Then we can just test the app using curl in a new terminal, like this:

Now we can deploy the app, we just need to make sure AWS EB ignores the virtual environment we created earlier:

Now we can initiate the deployment:

AWS EB will now create all needed components we would otherwise needed to create manually:

  • EC2 instances (VPS)
  • Security group (firewall rules to the VPS)
  • S3 bucket (storage)
  • CloudWatch alarms (performance monitoring for up or down scaling)
  • CloudFormation stack (all the resources required to run a web application, such as a web server, a database, and networking rules)
  • Domain name

Leave a comment

Your email address will not be published. Required fields are marked *