amazon-web-servicesamazon-ec2ec2-amiec2-api-tools

AWS Instance creation error


i am getting the below error while creating an instance in AWS through eclipse.

exception in thread "main" com.amazonaws.AmazonClientException: Unable to load AWS credentials from any provider in the chain
    at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:117)
    at com.amazonaws.services.opsworks.AWSOpsWorksClient.invoke(AWSOpsWorksClient.java:3574)
    at com.amazonaws.services.opsworks.AWSOpsWorksClient.createInstance(AWSOpsWorksClient.java:2098)
    at AwsConsoleApp.main(AwsConsoleApp.java:154)

my code reads:

String az=new String("ec2.us-east-1.amazonaws.com");
cir.setAvailabilityZone(az);
String ami_id=new String("ami-864d84ee");
cir.setAmiId(ami_id);
CreateInstanceResult cr=awoc.createInstance(cir);

please hep me on this.


Solution

  • Looks like you need to provide your credentials to access your AWS account:

    http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/credentials.html