aws-java-sdk

How to call ResolveCustomer and GetEntitlements from aws-marketplace?

假装没事ソ 提交于 2020-03-22 09:13:50
问题 I find java sdk but I can't find example of usage. I need to call ResolveCustomer (produces a token for the product and user) and GetEntitlements (gives a list of rights for the product and the user). Has anyone used this service? 回答1: Here is full example to get information about client from aws marketplace. You should to use this librarys: <dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk-marketplacemeteringservice</artifactId> <version>1.11.192</version> </dependency>

java.lang.IllegalArgumentException: hostname cannot be null when trying to obtain AWS ECR Authentication Token

£可爱£侵袭症+ 提交于 2020-01-24 19:30:50
问题 I am trying to obtain ECR authorisation token from AWS using aws-java-sdk version 1.11.339. I have created a class to do so as below: public class ECRTokenGetter { private static final Logger LOGGER = LoggerFactory.getLogger(ECRTokenGetter.class); private static final int SINGLE_ELEMENT_INDEX = 0; public static String getEcrAuthorisationToken(Credentials creds, String awsRegion, String registryId) { LOGGER.debug("Obtaining temporary authorisation credentials from AWS ECR"); AmazonECR

Is it safe to return an ResponseEntity<InputStreamResource> that wraps S3Object.getObjectContent() in REST controller?

一曲冷凌霜 提交于 2020-01-23 17:59:08
问题 I'm developing an Spring Boot Application, that should allow users to download files indirectly from Amazon S3 via specified application REST interface. For this purpose I have an REST-Controller, that returns an InputStreamResource to the user like following: @GetMapping(path = "/download/{fileId}") public ResponseEntity<InputStreamResource> downloadFileById(@PathVariable("fileId") Integer fileId) { Optional<LocalizedFile> fileForDownload = fileService.getConcreteFileForDownload(fileId); if

How to Get Embed URLs for AWS Quicksight Dashboards using Java SDK

佐手、 提交于 2020-01-22 02:50:27
问题 I think I understand all the steps necessary to get the embed URL for an AWS Quicksight dashboard, and I have been able to get a valid URL via the AWS CLI as described in the AWS docs. However, I can't seem to get it to work via the AWS Java SDK (specifically v2). There doesn't seem to be a good example anywhere. Does anyone know of a good working example using Java (or Groovy) preferably using Spring Boot (or Grails 3 or 4)? 回答1: I finally figured it out. Here's a working Groovy/Grails

Timeout when publishing from AWS Lambda to SNS

為{幸葍}努か 提交于 2020-01-01 08:48:32
问题 I'm trying to publish some data to SNS from a Lambda function call, but it doesn't seem to be working. My function code is - public class Handler implements RequestHandler<DynamodbEvent, Void> { private static final String SNS_TOPIC_ARN = "arn:aws:sns:us-west-2:account_number:function_name"; @Override public Void handleRequest(DynamodbEvent dynamodbEvent, Context context) { LambdaLogger logger = context.getLogger(); AmazonSNSClient snsClient = new AmazonSNSClient(new

API retry logic in Amazon Web Services

萝らか妹 提交于 2020-01-01 08:28:07
问题 http://docs.aws.amazon.com/general/latest/gr/api-retries.html This document mentions that "each AWS SDK implements automatic retry logic and AWS SDK for Java automatically retries requests." What is the default mechanism for Java AWS SDK, if i don't specify any retry config? I have been using the Java AWS SDK and get a straightforward service exception if something fails on AWS service side. I have never experienced any "automatic" retry mechanism. Can someone explain what this retry

AmazonS3: Getting warning: S3AbortableInputStream:Not all bytes were read from the S3ObjectInputStream, aborting HTTP connection

允我心安 提交于 2020-01-01 08:21:11
问题 Here's the warning that I am getting: S3AbortableInputStream:Not all bytes were read from the S3ObjectInputStream, aborting HTTP connection. This is likely an error and may result in sub-optimal behavior. Request only the bytes you need via a ranged GET or drain the input stream after use. I tried using try with resources but S3ObjectInputStream doesn't seem to close via this method. try (S3Object s3object = s3Client.getObject(new GetObjectRequest(bucket, key)); S3ObjectInputStream

AWS Java SDK Version For Creating a Lambda

孤人 提交于 2019-12-31 00:58:15
问题 I'm trying to develop a AWS Java lambda function by following the guidance described here. In it it describes the implementation of the RequestHandler interface and also references the aws-lambda-java-core library. However I am trying to use the latest SDK as recommended here but this is completely different and the RequestHandler interface doesn't appear to exist anymore. It's not clear to me what the name and version of the java libraries I need. Is there any guidance on all the different

Stopping EC2 instance in an ELB using java sdk

亡梦爱人 提交于 2019-12-25 03:15:57
问题 I have a set of instances running within an ELB and an API to stop/ start any of those instance developed using java SDKs. However the instances are getting terminated as soon as it goes to stopped state, which i don't want to happen. Is this a known behavior and is there a way to stop this from happening and to keep these instances in the stopped state? 回答1: Instances are terminated if they are associated with an auto scaling group Check this Instance Termination in autoscaling groups for

S3Stream is getting closed before processing the entire payload

别说谁变了你拦得住时间么 提交于 2019-12-25 01:54:12
问题 I am processing the bulk json payload from s3. code as follows: import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.amazonaws.services.s3.model.S3Object; import static com.fasterxml.jackson.core.JsonToken; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; public boolean sync(Job job) throws IOException //validating the json