Sample repo template for creating ElasticBeanstalk app
This repo contains templates for building/deploying an EB application.
Only need to do it once
$ pip install awsebcli six
# Change to the source directory
$ cd app
$ eb init --profile ${AWS_PROFILE}
# - Region: sydney
# - Application name: SampleService
# - Platform version: Docker 17.03.1-ce (or latest)
# - ssh key: my-sampleservice-key
$ eb create SampleService-dev --cname sampleservice-dev --vpc
# See also http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-getting-started.html
# - Environment Name: SampleService-dev
# - DNS CNAME prefix: sampleservice-dev
# - Load balancer type: application
See also EB CLI Reference: eb config.
To build and test the Docker image for the application.
You need to install docker if you want to run it locally:
$ cd deploy
$ ./eb_deployment_helper.sh --build-image
To also deploy the application and update settings/configurations within EC2 instances:
$ cd deploy
$ ./eb_deployment_helper.sh --build-image \
[--push-image] \
--eb-deploy --eb-env [EB_ENV_NAME]
To update Elastic Beanstalk Environment for instant change in After Creation state:
Make sure you have the latest EB environment first.
Because aws:elasticbeanstalk:managedactions:platformupdate is enabled, the Docker/platform version in
Platform:PlatformArn can be different from the last saved *.cfg.yml file.
$ cd app/
$ eb use [EB_ENV_NAME] # Ensure all operations take effect to a specific EB environment
$ eb config delete [EB_ENV_NAME] # Delete the named saved configuration (in EB S3)
$ eb config save [EB_ENV_NAME] # Save the environment configuration settings for the current running
# environment to .elasticbeanstalk/saved_configs/ with the filename
# [EB_ENV_NAME].cfg.yml.
Edit app/.elasticbeanstalk/saved_configs/[EB_ENV_NAME].cfg.yml.
Create Pull Request for review.
Apply the change
$ cd deploy
$ ./eb_deployment_helper.sh --eb-config-update --eb-env [EB_ENV_NAME]
eb ssh [EB_ENV_NAME] --profile [profile-name]
eb logs --all
/opt/elasticbeanstalk/hooks/appdeploy/opt/elasticbeanstalk/hooks/appdeploy/pre/
00clean_dir.sh - Clean directory where source will be downloaded, removes docker containers and images.01unzip.sh - Download source from S3 and unzip it.02loopback-check.sh - Verify you don’t have docker loopback setting set.03build.sh - Build your docker image from your Dockerfile or Dockerrun.aws.json./opt/elasticbeanstalk/hooks/appdeploy/enact/
00run.sh - Execute docker run against the image that was generated in the pre stage based on environment
variables and settings in your Dockerrun.aws.json.01flip.sh - Convert from aws-staging to current-app etc./opt/elasticbeanstalk/hooks/appdeploy/post/See also
See also
You can use a certificate stored in IAM with Elastic Load Balancing load balancers and CloudFront distributions.
Otherwise create yours:
iam:UploadServerCertificateiam:ListServerCertificatesCALL aws iam upload-server-certificate ^
--server-certificate-name elastic-beanstalk-x509 ^
--certificate-body file://example.com.crt ^
--private-key file://example.com.key ^
--certificate-chain file://intermediate.crt ^
--profile k-eb-deploy
:: Show all certificates
CALL aws iam list-server-certificates --profile k-eb-deploy
For details see Update a certificate to IAM.
If no .ebignore is present, but a .gitignore is, the EB CLI will ignore files specified in the .gitignore. If an .ebignore file is present, the EB CLI will not read the .gitignore.
For details see EB .ebignore.