Skip to main content
  1. Posts/

AWS CDK Elastic Beanstalk Examples

AWS CDK enables you to codify infrastructure within a variety of programming languages to build reusable constructs that generate large amounts of AWS CloudFormation. The ratio of effort input vs value output is astounding.

In this repository is a public learning effort gradually ramping up toward full SDLC of an application backed by AWS ElasticBeanstalk.

Examples #

01 - Creating an Application #

AWS Elastic Beanstalk has a concept of an Application that houses multiple environments. Here, we create that Application.

02 - Creating an Environment #

Next, let’s create an AWS ElasticBeanstalk Application again, then create a single Environment running Java 8.

03 - Environment Using Spot Instances #

Let’s be cost-conscious and create our Environments utilizing AWS EC2 Spot Instances through the native support via AWS ElasticBeanstalk!

04 - Multiple Environments #

We have our Application and Environment in place, but what’s it look like to create multiple Environments? Do we have to copy/paste code, or can we make it reusable?

🚨 Spoiler alert: we can make a parameterized stack and instantiate multiple! 🚨

05 - Pipeline to Single Environment #

Up to here, we have an Application with multiple Environments, but we want to be able to ship new changes to these environments. So, let’s take a step back to a single Environment, add in AWS CodeBuild and AWS CodePipeline, and deploy a built application to the Environment!

Code #

All examples available at: github.com/bluegrass-dev/aws-cdk-elastic-beanstalk-examples