Beanstalk Cheat Sheet

  • PaaS, or managed application environments

Deployment Policies

  • 5 policies 🎓
    • All at once = deploy to all instances at once, loses all capacity during deployment
    • Rolling = take a batch of instances out of service, deploy and put them back, repeat until all instances are updated, loses a batch of capacity during deployment
    • Rolling with additional batch = create an extra batch and do rolling deployments, do not lose capacity during deployment
    • Immutable = deploy to a fresh group of instances, do not lose capacity during deployment, traffic is shifted after deployment
    • Traffic splitting = deploy to a fresh group of instances, shift a percentage of traffic to new instances, when everything goes well, shift all traffic
      • aka. Canary testing
  • vs. Configuration changes
    • When you change resource configuration (instance type, key pair, environment variables etc.), new instances needs to be provisioned
    • Otherwise configurations may get applied directly to instances
    • 2 options
      • Rolling = similar to “Rolling with additional batch” deployment, but this time it’s about instances not the application on it
      • Immutable = this is the mechanism used by “Immutable” deployment
        • Cannot change resource and deploy application in one go, must be done separately
        • Use blue/green instead

Blue/Green Deployment

  • Create an entirely new environment with new application, then use CNAME to switch to new environment instantly
    • This is the definition of blue/green deployment in the context of Beanstalk, otherwise an Immutable deployment could be called Blue/Green as well

Saved Configurations

  • Environment configurations can be saved to S3
  • Use cases 🎓
    • Create new environment
    • Replicate an environment with adjustments, e.g. prod environment is the same as dev but with different instance size
    • Apply to running environment
  • Note: with Beanstalk you DO NOT
    • Directly manipulate the underlying CloudFormation template / stack
    • Directly manipulate Beanstalk managed resources

.ebextensions

  • A folder within your source code root folder to set and change configurations when you deploy your code
  • Configuration files in .ebextensions folder use *.config filenames and in YAML or JSON format
  • Can include
    • Commands to run during instance boot, similar to running user scripts
  • Linux and Windows server have different options