(Tcl) Generate S3 Signed URL
Demonstrates how to generate a pre-signed S3 URL. Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# Insert your access key here:
CkHttp_put_AwsAccessKey $http "AWS_ACCESS_KEY"
# Insert your secret key here:
CkHttp_put_AwsSecretKey $http "AWS_SECRET_KEY"
CkHttp_put_AwsRegion $http "us-west-2"
CkHttp_put_AwsEndpoint $http "s3-us-west-2.amazonaws.com"
set bucketName "chilkattest"
set path "starfish.jpg"
set signedUrl [CkHttp_s3_GenPresignedUrl $http "GET" 1 $bucketName $path 3600 "s3"]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
exit
}
puts "$signedUrl"
delete_CkHttp $http
|