- Newest
- Most votes
- Most comments
You don’t need to explicitly pass credentials if you’re using a credentials provider from the environment. The AWS SDK for Java 2.x automatically uses default providers (e.g., DefaultCredentialsProvider) unless you override it. If you need to pass specific credentials, you can configure them like this:
AwsBasicCredentials awsCreds = AwsBasicCredentials.create("accessKeyId", "secretAccessKey");
S3Presigner presigner = S3Presigner.builder()
.credentialsProvider(StaticCredentialsProvider.create(awsCreds))
.build();
Pre-Signed URLs will never have that expiration. Read here. https://elasticscale.com/why-do-your-s3-presigned-urls-expire-after-12-hours-even-if-youve-set-a-longer-time/
Thanks Giovanni Lauria for the response.
Currently we are not explicitly passing credentials.
following your suggestion I should create S3Presigner like below?
S3Presigner presigner = S3Presigner.builder() .credentialsProvider(DefaultCredentialsProvider.create()) .build();
How long these credentials DefaultCredentialsProvider will be valid in Lambda? I am looking for some option for 7 days.
To have an expiration of 7 days, you will need to create an IAM user and create the URL as a user (Via Access Keys) and not a role.
Relevant content
- asked 10 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 5 months ago