Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Generate S3 Signed URL

See more Amazon S3 Examples

Demonstrates how to generate a pre-signed S3 URL.

Chilkat Xbase++ Downloads

Xbase++
LOCAL oHttp
LOCAL cBucketName
LOCAL cPath
LOCAL cSignedUrl

//  This example assumes the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

oHttp := CreateObject("Chilkat.Http")

//  Insert your access key here:
oHttp:AwsAccessKey := "AWS_ACCESS_KEY"

//  Insert your secret key here:
oHttp:AwsSecretKey := "AWS_SECRET_KEY"

oHttp:AwsRegion := "us-west-2"
oHttp:AwsEndpoint := "s3-us-west-2.amazonaws.com"

cBucketName := "chilkattest"
cPath := "starfish.jpg"

cSignedUrl := oHttp:S3_GenPresignedUrl("GET", 1, cBucketName, cPath, 3600, "s3")
IF (oHttp:LastMethodSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    RETURN
ENDIF

? cSignedUrl

oHttp:destroy()