So far in this book, we have focused on the use of Elastic Container Service (ECS) and its variant, AWS Fargate, to manage and deploy Docker applications. The remainder of this book will focus on alternative technologies that you can use to run your Docker applications in AWS, and the first of these that we will cover is Elastic Beanstalk.
Elastic Beanstalk falls into a category that is commonly referred to by the industry as Platform as a service (PaaS), and is a service that is intended to provide a managed runtime environment for your applications that lets you focus on developing, deploying, and operating your application, rather than worry about the surrounding infrastructure. To reinforce this paradigm, Elastic Beanstalk is focused around supporting various popular programming languages and today includes support for Node.js, PHP, Python, Ruby, Java, .NET, and Go applications. When you create an Elastic Beanstalk application, you specify the target programming language, and Elastic Beanstalk will deploy an environment that supports your programming language and associated runtimes and application frameworks. Elastic Beanstalk will also deploy supporting infrastructure such as load balancers and databases, and more importantly will configure your environment so that you have easy access to logs, monitoring information, and alerts, ensuring you can not only deploy your applications, but also monitor them and ensure, they are up and running in an optimal state.
In addition to the aforementioned programming languages, Elastic Beanstalk also supports Docker environments, meaning it can support any application that can be run in a Docker container, regardless of programming language or application runtime, and in this chapter you will learn how you can use Elastic Beanstalk to manage and deploy your Docker applications. You will learn how to create an Elastic Beanstalk application using the AWS console and create an environment, which includes an application load balancer and RDS database instance that's required for our application. You will encounter some issues with the initial setup, and learn how to diagnose and troubleshoot these issues using the AWS console and Elastic Beanstalk command-line tools.
To resolve these issues, you will configure a feature known as ebextensions, which is an advanced configuration feature of Elastic Beanstalk that can be used to apply a number of custom configuration scenarios to your application. You will leverage ebextensions to address permissions issues with Docker volumes, transform default environment variables generated by Elastic Beanstalk to the format expected by your application, and finally ensure single shot deployment tasks such as executing database migrations are only run on a single instance for each application deployment.
The following topics will be covered in this chapter:
- Introduction to Elastic Beanstalk
- Creating Elastic Beanstalk applications using the AWS console
- Managing Elastic Beanstalk applications using the Elastic Beanstalk CLI
- Customizing Elastic Beanstalk applications
- Deploying and testing Elastic Beanstalk applications