Skip to content

achmadfatoni/aws-s3-presigned-url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AWS S3 Presign URL

AWS S3 (Simple Storage Service) can generate a pre-signed URL for objects stored in S3 buckets, which allows temporary access to the object without requiring AWS credentials.

Here are steps to generate a pre-signed URL:

  1. Ensure you have valid AWS credentials with permission to access the S3 object you want to generate a pre-signed URL for.
  2. Determine the S3 bucket and object key for the object you want to generate a pre-signed URL for.
  3. Decide on a duration (in seconds) for which the pre-signed URL will be valid.

Generate pre-signed URL using aws cli

aws s3 presign s3://bucket-name/file-path --expires-in {duration-in-seconds}

Generate pre-signed URL using Python

See presign.py

Example pre-signed URL

https://my-s3-bucket.s3.amazonaws.com/my-object?Expires=1620643740&Signature=example_signature&AWSAccessKeyId=example_access_key

this URL grants temporary access to an S3 object stored in the my-s3-bucket bucket. The object's key is my-object. The URL includes query string parameters that specify additional information:

  • Expires=1620643740 specifies the Unix timestamp (in seconds) when the pre-signed URL will expire. In this example, the URL will expire on May 10, 2021 at 8:35:40 PM UTC.
  • Signature=example_signature is the signature generated by AWS to authenticate the request. The signature is based on the secret access key associated with the access key ID specified in the URL.
  • AWSAccessKeyId=example_access_key specifies the AWS access key ID used to sign the request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages