Sample code for 30+ languages & platforms
Xbase++

Amazon S3 Download String from Bucket in Region

See more Amazon S3 Examples

Demonstrates how to download a text file (i.e. object) from an S3 bucket NOT in the us-east-1 region.

Chilkat Xbase++ Downloads

Xbase++
LOCAL oHttp
LOCAL cBucketName
LOCAL cObjectName
LOCAL cCharset
LOCAL cFileContents

//  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"

//  This bucket is in the eu-central-1 region.
oHttp:AwsRegion := "eu-central-1"

cBucketName := "chilkateufrankfurt"

cObjectName := "fruit.xml"

cCharset := "utf-8"

cFileContents := oHttp:S3_DownloadString(cBucketName, cObjectName, cCharset)

IF (oHttp:LastMethodSuccess != 1)
    //  Failed
    ? oHttp:LastErrorText
ELSE
    //  Success
    ? cFileContents
ENDIF

oHttp:destroy()