0

I‘m trying to use Amazon AWS SDK for developing Eucalyptus,but II am always getting access denied for that:public class App {

public static  AmazonEC2 ec2;
public static AmazonS3 s3;
public static  AmazonIdentityManagement identityManagement;
private static String ACCESS_KEY;
private static String SECRET_KEY;
private static String IDENTITY_END_POINT;

public static void init(){
    ACCESS_KEY="myaccesskey";
        SECRET_KEY="mysecretkey";
    IDENTITY_END_POINT="http://192.168.1.101:8773/services/Euare";
    AWSCredentials myCredential = new BasicAWSCredentials(ACCESS_KEY,SECRET_KEY);
    //ec2 = new AmazonEC2Client(myCredential);
   s3 = new AmazonS3Client(myCredential);
   //ec2.setEndpoint(EC2_END_POINT);    
   s3.setEndpoint(Walrus_END_POINT);
    identityManagement=new AmazonIdentityManagementClient(myCredential);
    identityManagement.setEndpoint(IDENTITY_END_POINT);  
  }
public static void main(String[] args) {
    // TODO Auto-generated method stub

    init();

     List<Bucket> buckets = s3.listBuckets();

        System.out.println("List of all buckets in your cloud:\n");
        for (Bucket bucket : buckets) {
            System.out.println(bucket.getName()+"\n");
   }

       CreateUserRequest createUserRequest=new        CreateUserRequest().withPath("/").withUserName("summer");
CreateUserResult createUserResult=identityManagement.createUser(createUserRequest); 

} } That is the error I get:

Exception in thread "main" Status Code: 404, AWS Service: AmazonIdentityManagement, AWS Request ID: null, AWS Error Code: null, AWS Error Message: null at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:614) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:312) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:165) at com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient.invoke(AmazonIdentityManagementClient.java:3130) at com.amazonaws.services.identitymanagement.AmazonIdentityManagementClient.getUser(AmazonIdentityManagementClient.java:1201) at com.test2.Group.main(Group.java:107)

1 Answers1

0

I'm not sure what would cause a 404 when using the IAM API, the code you posted does not seem to match the posted exception.

You don't say which versions of Eucalyptus and the AWS Java SDK you are using, but with some versions it is necessary to add a / to the endpoint URL so that the AWS Java SDK calculates the signature correctly, e.g. for IAM:

"http://$EXAMLE:8773/services/Euare/"

I do not think this would cause the 404 issue however.

You can find details on using the AWS Java SDK with Eucalyptus here:

https://github.com/eucalyptus/eucalyptus/wiki/HOWTO-Use-AWS-Java-SDK-with-Eucalyptus

Unit tests for the AWS Java SDK with Eucalyptus are here:

https://github.com/eucalyptus/eutester/tree/testing/eutester4j/com/eucalyptus/tests/awssdk

This includes some coverage for IAM/STS services.

sjones4
  • 146
  • 1
  • Thank you for your reply,sorry ,forgetting to tell this,the version I used is 1.3.26 and the Eucalyptus I installed is 3.1. – user2605442 Jul 27 '13 at 02:38
  • Hi,sjones4,I modifyed the program according to your hints,but it always appear the same method again,is the version‘API questionable?can you help me ?pls – user2605442 Jul 29 '13 at 03:32