Expert AWS Development
上QQ阅读APP看书,第一时间看更新

AWS SDK for Java using Eclipse IDE

I am assuming that you have already installed Eclipse 4.4 (Luna) or a higher version on your machine as the AWS toolkit supports that.

There are two ways to install an AWS toolkit in your IDE:

  • Click on Help | Install New Software… and install
  • Click on Help | Eclipse Marketplace, search for AWS, and install

We will install using the first method. Now please perform the following steps and refer to the following screenshot:

  1. Once you click on Install New Software, it will open the Available Software dialog box.
  2. In this dialog box, you have to click on Add to add the AWS toolkit.
  3.  It will open the Add Repository dialog box.
  4.  In this dialog box, add the Name and Location as https://aws.amazon.com/eclipse.
  5.  Click on OK.
  1. On the next page, you will see all available AWS tools. You can select AWS Core Management Tools and other tools as per your project requirements:
  1. A preview page will display to confirm the installation details. Click on Next and you will see the Review License page, where you click Accept and Finish to complete the AWS installation:
  1. After successful installation, your IDE will restart. After restarting, you will see the AWS toolkit icon in the toolbar:
  1. Now let's create a sample AWS Java project. When you click New AWS Java Project…., you will see the following screen. You need to add the necessary details for the project. Here I have used S3Demo as my Project name, com.packt as my Group ID, and examples as my Artifact ID. I have selected Amazon S3 Sample from the Java samples:
  1. If you want to add new AWS accounts, click on the Configure AWS accounts… link. You can add the credentials in two ways:
    • Add Profile Name, Access Key ID, and Secret Access Key under the Profile Details screen.
    • You can specify your credentials file path or browse to your credentials file. Once you have added that, you can select Apply and Close:
  1. Now it will generate the projects and create the necessary files. You can see the following screen with generated files. It will generate a S3Sample.java file. You can right-click on this file and select Run As | Java Application. It will create the bucket, list the bucket, upload a new object to S3, download an object, list an object, delete an object, and delete the bucket:

So far, you have learned how to add the AWS Java toolkit into your project using Maven, Gradle, and Eclipse IDE. Now we will see how to add the AWS SDK for Node.js into your project.