I want to create a s3 presigned url for reading an object in S3 to my clients. My application is running in ECS.
I want to use the ECS Task Role to create the S3 Pre-signed URL using python sdk like this
s3_client.generate_presigned_url('get_object',
Params={'Bucket': bucket_name,
'Key': object_name},
ExpiresIn=expiration)
Question:
If a client receives a presigned url right at the boundary of task role credential rotation wont it stop working ?
This article mentions to use permanent credentials - https://aws.amazon.com/premiumsupport/knowledge-center/presigned-url-s3-bucket-expiration/
If you created a presigned URL using a temporary token, then the URL expires when the token expires, even if the URL was created with a later expiration time.
Is there a way to make sure the presigned url is valid around the credential rotation boundary. I would like to provide atleast 10 mins of validity for the presigned url.
Note: This answer also recommends using IAM user credentials - Avoid pre-signed URL expiry when IAM role key rotates
I am thinking if there is any way ECS can take advantage of the Task Role ?