Generate S3 Pre-Signed URL via CLI
Today lets create a S3 Pre-signed URL via AWS cli, to access the content of your bucket without exposing bucket to Public with time expiry.
To achieve this result, just follow the below steps:
Step 1: Login to Amazon CLI with access key & secret access key with S3 Full Access Rights.
Step2: Upload your document in S3 Bucket for which you want to generate a URL.
Step 3: Run the below command in AWS CLI to generate pre-signed url:
1aws s3 presign s3://awsexamplebucket/test2.txt --expires-in 604800
The above pre-sign command generates a pre-signed URL for a specified bucket and key that is valid for one week. Output:
1https://examplebucket.s3.amazonaws.com/test2.txt?AWSAccessKeyId=AKIAEXAMPLEACCESSKEY&Signature=EXHCcBe%EXAMPLEKnz3r8O0AgEXAMPLE&Expires=1556132848