Sample code for 30+ languages & platforms
Lua

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 Lua Downloads

Lua
local chilkat = require("chilkat")

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

local http = chilkat.Http.new()

-- Insert your access key here:
http.aws_access_key = "AWS_ACCESS_KEY"

-- Insert your secret key here:
http.aws_secret_key = "AWS_SECRET_KEY"

-- This bucket is in the eu-central-1 region.
http.aws_region = "eu-central-1"

local bucketName = "chilkateufrankfurt"

local objectName = "fruit.xml"

local charset = "utf-8"

local fileContents = http:s3_download_string(bucketName, objectName, charset)

if not http.last_method_success then
    -- Failed
    print(http.last_error_text)
else
    -- Success
    print(fileContents)
end