(AutoIt) Amazon S3 Download String from Bucket in Region
Demonstrates how to download a text file (i.e. object) from an S3 bucket NOT in the us-east-1 region.
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("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"
Local $sBucketName = "chilkateufrankfurt"
Local $sObjectName = "fruit.xml"
Local $sCharset = "utf-8"
Local $sFileContents
$sFileContents = $oHttp.S3_DownloadString($sBucketName,$sObjectName,$sCharset)
If ($oHttp.LastMethodSuccess <> True) Then
; Failed
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Else
; Success
ConsoleWrite($sFileContents & @CRLF)
EndIf
|