Last active
May 9, 2022 18:35
-
-
Save bradymholt/0af96461ece3fccb548a9546001c6ecc to your computer and use it in GitHub Desktop.
Generate presigned S3 upload URL with aws-sdk-s3 in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource = Aws::S3::Resource.new(client: Aws::S3::Client.new) | |
url = resource.bucket('my-bucket').object('myfolder/foo.txt').presigned_url(:put) | |
put url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v --upload-file ./foo.txt "https://my-bucket.s3.amazonaws.com/myfolder/foo.txt?X-Amz-Algorithm=<snip>&X-Amz-Credential=<snip>%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=<snip>&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=<snip>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment