Quick-start guide on AWS development in Java and Python.
Set up AWS development environment
First, you need to set up your AWS credentials on your Mac by creating the following files at the following specific locations:
1 2 3
In Windows, the locations of those files will be
You must fill in your AWS access credentials (Access Key ID and Secret Access Key) into the file
credentials. Optionally, you can set the default region in the
The content of the files will look like the following:
1 2 3 4 5 6 7 8
HelloAws using Java
Now, you can install AWS Toolkit for Eclipse from this link. Follow the instruction in that page to install AWS Toolkit.
After AWS Toolkit is installed, you are ready to run the first
HelloAws Java application. In Eclipse, create a AWS Console application.
- Click the new orange button on Eclipse taskbar named “AWS Toolkit for Eclipse”.
- Click the link named “Create a New AWS Java Project”.
- Fill in “Project name” as “HelloAws”. Check “AWS Console Application” from “AWS SDK for Java Samples” panel.
Note that the sample generated has the following instruction in its main class. If you haven’t do it, follow the steps above to set up your AWS access credentials.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
If your AWS credentials are ready, simply run the sample AWS console code as “Java Application”. The output will look something like this:
1 2 3 4 5 6 7
HelloAws using Python
To install AWS SDK for Python, run the following the command as instructed in that page:
In my case, I used a slightly different command to avoid permission errors on Mac OSX:
I use PyCharm/IntelliJ as IDE for Python and, apparently, there is no Python sample for it. In PyCharm, you can use the following Python script as your
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Note that it is based on the Quick start on Github. In PyCharm, running the above Python should print the following output:
Quick note on Python API vs. Java API
Note that Boto3 SDK for Python support “Resource API”. As opposed to “Service Client API” like AWS SDK for Java, Resource API provides a higher level interface to the service and it is easier to understand and simpler to use.
For example, the generated example for AWS’s Java SDK uses a Service Client API. It uses a class AmazonS3Client that controls the requests you make to the S3 service. Meanwhile, the Boto3 SDK for Python has classes representing the conceptual resources (e.g., s3.Bucket) that you interact with when using the S3 service. This is a higher level abstraction compared to a client class like AmazonS3Client making low-level calls to the service API.