AmazonEC2 exception case need help

0 votes

Why do I get this whenever I am trying to get the network interfaces? null (Service: AmazonEC2; Status Code: 400; Error Code: 400 Bad Request; Request ID: null)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(
at com.amazonaws.http.AmazonHttpClient.execute(

I am using below code for example. This is the only code for testing.

AmazonEC2 amazonEC2 = getEC2Client(); try { DescribeInstancesResult result = amazonEC2.describeInstances(); for(Reservation reservation : result.getReservations()){ System.out.println(reservation.getInstances()); } }catch (AmazonEC2Exception e){ e.printStackTrace(); } protected static AmazonEC2 getEC2Client() { conf = new ClientConfiguration(); conf.setConnectionTimeout(5000); conf.setSocketTimeout(20000); conf.setMaxErrorRetry(2); AmazonEC2 client; if (access_id == null && access_key == null) { client = AmazonEC2ClientBuilder.standard().withClientConfiguration(conf).withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("", "us-east-1")) .withCredentials(new InstanceProfileCredentialsProvider(false)) .build(); } else { client = AmazonEC2ClientBuilder.standard().withClientConfiguration(conf).withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("","us-east-1")) .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(access_id, access_key))) .build(); } return client; }

I can access the list of Users in the same class but not the stuff related to Describe* 
 can anyone please help me in this case ?

Apr 17, 2018 in AWS by Cloud gunner
• 4,650 points

1 answer to this question.

0 votes

Try to use .withRegion(..) and do not use .withEndpointConfiguration(...)

Perhaps you use incorrect endpoint definition.

answered Aug 13, 2018 by bug_seeker
• 15,550 points

Related Questions In AWS

0 votes
1 answer
+1 vote
10 answers
+1 vote
1 answer

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

refer this link You can't install the certificates ...READ MORE

answered Jul 19, 2018 in AWS by Priyaj
• 58,140 points
0 votes
1 answer

Do i need Amazon Route53 to bind domain to EC2?

You need to assign an Elastic IP ...READ MORE

answered Aug 23, 2018 in AWS by Archana
• 4,150 points
0 votes
1 answer

Task Canceled Exception while invoking AWS Lambda

I'm guessing either the TaskCanceledException instance is ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 58,140 points
+1 vote
1 answer

How to issue a parsing json from case class using jackson?

Do you use jackson-module-scala or any other Scala-aware configuration ...READ MORE

answered Sep 26, 2018 in AWS by Priyaj
• 58,140 points
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,140 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points