|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
The following diagram illustrates a typical software development life cycle that includes deploying your application to AWS Elastic Beanstalk.
After developing and testing your application locally, you will typically deploy your application to AWS Elastic Beanstalk. After deployment, your application will be live at a URL such as http://myexampleapp-wpams3yrvj.elasticbeanstalk.com. Because your application is live, you should consider setting up multiple environments, such as a testing environment and a production environment. You can use the AWS Toolkit for Eclipse if you want to set up different AWS accounts for testing, staging, and production. For information about managing multiple accounts, see Managing Multiple AWS Accounts.
Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service. You can point your domain name to the Amazon Route 53 CNAME <yourappname>.elasticbeanstalk.com. Contact your DNS provider to set this up. For information about how to map your root domain to your Elastic Load Balancer, see Using AWS Elastic Beanstalk with Amazon Route 53 to Map Your Domain to Your Load Balancer.
After you remotely test and debug your AWS Elastic Beanstalk application, you can make any updates and then redeploy to AWS Elastic Beanstalk. After you are satisfied with all of your changes, you can upload the latest version to your production environment. The following sections explain each stage of the software development life cycle.
The AWS Toolkit provides an AWS Java web project template for use in Eclipse. The
template creates a WTP dynamic web project that includes the AWS SDK for Java in the
project's classpath. Your AWS
credentials and a simple
index.jsp file are provided to help you
get started. The
following instructions assume you have installed both Eclipse and the AWS Toolkit
plug-in. For more information, see Setting Up
the AWS Toolkit for Eclipse.
AWS Elastic Beanstalk supports Java 1.5 and 1.6.
To create a new AWS Java web project in Eclipse
In Eclipse, make sure the toolbar is visible. On the toolbar, click the arrow next to the AWS icon and select New AWS Java Web Project.
Selectto open the New AWS Java Web Project wizard.
For Project name, enter the name of your AWS Java Web Project.
Select the AWS account you want to use to deploy your application. If you haven't already configured an account, click Configure AWS accounts to add a new account. For instructions on how to add a new account, go to Managing Multiple AWS Accounts.
Select the application you want to start from.
A new AWS Java web project is created inside your Eclipse workspace. To help you get
started developing your project, a basic
index.jsp file is included
inside your WebContent folder. Your AWS security credentials are included in the
AwsCredentials.properties file inside your
You can test and debug your application before you deploy it to AWS Elastic Beanstalk using the built-in WTP tools.
To test and debug your application locally
If Eclipse isn't displaying Project Explorer view, click the Window menu, Show View, and finally Project Explorer.
Right-click your Java web project, select Run As, and click Run On Server.
In the Run On Server wizard, Manually define a new server.
Expand the Apache item in the Select the server type explorer and select Tomcat v6.0 Server or Tomcat v7.0 Server.
You might be prompted to install Apache. If you are using Microsoft Windows, you can click the Download and Install button to install the software. After you have installed the software, click Finish.
You will now see your application appear on the localhost.
After you have tested your application, you can now deploy to AWS Elastic Beanstalk.
The Elastic Beanstalk server is an Eclipse WTP server with added functionality for restarting, publishing, and terminating your Java web application. The Elastic Beanstalk server in Eclipse represents an AWS Elastic Beanstalk environment. An environment is a running instance of an application on the AWS platform.
Before deploying your application, you must define your server and configure your application.
To define your Java web application server
In Eclipse, right-click your Java web project in the Project Explorer view. Select Amazon Web Services, and click Deploy to AWS Elastic Beanstalk.
In the Run On Server wizard, select Manually define a new server.
Expand the Amazon Web Services item in the Server Type explorer and select AWS Elastic Beanstalk for Tomcat 6 or AWS Elastic Beanstalk for Tomcat 7.
If necessary, enter the server's host name and server name in the provided fields. Click Next. The Configure Application and Environment options appear.
You have defined your AWS Java web application server. You must still configure your AWS Java web application before deployment.
Each application has a configuration and a version. A specific application instance is called an environment. An environment can have only one version at a time, but you can have multiple simultaneous environments running the same or different versions. AWS resources created for an environment can include one Elastic Load Balancing load balancer, an Auto Scaling group, and one or more Amazon EC2 instances.
To configure your Amazon web application
In the Configure Application and Environment view of the Run On Server wizard, select an Amazon region for Region.
Enter an application name and, if desired, provide an application description.
Enter an environment name and, if desired, provide an environment description. The environment name must be unique within your AWS Account.
Select the Type of environment that you want.
You can select either Load Balanced or a Single Instance environment. For more information, see Environment Types.
For single-instance environments, load balancing, autoscaling, and the health check URL settings don't apply.
Click Deploy with a key pair.
Right-click anywhere inside the key pair list menu and select New Key Pair.
For Key Pair Name, enter a key pair name. For Private Key Directory, enter a private key directory or click Browse and select a directory. Click OK and select the newly created key pair in the key pair list menu.
Select Use incremental deployment to deploy only the changed files. An incremental deployment is faster because you are updating only the files that changed instead of all the files.
Select an instance profile.
If you are using a nonlegacy container, you have the option to select an instance profile. If you are using a legacy container, this option does not appear in the dialog box. An instance profile provides applications and services access to AWS resources using temporary security credentials. For example, if your application requires access to DynamoDB, it must use AWS security credentials to make an API request. The application can use the temporary security credentials so you do not have to store long-term credentials on an EC2 instance or update the EC2 instance every time the credentials are rotated. In addition, Elastic Beanstalk requires an instance profile to rotate logs to Amazon S3. The Instance Profile list displays the profiles available for your AWS Elastic Beanstalk environment. If you do not have an instance profile, you can select Create a default instance profile. AWS Elastic Beanstalk creates a default instance profile and updates the Amazon S3 bucket policy to allow log rotation. If you choose to not use the default instance profile, you need to grant permissions for AWS Elastic Beanstalk to rotate logs. For instructions, see Using a Custom Instance Profile. For more information about log rotation, see AWS Elastic Beanstalk Environment Configurations. For more information about using instance profiles with AWS Elastic Beanstalk, see Using IAM Roles with AWS Elastic Beanstalk.
Users must have permission to create a default profile. For more information, see Granting IAM Users Permissions to Create and Pass IAM Roles.
After you finish the
you will be prompted to enter a new version label for your application
version, and then a new server will appear in the Server view.
Your Java web project will be exported as a
file, uploaded to Amazon S3, and registered as a new application version with
Elastic Beanstalk. The Elastic Beanstalk deployment feature will monitor your
environment until it becomes available with the newly deployed code, and it will
open your application in a web browser when it's ready.
To investigate any issues, you can view logs. For information about viewing logs, see Working with Logs. If you need to test remotely, you can connect to your Amazon EC2 instances. For instructions on how to connect to your instance, see Listing and Connecting to Server Instances.
Now that you have tested your application, it is easy to edit and redeploy it, and to see the results in moments. Typically, when you redeploy your application, all of the files will get updated. However, if you choose to do an incremental deployment, the toolkit will update the modified files, making your deployment faster.
To choose to use incremental deployments
If Eclipse isn't displaying AWS Explorer view, in the menu click Window > Show View > AWS Explorer.In the AWS Explorer pane, expand the AWS Elastic Beanstalk node and your application node.
Double-click your AWS Elastic Beanstalk environment.
In the Overview tab, expand the AWS Elastic Beanstalk Deployment tab, and then select Use Incremental Deployments.
To edit and redeploy your Java web application
In Eclipse, locate and
index.jsp file in the Project
Explorer or Package Explorer view.
the source contained in the file.
Right-click your Java web project in the Project Explorer or Package Explorer view.
Select Amazon Web Services, and click Deploy to AWS Elastic Beanstalk.
In the Run On Server wizard, select Choose an existing server, and click Finish.
If you launched a new environment using the AWS Management Console, you will need to import your existing environments into Eclipse. For more information, see Importing Existing Environments into Eclipse.
When the application has deployed successfully,
index.jsp is displayed
in Eclipse and shows any edits you have made.
When you are satisfied with all of the changes you want to make to your application, you can deploy your application to your production environment. To deploy the existing version of the application to production with zero downtime, follow the steps at Deploying Versions with Zero Downtime. You can also create a new environment inside Eclipse, but you will need to specify a new version for your application. For instructions on deploying to AWS Elastic Beanstalk inside Eclipse, see Deploy to AWS Elastic Beanstalk.