Uploading objects with presigned URLs
You may use presigned URLs to allow someone to upload an object to your Amazon S3 bucket. Using a presigned URL will allow an upload without requiring another party to have AWS security credentials or permissions. A presigned URL is limited by the permissions of the user who creates it. That is, if you receive a presigned URL to upload an object, you can upload an object only if the creator of the URL has the necessary permissions to upload that object.
When someone uses the URL to upload an object, Amazon S3 creates the object in the specified bucket. If an object with the same key that is specified in the presigned URL already exists in the bucket, Amazon S3 replaces the existing object with the uploaded object. After upload, the bucket owner will own the object.
For general information about presigned URLs, see Download and upload objects with presigned URLs.
You can create a presigned URL for uploading an object without writing any code by using AWS Explorer for Visual Studio. You can also generate a presigned URL programmatically by using the AWS SDKs.
Note
At this time, the AWS Toolkit for Visual Studio does not support Visual Studio for Mac.
-
Install the AWS Toolkit for Visual Studio using the following instructions, Installing and setting up the Toolkit for Visual Studio in the AWS Toolkit for Visual Studio User Guide.
-
Connect to AWS using the following steps, Connecting to AWS in the AWS Toolkit for Visual Studio User Guide.
-
In the left side panel labeled AWS Explorer, right-click the bucket you wish to have an object uploaded to.
-
Choose Create Pre-Signed URL....
-
In the pop-up window, set the expiration date and time for your presigned URL.
-
For Object Key, set the name of the file to be uploaded. The file you're uploading must match this name exactly. If an object with the same object key already exists in the bucket, Amazon S3 will replace the existing object with the newly uploaded object.
-
Choose PUT to specify that this presigned URL will be used for uploading an object.
-
Choose the Generate button.
-
To copy the URL to the clipboard, choose Copy.
-
To use this URL you can send a PUT request with the
curl
command. Include the full path to your file and the presigned URL itself.curl -X PUT -T "
/path/to/file
" "presigned URL
"
For examples of using the AWS SDKs to generate a presigned URL for uploading an object, see Create a presigned URL for Amazon S3 by using an AWS SDK.
When you use the AWS SDKs to generate a presigned URL, the maximum expiration time is 7 days from the time of creation.
Note
For all AWS Regions launched after March 20, 2019 you need to specify the
endpoint-url
and AWS Region
with the request. For a list of
all the Amazon S3 Regions and endpoints, see Regions
and Endpoints in the AWS General Reference.