Class AWS
AWS class.
Methods
AWS:new (config) | Creates a new AWS instance. |
Methods
- AWS:new (config)
-
Creates a new AWS instance.
By default the instance will get a CredentialProviderChain set of
credentials, which can be overridden.
Note that the AWS objects as well as the Service objects are expensive to create, so you might want to reuse them.
Parameters:
- config
(optional) the config table to be copied into the instance as the global
aws_instance.config
Usage:
local AWS = require("resty.aws") local utils = require("resty.aws.utils") local config = { region = utils.getCurrentRegion() } local aws = AWS(config) -- or similarly local aws = AWS:new(config) -- Override default "CredentialProviderChain" credentials local my_creds = aws:Credentials { accessKeyId = "access", secretAccessKey = "secret", sessionToken = "token", } aws.config.credentials = my_creds -- instantiate a service (optionally overriding the global config) local sm = aws:SecretsManager { region = "us-east-2", } -- Invoke a method local results, err = sm:GetSecretValue { SecretId = "arn:aws:secretsmanager:us-east-2:238406704566:secret:test-HN1F1k", })
- config
(optional) the config table to be copied into the instance as the global