User guide
• Determine when the Spot Request becomes fulfilled
• Cancel the Spot Request
• Terminate associated instances
Prerequisites
To use this tutorial you need to be signed up for Amazon Web Services (AWS). If you have not yet signed
up for AWS, go to the Amazon Web Services website, and click Create an AWS Account in the upper
right corner of the page. In addition, you also need to install the AWS Java SDK.
If you are using the Eclipse development environment, we recommend that you install the AWS Toolkit
for Eclipse. Note that the AWS Toolkit for Eclipse includes the latest version of the AWS SDK for Java.
Step 1: Setting Up Your Credentials
To begin using this code sample, you need to populate your credentials in the
AwsCredentials.properties file. Specifically, you need to populate your secret key and access key.
Copy and paste your access key ID and secret access key into the AwsCredentials.properties file.
To get your access key ID and secret access key
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. We recommend that you use IAM access keys instead of AWS root account
access keys. IAM lets you securely control access to AWS services and resources in your AWS account.
Note
To create access keys, you must have permissions to perform the required IAM actions. For
more information, see Granting IAM User Permission to Manage Password Policy and Credentials
in Using IAM.
1. Go to the IAM console.
2. From the navigation menu, click Users.
3. Select your IAM user name.
4. Click User Actions, and then click Manage Access Keys.
5. Click Create Access Key.
Your keys will look something like this:
• Access key ID example: AKIAIOSFODNN7EXAMPLE
• Secret access key example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
6. 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.
Related topics
• What Is IAM? in Using IAM
Version v1.0.0
37
AWS SDK for Java Developer Guide
Tutorial: Amazon EC2 Spot Instances