The AWS Toolkit for Eclipse is an open source plug-in for the Eclipse Java integrated development environment (IDE) that makes it easier for developers to develop, debug, and deploy Java applications that use Amazon Web Services. Some of the features of the AWS Toolkit for Eclipse that enhance the development experience are:
AWS Explorer enables you to interact with many of the AWS services from inside the Eclipse IDE. Supported data services include Amazon Simple Storage Service (Amazon S3), Amazon SimpleDB, Amazon Simple Notification Service (Amazon SNS), and Amazon Simple Queue Service (Amazon SQS). AWS Explorer also provides access to Amazon Elastic Compute Cloud (Amazon EC2) management and deployment to AWS Elastic Beanstalk.
AWS Explorer supports multiple AWS accounts; you can easily change the resources displayed in AWS Explorer from one account to another.
Amazon Elastic Compute Cloud (Amazon EC2)
From AWS Explorer, you can view available Amazon Machine Images (AMIs), create Amazon EC2 instances from those AMIs, and then connect to those instances using a Secure Shell (SSH) client. AWS Explorer also enables supporting functionality such as the ability to create and manage key pairs and security groups.
Amazon DynamoDB is a fast, highly scalable, highly available, cost-effective, non-relational database service. The AWS Toolkit for Eclipse provides functionality for working with Amazon DynamoDB in a development context. With the Toolkit, you can create and edit attributes in Amazon DynamoDB tables and run Scan operations on tables.
AWS Elastic Beanstalk
AWS Elastic Beanstalk makes it easy for you to deploy your Java application to AWS. AWS Elastic Beanstalk provisions the AWS resources needed by your application, which frees you to focus on developing the application's functionality. This Getting Started Guide provides a walk-through of deploying the Travel Log sample using AWS Elastic Beanstalk.
AWS SDK for Java integration
The AWS Toolkit for Eclipse installs the latest version of the AWS SDK for Java. From Eclipse, you can easily modify, build, and run any of the samples included in the SDK.
This Getting Started Guide introduces you to the AWS Toolkit for Eclipse by walking you through the features of the product.
About Amazon Web Services
Amazon Web Services (AWS) is a collection of computing infrastructure services that developers can leverage when developing their applications. The services include computing, storage, database, and application synchronization (messaging and queuing). AWS uses a pay-as-you-go service model. You are charged only for the services that you—or your applications—use. Also, to make AWS more approachable as a platform for prototyping and experimentation, AWS offers a free usage tier. On this tier, services are free below a certain level of usage. For more information about AWS costs and the free tier, go to AWS Free Usage Tier.
The Enterprise Edition (EE) includes the Eclipse Web Tools Platform (WTP) and the Eclipse Data Tools Platform (DTP). The WTP is required to use Amazon Elastic Block Store features, and the DTP is required for Amazon SimpleDB features.
You can install the Toolkit for Eclipse using the Eclipse user interface.
To install the Toolkit for Eclipse from the AWS website using the Eclipse user interface
Click Help and then click Install New Software.
In the Work with box, type http://aws.amazon.com/eclipse and then press Enter.
In the list that appears, expand AWS Toolkit for Eclipse.
Add a check mark next to AWS Toolkit for Eclipse.
Support for the AWS SDK for Android requires that you also have the Google Android development tools installed. If you do not have these tools, you should uncheckAWS SDK for Android.
Click Next, and the Eclipse wizard will guide you through the remaining installation steps.
To access AWS through the Toolkit for Eclipse, you must configure the Toolkit for Eclipse with your access key ID and secret access key. In addition to allowing the Toolkit for Eclipse to access your account, your access keys are used to sign web services requests to AWS. Signing web services requests ensures that only authorized programs can make such requests. Also, by associating access keys with each web services request, AWS is able to track service usage for billing purposes.
Access keys consist of an access key ID and secret access key, which are used to sign programmatic requests that you make to AWS. If you don't have access keys, you can create them by using the AWS Management Console.
Click Download Credentials, and store the keys in a secure location.
Your secret key will no longer be available through the AWS Management Console; you will have the only copy. Keep it confidential in order to protect your account, and never email it. Do not share it outside your organization, even if an inquiry appears to come from AWS or Amazon.com. No one who legitimately represents Amazon will ever ask you for your secret key.
Adding your AWS Access Keys to the Toolkit for Eclipse
To add your access keys to the Toolkit for Eclipse
Open Eclipse's Preferences dialog box and click AWS Toolkit in the sidebar.
Type or paste your access key ID in the Access Key ID box.
Type or paste your secret access key in the Secret Access Key box.
Click Apply or OK to store your access key information.
Here's an example of a configured AWS Toolkit Preferences screen:
The Preferences dialog box enables you to add access information for more than one AWS account. Multiple accounts can be useful in that they enable developers and administrators to separate resources that are used for development from resources that are used in production.
To add another set of access keys
On the AWS Toolkit Preferences screen in Eclipse's Preferences dialog box, click Add Account.
Add your new account information to the Account Details section.
Choose a descriptive name for the Account Name, and enter your access key information in the Access Key ID and Secret Access Key boxes.
Click Apply or OK to store your access key information.
You can repeat this procedure for as many sets of AWS account information that you need.
When you have entered all of your AWS account information, select the default account by choosing one of the accounts from the Default Account drop-down. AWS Explorer displays resources associated with the default account, and when you create a new application through the Toolkit for Eclipse, the application uses the credentials for the default account.
Associate Private Keys with Your Amazon EC2 Key Pairs
The Toolkit for Eclipse can obtain your Amazon EC2 key pairs from AWS. However, you will need to associate private keys with them to use them in the Toolkit for Eclipse.
To view your Amazon EC2 key pairs in the Toolkit for Eclipse and associate private keys with them
Open Eclipse's Preferences dialog box and click the triangle next to AWS Toolkit in the sidebar to show additional categories of Toolkit for Eclipse settings.
Select Key Pairs.
Eclipse displays a scrollable list of your key pairs. If a key pair has a red X next to it, you will need to associate a private key with the key pair to use it.
Right-click the key pair and, from the context menu, select Select Private Key File...
Navigate to the private key file and select it to associate it with your key pair.
In this section, we'll use the AWS Toolkit for Eclipse to deploy a web application to AWS using the AWS Elastic Beanstalk service. The AWS Toolkit for Eclipse includes a sample application, Travel Log, that you can use to explore several of the Toolkit features. We'll use Travel Log as the web application to deploy. For more information about AWS Elastic Beanstalk, go to the AWS Elastic Beanstalk Developer Guide.
In addition to deploying AWS Elastic Beanstalk applications, the AWS Toolkit for Eclipse also enables you to debug such applications. For more information, go to the remote debugging section in the AWS Elastic Beanstalk Developer Guide.
When deploying to AWS Elastic Beanstalk from the AWS Toolkit for Eclipse, you must set your Java compiler target version to 1.6. To configure this setting in the Eclipse Toolkit, go to:
Window | Preferences | Java | Compiler
and set the Compiler compliance level to 1.6.
Deploy the Travel Log Application
To deploy the Travel Log application
On the Eclipse toolbar, click the AWS icon, and then click New AWS Java Web Project. In the New AWS Java Web Project dialog box, in the Start from area of the dialog, select Travel Log -- Sample Java Web Application and enter a name, such as myTravelLog into the Project name box. Click Finish. The Toolkit creates the project, and the project appears in Project Explorer.
If Project Explorer isn't visible in Eclipse, on the Window menu, click Show View and select Project Explorer.
Configure AWS Region and Sample Language
The AWS Java Web Project dialog box enables you to select either the US East or Asia Pacific region for the region in which your application runs.
You should configure your deployment region to be the same as the region in which the application runs (configured above).
Also, the Travel Log sample itself is available in an English or Japanese language edition. Select your preferred language from the dialog box.
In Project Explorer, right-click the myTravelLog application, and then click Run As | Run on Server. In the Run on Server dialog box, click Manually define a new server, and then select AWS Elastic Beanstalk for Tomcat 7 from the list of servers. Enter a name, such as TravelLogServer into the Server's host name box. Finally, select Always use this server when running this project. Click Next.
In the Run On Server dialog box, shown below, enter an application name, such as myTravelLogApp, and an environment name, such as myTravelLogEnv. Click Next.
The Run On Server | Advanced configuration dialog box enables you to specify additional parameters for your application deployment.
Deploy with a key pair
Select this option to use SSH to connect to the Amazon EC2 instance that hosts your application. By connecting to the Amazon EC2 instance, you can inspect the deployed application in the context of the server. AWS Elastic Beanstalk deploys your application to the ROOT subdirectory of the Tomcat webapps directory. For example:
The dialog box lists your existing key pairs. If you see an X next to a key pair, you need to specify the private key file for that key pair. Right-click the key pair and from the context menu, choose Select Private Key File, and navigate to the private key file.
The context menu also enables you to create a new key pair to use—or to delete one of the displayed key pairs.
SSL certificate Id
If your application requires an SSL certificate, use this box to specify the Amazon Resource Name (ARN) for the certificate stored in the AWS Identity and Access Management (IAM) service. For information about how to upload your certificate and obtain the certificate's ARN, see Creating and Upload Server Certificates in the IAM documentation.
Assign CNAME to new server
Use this box to specify a prefix for the domain name that AWS Elastic Beanstalk returns for the application server. If you do not specify a CNAME prefix, AWS Elastic Beanstalk will use your environment name as the prefix for the server's domain name.
Application health check URL
AWS Elastic Beanstalk will periodically check this URL to assess whether your application is active.
Email address for notifications
If you specify an email address in this text area, AWS Elastic Beanstalk will send notifications to the email address with information about the progress of the application deployment.
Use incremental deployment
With incremental deployment, the first time that you deploy your application, all application files are copied to the server. If you later update some of your application files and redeploy, only the changed files are copied, which potentially reduces the amount of time required for redeployment. Without incremental deployment, all of your application files are copied to the server with each redeployment whether the files were changed or not. Select this check box to use incremental deployment.
This dialog provides the option to select an IAM role. An IAM role 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 these temporary security credentials so you do not have to store long-term credentials on an Amazon EC2 instance or update the Amazon EC2 instance every time the credentials are rotated. In addition, AWS Elastic Beanstalk requires an IAM role to rotate logs to Amazon S3.
The IAM role list displays the roles available for your AWS Elastic Beanstalk environment. If you do not have an IAM role, you can select Use the default role. In this case, AWS Elastic Beanstalk creates a default IAM role and updates the Amazon S3 bucket policy to allow log rotation. If you choose not to use the IAM role, 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 Configuring Containers with AWS Elastic Beanstalk. For more information about using IAM roles with AWS Elastic Beanstalk, see Using IAM Roles with AWS Elastic Beanstalk.
The credentials that you use for deployment must have permission to create the default IAM role.
After you have specified any parameters appropriate to your application, click Next.
The Run On Server | Add and Remove dialog box, enables you to include additional resources with the deployment of your application. The left side of the dialog box shows resources that are present in your workspace. Use the Add, Remove, Add All, and Remove All buttons to transfer resources to and from the deployment.
Before deploying your application to AWS, the Toolkit displays a dialog box in which you can set a Version Label. The AWS Toolkit generates a unique version label based on the current time. Simply leave this default version label and click OK.
While your application is deploying, the Toolkit displays a progress message.
When the deployment completes, you will see the following image displayed in the Eclipse editor pane. This is the user interface for the Travel Log application, which is now running on an Amazon EC2 instance.
The Amazon EC2 instance that hosts the travel log application is running on the public Internet; if you copy the URL for the application, indicated in the preceding image, and paste it into a regular web browser, the Travel Log UI will appear.
Create an account for yourself. Then start a new Travel Log journal, or select Sample Journal to load in a sample journal that comes with Travel Log.
Sign in to the journal and create a new entry. You might need to scroll down to see the Save button for the new entry.
We will use your account and journal entry as we explore other features of the AWS Toolkit for Eclipse.
When you are done, simply close the browser window. Then shut down the Travel Log application in order to avoid incurring any further charges from AWS. To shut down the application, navigate to the Eclipse servers view, right-click the environment node (MyEnv in the example), and then click Stop.
If the Eclipse servers view isn't visible, click the Window menu, and then click Show View | Other.