Configuring your development environment for use with AWS Elastic Beanstalk
Creating a Project Folder
Create a folder for your project. You can store the folder anywhere on your local disk as
long as you have permission to read from and write to it. Creating a folder in your user
folder is acceptable. If you plan on working on multiple applications, create your project
folders inside another folder named something like
projects to keep everything organized:
workspace/ |-- my-first-app `-- my-second-app
The contents of your project folder will vary depending on the web container or framework that your application uses.
NoteAvoid folders and paths with single-quote (') or double-quote (") characters in the folder name or any path element. Some Elastic Beanstalk commands fail when run within a folder with either character in the name.
Setting Up Source Control
Set up source control to protect yourself from accidentally deleting files or code in your project folder, and for a way to revert changes that break your project.
If you don't have a source control system, consider Git, a free and easy-to-use option, and it integrates well with the Elastic Beanstalk Command Line Interface (CLI). Visit the Git homepage to install Git.
Follow the instructions on the Git website to install and configure Git, and then run
git init in your project folder to set up a local repository:
git initInitialized empty Git repository in /home/local/username/workspace/my-first-app/.git/
As you add content to your project folder and update content, commit the changes to your Git repository:
git commit -m "
add default JSP"
Every time you commit, you create a snapshot of your project that you can restore later if anything goes wrong. For much more information on Git commands and workflows, see the Git documentation.
Configuring a Remote Repository
What if your hard drive crashes, or you want to work on your project on a different computer? To back up your source code online and access it from any computer, configure a remote repository to which you can push your commits.
AWS CodeCommit lets you create a private repository in the AWS cloud, and is free in the AWS Free Tier for up to five AWS Identity and Access Management (IAM) users in your account. For pricing details, see AWS CodeCommit Pricing.
Visit the AWS CodeCommit User Guide for instructions on getting set up.
GitHub is another popular option for storing your project code online. It lets you create a public online repository for free and also supports private repositories for a monthly charge. Sign up for GitHub at github.com.
After you've created a remote repository for your project, attach it to your local
git remote add:
git remote add origin
Installing the EB CLI
By default, the EB CLI packages everything in your project folder and uploads it to Elastic Beanstalk
as a source bundle. When you use Git and the EB CLI together, you can prevent built class
files from being committed to source with
.gitignore and prevent source
files from being deployed with
You can also configure the EB CLI to deploy a build artifact (a WAR or ZIP file) instead of the contents of your project folder.
Installing the AWS CLI
The AWS Command Line Interface (AWS CLI) is a unified client for AWS services that provides commands for all public API operations. These commands are lower level than those provided by the EB CLI, so it often takes more commands to do an operation with the AWS CLI. On the other hand, the AWS CLI allows you to work with any application or environment running in your account without setting up a repository on your local machine. Use the AWS CLI to create scripts that simplify or automate operational tasks.
For more information about supported services and to download the AWS Command Line Interface, see AWS Command Line Interface.