List of usage examples for com.amazonaws AmazonServiceException getMessage
@Override
public String getMessage()
From source file:EbsAttach.java
License:Open Source License
public static void main(String[] args) throws Exception { init();//from www. j a va 2s . c om try { DescribeAvailabilityZonesResult availabilityZonesResult = ec2.describeAvailabilityZones(); System.out.println("You have access to " + availabilityZonesResult.getAvailabilityZones().size() + " Availability Zones."); DescribeInstancesResult describeInstancesRequest = ec2.describeInstances(); List<Reservation> reservations = describeInstancesRequest.getReservations(); Set<Instance> instances = new HashSet<Instance>(); for (Reservation reservation : reservations) { instances.addAll(reservation.getInstances()); } System.out.println("You have " + instances.size() + " Amazon EC2 instance(s) running."); for (Instance ins : instances) { // instance id String instanceId = ins.getInstanceId(); // instance state InstanceState is = ins.getState(); System.out.println(instanceId + " " + is.getName()); } System.out.println("Attached Instance id: " + attachedInsId); /********************************************* * * #1 Create New Volume * *********************************************/ System.out.println("==========================================="); System.out.println("#1 Volume State before Creating"); System.out.println("==========================================="); DescribeVolumesResult describeVolumesResult = ec2.describeVolumes(); List<Volume> volumes = describeVolumesResult.getVolumes(); for (Volume volume : volumes) { String volumeId = volume.getVolumeId(); String volumeAvbZone = volume.getAvailabilityZone(); String volumeSize = String.valueOf(volume.getSize()); String volumeState = volume.getState(); System.out.println(volumeId + "\t" + volumeSize + "\t" + volumeAvbZone + "\t" + volumeState); } CreateVolumeRequest createVolumeRequest = new CreateVolumeRequest().withSize(4).withVolumeType("gp2") .withAvailabilityZone("us-east-1a"); CreateVolumeResult createVolumeResult = ec2.createVolume(createVolumeRequest); String createdVolumeId = createVolumeResult.getVolume().getVolumeId(); System.out.println("# Created a volume # ID: " + createdVolumeId); /********************************************* * * #2 Attach the created new Volume * *********************************************/ System.out.println("==========================================="); System.out.println("#2 Volume State after Creating"); System.out.println("==========================================="); describeVolumesResult = ec2.describeVolumes(); volumes = describeVolumesResult.getVolumes(); for (Volume volume : volumes) { String volumeId = volume.getVolumeId(); String volumeAvbZone = volume.getAvailabilityZone(); String volumeSize = String.valueOf(volume.getSize()); String volumeState = volume.getState(); System.out.println(volumeId + "\t" + volumeSize + "\t" + volumeAvbZone + "\t" + volumeState); } //wait new volume is available System.out.println("# Waiting new Volume is available"); boolean avail = false; while (true) { Thread.sleep(1000); describeVolumesResult = ec2.describeVolumes(); volumes = describeVolumesResult.getVolumes(); for (Volume volume : volumes) { if (volume.getVolumeId().equals(createdVolumeId) && volume.getState().equals("available")) { avail = true; break; } } if (avail) break; } System.out.println("New Volume is available now."); AttachVolumeRequest attachVolumeRequest = new AttachVolumeRequest().withVolumeId(createdVolumeId) .withInstanceId(attachedInsId).withDevice("/dev/sdn"); AttachVolumeResult attachVolumeResult = ec2.attachVolume(attachVolumeRequest); VolumeAttachment volumeAttachment = attachVolumeResult.getAttachment(); System.out.println( volumeAttachment.getVolumeId() + " is attached on " + volumeAttachment.getAttachTime()); /********************************************* * * #3 SSh to instance and run command * *********************************************/ System.out.println("==========================================="); System.out.println("#2 Ssh and mount disk"); System.out.println("==========================================="); Session session = null; Channel openChannel = null; String keyDir = KEYDIR; String user = "ec2-user"; String host = publicDNSName; String command = "df -h;" + "sudo mkfs -t ext3 /dev/xvdn;" + "sudo mkdir /minihw3;" + "sudo mount /dev/xvdn /minihw3;" + "df -h"; boolean isConnect = false; while (!isConnect) { JSch jsch = new JSch(); System.out.println("Waiting 5 seconds for SSH being available."); Thread.sleep(5 * 1000); try { jsch.addIdentity(keyDir); } catch (JSchException e) { System.out.println(e.getMessage()); } try { session = jsch.getSession(user, host, 22); Properties config = new Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); System.out.println("SSH Connection Established."); isConnect = true; openChannel = session.openChannel("exec"); ((ChannelExec) openChannel).setPty(true); ((ChannelExec) openChannel).setCommand(command); openChannel.setInputStream(null); ((ChannelExec) openChannel).setErrStream(System.err); int exitStatus = openChannel.getExitStatus(); System.out.println("exit-status: " + exitStatus); InputStream in = openChannel.getInputStream(); System.out.println("Exxcute remote cammand :" + command); openChannel.connect(); byte[] tmp = new byte[1024]; while (true) { while (in.available() > 0) { int i = in.read(tmp, 0, 1024); if (i < 0) break; System.out.print(new String(tmp, 0, i)); } if (openChannel.isClosed()) { if (in.available() > 0) continue; System.out.println("exit-status: " + openChannel.getExitStatus()); break; } try { Thread.sleep(1000); } catch (Exception ee) { } } } catch (JSchException | IOException e) { System.out.println(e.getMessage()); } finally { if (openChannel != null && !openChannel.isClosed()) { openChannel.disconnect(); System.out.println("Channel Disconnected"); } if (session != null && session.isConnected()) { session.disconnect(); System.out.println("Session Disconnected"); } } } } catch (AmazonServiceException ase) { System.out.println("Caught Exception: " + ase.getMessage()); System.out.println("Reponse Status Code: " + ase.getStatusCode()); System.out.println("Error Code: " + ase.getErrorCode()); System.out.println("Request ID: " + ase.getRequestId()); } }
From source file:EC2InstanceLaunch.java
License:Open Source License
public static void main(String[] args) throws Exception { System.out.println("==============================="); System.out.println("AWS EC2 Instance Launch Progam"); System.out.println("==============================="); /*// www . j a v a2 s . co m String pk = readFile("/Users/hps/.ssh/" + keyName + ".pem"); try { Thread.sleep(5000); sshToInstance("52.1.49.155", "ec2-user", pk); } catch (Exception e) { System.out.println("Error: " + e); } */ init(); /* * Amazon EC2 * * The AWS EC2 client allows you to create, delete, and administer * instances programmatically. * * In this sample, we use an EC2 client to get a list of all the * availability zones, and all instances sorted by reservation id. */ try { //describeAvailabilityZones(); describeCurrentInstances(); //describeImages(); //describeKeyPairs(); createSecurityGroup(securityGroupName, securityGroupDescription); String privateKey = createKeyPair(keyName); String createdInstanceId = createInstance(imageId, instanceType, minInstanceCount, maxInstanceCount, keyName, securityGroupName); /* Wait for 10 seconds before trying to create a tag */ Thread.sleep(10000); createTag(createdInstanceId, "Name", instanceNameTag); while (getInstanceState(createdInstanceId) != 16) { Thread.sleep(5000); System.out.println("Instance not running yet. Waiting."); } String createdInstanceIP = fetchInstancePublicIP(createdInstanceId); boolean connected = false; do { try { Thread.sleep(5000); sshToInstance(createdInstanceIP, loginUserName, privateKey); connected = true; } catch (Exception e) { //System.out.println("Error: " + e); System.out.println("Retrying"); } } while (connected == false); changeInstanceState(createdInstanceId, instanceState.stop); ec2.shutdown(); } catch (AmazonServiceException ase) { System.out.println("Caught Exception: " + ase.getMessage()); System.out.println("Reponse Status Code: " + ase.getStatusCode()); System.out.println("Error Code: " + ase.getErrorCode()); System.out.println("Request ID: " + ase.getRequestId()); } }
From source file:CloudFormation.java
License:Open Source License
public static void main(String[] args) throws Exception { /*/* w w w . j a v a 2 s. c o m*/ * This credentials provider implementation loads your AWS credentials * from a properties file at the root of your classpath. * Important: Be sure to fill in your AWS access credentials in the * AwsCredentials.properties file before you try to run this * sample. * http://aws.amazon.com/security-credentials */ AmazonCloudFormation stackbuilder = new AmazonCloudFormationClient( new ClasspathPropertiesFileCredentialsProvider()); Region usWest2 = Region.getRegion(Regions.US_EAST_1); stackbuilder.setRegion(usWest2); System.out.println("==========================================="); System.out.println("Getting Started with AWS CloudFormation"); System.out.println("===========================================\n"); String stackName = "CloudFormationSampleStack"; String logicalResourceName = "SampleNotificationTopic"; try { // Create a stack CreateStackRequest createRequest = new CreateStackRequest(); createRequest.setStackName(stackName); createRequest.setTemplateBody( convertStreamToString(CloudFormation.class.getResourceAsStream("CloudFormation.template"))); System.out.println("Creating a stack called " + createRequest.getStackName() + "."); stackbuilder.createStack(createRequest); // Wait for stack to be created // Note that you could use SNS notifications on the CreateStack call to track the progress of the stack creation System.out.println("Stack creation completed, the stack " + stackName + " completed with " + waitForCompletion(stackbuilder, stackName)); // Show all the stacks for this account along with the resources for each stack for (Stack stack : stackbuilder.describeStacks(new DescribeStacksRequest()).getStacks()) { System.out.println( "Stack : " + stack.getStackName() + " [" + stack.getStackStatus().toString() + "]"); DescribeStackResourcesRequest stackResourceRequest = new DescribeStackResourcesRequest(); stackResourceRequest.setStackName(stack.getStackName()); for (StackResource resource : stackbuilder.describeStackResources(stackResourceRequest) .getStackResources()) { System.out.format(" %1$-40s %2$-25s %3$s\n", resource.getResourceType(), resource.getLogicalResourceId(), resource.getPhysicalResourceId()); } } // Lookup a resource by its logical name DescribeStackResourcesRequest logicalNameResourceRequest = new DescribeStackResourcesRequest(); logicalNameResourceRequest.setStackName(stackName); logicalNameResourceRequest.setLogicalResourceId(logicalResourceName); System.out.format("Looking up resource name %1$s from stack %2$s\n", logicalNameResourceRequest.getLogicalResourceId(), logicalNameResourceRequest.getStackName()); for (StackResource resource : stackbuilder.describeStackResources(logicalNameResourceRequest) .getStackResources()) { System.out.format(" %1$-40s %2$-25s %3$s\n", resource.getResourceType(), resource.getLogicalResourceId(), resource.getPhysicalResourceId()); } // Delete the stack DeleteStackRequest deleteRequest = new DeleteStackRequest(); deleteRequest.setStackName(stackName); System.out.println("Deleting the stack called " + deleteRequest.getStackName() + "."); stackbuilder.deleteStack(deleteRequest); // Wait for stack to be deleted // Note that you could used SNS notifications on the original CreateStack call to track the progress of the stack deletion System.out.println("Stack creation completed, the stack " + stackName + " completed with " + waitForCompletion(stackbuilder, stackName)); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to AWS CloudFormation, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with AWS CloudFormation, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } }
From source file:AmazonS3Handler.java
License:Open Source License
public void putObject(File file, String key) throws IOException { try {/*w w w. java 2 s. com*/ // System.out.println("Creating bucket " + bucketName + "\n"); // s3.createBucket(bucketName); // System.out.println("Listing buckets"); // for (Bucket bucket : s3.listBuckets()) { // System.out.println(" - " + bucket.getName()); // } System.out.println(); System.out.println("Uploading a new object to S3 from a file\n"); s3.putObject( new PutObjectRequest(bucketName, key, file).withCannedAcl(CannedAccessControlList.PublicRead)); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to Amazon S3, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with S3, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } }
From source file:AmazonS3Handler.java
License:Open Source License
public void listObject() { try {/*from w ww . j a v a2 s . c o m*/ // System.out.println("Creating bucket " + bucketName + "\n"); // s3.createBucket(bucketName); // System.out.println("Listing buckets"); // for (Bucket bucket : s3.listBuckets()) { // System.out.println(" - " + bucket.getName()); // } // System.out.println(); // System.out.println("Uploading a new object to S3 from a file\n"); // s3.putObject(new PutObjectRequest(bucketName, key, createSampleFile()).withCannedAcl(CannedAccessControlList.PublicRead)); // System.out.println("Downloading an object"); // S3Object object = s3.getObject(new GetObjectRequest(bucketName, key)); // System.out.println("Content-Type: " + object.getObjectMetadata().getContentType()); // displayTextInputStream(object.getObjectContent()); System.out.println("Listing objects"); ObjectListing objectListing = s3 .listObjects(new ListObjectsRequest().withBucketName(bucketName).withPrefix("My")); for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) { System.out.println( " - " + objectSummary.getKey() + " " + "(size = " + objectSummary.getSize() + ")"); } System.out.println(); // System.out.println("Deleting an object\n"); // s3.deleteObject(bucketName, key); // System.out.println("Deleting bucket " + bucketName + "\n"); // s3.deleteBucket(bucketName); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to Amazon S3, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with S3, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } }
From source file:CloudFormationSample.java
License:Open Source License
public static void main(String[] args) throws Exception { /*/*from w w w. j av a2 s .c om*/ * Important: Be sure to fill in your AWS access credentials in the * AwsCredentials.properties file before you try to run this * sample. * http://aws.amazon.com/security-credentials */ AmazonCloudFormation stackbuilder = new AmazonCloudFormationClient(new PropertiesCredentials( CloudFormationSample.class.getResourceAsStream("AwsCredentials.properties"))); System.out.println("==========================================="); System.out.println("Getting Started with AWS CloudFormation"); System.out.println("===========================================\n"); String stackName = "CloudFormationSampleStack"; String logicalResourceName = "SampleNotificationTopic"; try { // Create a stack CreateStackRequest createRequest = new CreateStackRequest(); createRequest.setStackName(stackName); createRequest.setTemplateBody(convertStreamToString( CloudFormationSample.class.getResourceAsStream("CloudFormationSample.template"))); System.out.println("Creating a stack called " + createRequest.getStackName() + "."); stackbuilder.createStack(createRequest); // Wait for stack to be created // Note that you could use SNS notifications on the CreateStack call to track the progress of the stack creation System.out.println("Stack creation completed, the stack " + stackName + " completed with " + waitForCompletion(stackbuilder, stackName)); // Show all the stacks for this account along with the resources for each stack for (Stack stack : stackbuilder.describeStacks(new DescribeStacksRequest()).getStacks()) { System.out.println( "Stack : " + stack.getStackName() + " [" + stack.getStackStatus().toString() + "]"); DescribeStackResourcesRequest stackResourceRequest = new DescribeStackResourcesRequest(); stackResourceRequest.setStackName(stack.getStackName()); for (StackResource resource : stackbuilder.describeStackResources(stackResourceRequest) .getStackResources()) { System.out.format(" %1$-40s %2$-25s %3$s\n", resource.getResourceType(), resource.getLogicalResourceId(), resource.getPhysicalResourceId()); } } // Lookup a resource by its logical name DescribeStackResourcesRequest logicalNameResourceRequest = new DescribeStackResourcesRequest(); logicalNameResourceRequest.setStackName(stackName); logicalNameResourceRequest.setLogicalResourceId(logicalResourceName); System.out.format("Looking up resource name %1$s from stack %2$s\n", logicalNameResourceRequest.getLogicalResourceId(), logicalNameResourceRequest.getStackName()); for (StackResource resource : stackbuilder.describeStackResources(logicalNameResourceRequest) .getStackResources()) { System.out.format(" %1$-40s %2$-25s %3$s\n", resource.getResourceType(), resource.getLogicalResourceId(), resource.getPhysicalResourceId()); } // Delete the stack DeleteStackRequest deleteRequest = new DeleteStackRequest(); deleteRequest.setStackName(stackName); System.out.println("Deleting the stack called " + deleteRequest.getStackName() + "."); stackbuilder.deleteStack(deleteRequest); // Wait for stack to be deleted // Note that you could used SNS notifications on the original CreateStack call to track the progress of the stack deletion System.out.println("Stack creation completed, the stack " + stackName + " completed with " + waitForCompletion(stackbuilder, stackName)); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to AWS CloudFormation, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with AWS CloudFormation, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } }
From source file:Uploader.java
License:Open Source License
private static void uploadFile(AmazonS3 s3, String bucketName, String key, File file) { if (!file.exists()) { System.out.println("File does not exist: " + file.getAbsolutePath()); return;/* w ww. j a v a2 s.com*/ } /* * Upload an object to your bucket - You can easily upload a file to S3, * or upload directly an InputStream if you know the length of the data * in the stream. You can also specify your own metadata when uploading * to S3, which allows you set a variety of options like content-type * and content-encoding, plus additional metadata specific to your * applications. */ try { System.out.println(file.getAbsolutePath() + " ---> " + key + "\n"); s3.putObject(new PutObjectRequest(bucketName, key, file)); // Change permissions. Grant all users the read permission. AccessControlList acl = s3.getObjectAcl(bucketName, key); Permission permission = Permission.Read; Grantee grantee = GroupGrantee.AllUsers; acl.grantPermission(grantee, permission); s3.setObjectAcl(bucketName, key, acl); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to Amazon S3, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with S3, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } }
From source file:RandomQuery2OnDynamoDB.java
License:Open Source License
public static void main(String[] args) throws Exception { init();// www . j a va 2 s .c o m try { // Describe our new table DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName); TableDescription tableDescription = dynamoDB.describeTable(describeTableRequest).getTable(); System.out.println("Table Description: " + tableDescription); long lStartTime = new Date().getTime(); System.out.println("start time: " + lStartTime); Random rn = new Random(); Long lItem = tableDescription.getItemCount(); int iNoOfItems = lItem.intValue(); int iPointOnePercent = (int) ((int) iNoOfItems * 0.001); int iOnePercent = (int) ((int) iNoOfItems * 0.01); System.out.println("TotalItems:" + iNoOfItems + "::0.1% of data is :: " + iPointOnePercent + "::1% of data is :" + iOnePercent); // Generating 25000 random queries for 0.1 to 1 % of the data for (int i = 0; i <= 24999; i++) { String randomInt = Integer.toString(rn.nextInt(iOnePercent - iPointOnePercent) + iPointOnePercent); HashMap<String, Condition> scanFilter = new HashMap<String, Condition>(); Condition condition = new Condition().withComparisonOperator(ComparisonOperator.EQ.toString()) .withAttributeValueList(new AttributeValue().withN(randomInt)); scanFilter.put("id", condition); ScanRequest scanRequest = new ScanRequest(tableName).withScanFilter(scanFilter); ScanResult scanResult = dynamoDB.scan(scanRequest); System.out.println("Random No :" + randomInt + ":: Query no: " + (i + 1)); } // calculate time difference for update file time long lEndTime = new Date().getTime(); long difference = lEndTime - lStartTime; System.out.println("Elapsed milliseconds: " + difference); System.out.println("Elapsed seconds: " + difference * 0.001); System.out.println("Elapsed Minutes: " + (int) ((difference / (1000 * 60)) % 60)); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to AWS, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with AWS, " + "such as not being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } }
From source file:SQS.java
License:Open Source License
public String createQueue(String name) { String myQueueUrl = null;/*from www . ja va 2 s .co m*/ try { System.out.println("Creating a new SQS queue called " + name); CreateQueueRequest createQueueRequest = new CreateQueueRequest(name); myQueueUrl = sqs.createQueue(createQueueRequest).getQueueUrl(); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to Amazon SQS, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with SQS, such as not " + "being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } return myQueueUrl; }
From source file:SQS.java
License:Open Source License
public void sendMessage(String myQueueUrl, String message) { try {//from w ww. j a v a 2 s . c o m //System.out.println("Sending a message"); sqs.sendMessage(new SendMessageRequest(myQueueUrl, message)); } catch (AmazonServiceException ase) { System.out.println("Caught an AmazonServiceException, which means your request made it " + "to Amazon SQS, but was rejected with an error response for some reason."); System.out.println("Error Message: " + ase.getMessage()); System.out.println("HTTP Status Code: " + ase.getStatusCode()); System.out.println("AWS Error Code: " + ase.getErrorCode()); System.out.println("Error Type: " + ase.getErrorType()); System.out.println("Request ID: " + ase.getRequestId()); } catch (AmazonClientException ace) { System.out.println("Caught an AmazonClientException, which means the client encountered " + "a serious internal problem while trying to communicate with SQS, such as not " + "being able to access the network."); System.out.println("Error Message: " + ace.getMessage()); } }