Elastic beanstalk
- Allow deploy app from docker container
- Handles
- Deployment
- Capacity provisioning
- Load balancing
- Auto scaling
- Health monitoring
- We can take full control of the underlying resources
- An automation example with
Beanstalk - Create
LAMPstack - Download latest PHP from
S3 - Set up
ELB - Store the
Application FilestoS3 - Store the
Server Logs FilestoS3orCloudwatch, optionally - Can use the worker process environment for the long running tasks and also fo decoupling the application
- Environment files
Dockerrun.aws.jsonused to to configure multi-container docker environmentsenv.yamlused to configure environment name, solution stack and environment linkscron.yamlused to define scheduled worker tasksInstance ProfileUsed to ensure the interaction with other aws servicesEnvironment ManifestUsed to define environment, stack name, point to launch config etc.- If beanstalk does not support the environment by default, can be make use of custom environment named packer
- For dockerized app, beanstalk has more preferences over ecs when there are requirements of managing
- To add a resource as a part of Elastic Beanstalk, we can add them in
.ebextensions. For example, to allow usage ofElastic Cache, we can add the config in.ebextentions. In this case, any time we deploy a new template, a new version of elastic cache will be created and delete the old ones. - Easiest way to enable
httpsfor the Elastic Beanstalk is integrating theLoad Balanceby updating the config file - With lifecycle policy, can be determine, how may old build of elastic beanstalk will kept and also how many days
Platform Update
Elastic beanstalk regularly update their platform time to time with new versions. Once our application is running in a legacy version and want to update the underlying version, there are two methods,
Update Environments Platform Versions: Recommended approach to go to latest version.Perform a Blue/Green Deployment: Recommended approach to go to a specific version.
Best Practices
- To preserve database on environment deletion
- In production, create database separately
- In dev/test, use database retention as
Create Snapshot