Forrest logo
back to the aws tool

aws-s3-presign:tldr:e8e78

aws-s3-presign: Display help.
$ aws s3 presign help
try on your machine

The "aws s3 presign" command is used to generate a pre-signed URL for accessing an Amazon S3 object. This pre-signed URL can then be distributed to clients who can use it to access the object directly, without requiring any AWS credentials.

The full syntax of the command is:

aws s3 presign <s3-uri> [--expires-in <seconds>] [--region <region>]
  • <s3-uri>: Specifies the S3 object to generate a pre-signed URL for. It can be in the form of s3://<bucket>/<key>.
  • --expires-in <seconds>: Specifies the duration for which the pre-signed URL will be valid. After this duration, the URL will expire and no longer grant access to the object. By default, the URL will be valid for 3600 seconds (1 hour).
  • --region <region>: (Optional) Specifies the AWS region where the S3 bucket is located. This is required if the bucket is in a different region than the one configured in the AWS CLI.

The command will generate a pre-signed URL and return it as the output. This URL can then be used by clients to access the S3 object directly, without requiring any authentication. The duration of validity ensures that the URL remains usable for a limited time to enhance security.

For example, to generate a pre-signed URL for an S3 object located at s3://my-bucket/my-object.png that will be valid for 86400 seconds (1 day) in the default region:

aws s3 presign s3://my-bucket/my-object.png --expires-in 86400

The generated pre-signed URL can be copied and shared with clients who can then use it to access the object within the specified time frame.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the aws tool