Script to start an Amazon Elastic Beanstalk application from command line
Starting an Amazon Elastic Beanstalk application from the AWS console is easy and reasonably fast. The main problem is that you can’t currently provide additional settings such as the instance type (e.g.
t1.micro), a SSH key or application parameters.
After starting the application environment, it must be stopped again, before the configuration can be changed. This costs an instance hour but, more importantly, this procedure takes quite a while, as AWS must reconfigure the load balancer, auto-scaling group, start your instance(s), etc.
I created a script, which can be used to start an application environment from the command line. The most important parameters can be set as command line parameters:
Starting an application
myapp with environment
myenv on a
m1.small instance with SSH key
mysshkey is as simple as:
eb-create-app.sh -a myapp -k mysshkey -e myenv -t m1.small -f 'mybucket/myapp.war'
- the application WAR file must already be uploaded to S3. The format of the file name (parameter
bucketname/key. If the file name is not specified, Beanstalk will deploy the sample application
- the environment can only be created, if the
CNAME(which is identical to the environment name, if not specified with
-c) is not already used. The
CNAMEis used as sub-domain under
elasticbeanstalk.com. When creating an environment with name (and CNAME)
myenv, the full DNS name would be myenv.elasticbeanstalk.com
- starting an environment will fail, if the SSH key name does not exist. You can look up the name of your SSH key in the EC2 console
Elastic Beanstalk Parameters
Elastic Beanstalk provides many parameters, which can be set. A full list can be obtained using
elastic-beanstalk-describe-configuration-settings, also from the command line tools (NOTE: fix required!).
Starting an application environment is easy and the command line tools help a lot. There are still some bugs, but I’m sure, the Beanstalk team will address them soon. The forum is a great resource.
My next post will be about creating a customized Beanstalk AMI. Stay tuned!