AWS DevOps Pro Domain 2: Elastic Beanstalk

By | April 20, 2022

This article is the seventh in a series covering my AWS DevOps Professional certification study process, part 6 is here.

AWS Elastic Beanstalk is service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker..

Upload your code and Elastic Beanstalk automatically handles the deployment, capacity provisioning, load balancing, auto-scaling & application health monitoring.

Elastic Beanstalk Documentation

How to install the EB CLI (it’s a pip install, don’t forget to add to PATH)

Watch this re:Invent video – Manage Your Applications with AWS Elastic Beanstalk (DEV305)

Do the Getting Started section of the user guide:

Baby’s 1st EB config.yml 😀

Read the DevOps blog article Using the Elastic Beanstalk (EB) CLI to create, manage, and share environment configuration. EB saved configs are great for moving/copying an app to a new region.

Advanced environment customization with configuration files (.ebextensions) – where you can set many types of options.

  • Know EB Config option precedence:
    • Settings applied directly to env
    • Saved configs
    • .ebextensions .config files
    • Default values

If you want a resource to outlive an EB deployment (DB, RDS, etc…) you should create it outside of the EB env and reference it using env properties or ebextensions.

Know the difference between commands and container commands, particularly when they run. Note the leader_only parameter runs a container command on only 1 ec2 instance (like a DB migration command):

The application version lifecycle policy allows you to limit by # of application versions or age:

EB Managed updates gives AWS a window to allow platform patching.:

  • EB Deployment Modes:
    • All at once – requires application downtime
    • Rolling – can set bucket size (# of instances to be upgraded @ the same time)
    • Rolling w/ additional batches – (1st bucket is created new for upgrade window)
      • good for running at capacity, incurs additional cost temporarily
    • Immutable – new instances in new ASG
      • doubles capacity temporarily
      • longest deployment
      • quick rollback in case of failures
    • Traffic Splitting
      • immutable w/ forwarding a % of the traffic to the new instances for a certain amount of time
      • If instances stay healthy then fwd all traffic & shutdown old env
  • https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deploy-existing-version.html

You can swap env URLs between environments. Relies on R53 so it’s not instant or comprehensive, will take time to propagate. You can NOT do %-base cutovers this way, it’s all or nothing:

  • Worker queue decouples work between web tier and worker tier
    • used for processing long running jobs via SQS
    • cron.yaml defines cron jobs that run in the worker env

Can use docker to create beanstalk environments.

Dockerrun.aws.json is an EB specific JSON file that describes how to deploy a set of Docker containers as an EB app.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.