Skip to content

Commit 5a25918

Browse files
ddragosdselfxp
authored andcommitted
Aws kinesis credentials should pass aws_credentials to KinesisService (#5)
* AWS' SDK concerns for cached credentials should not be handled by the logger as they're handled by the aws sdk * [Doc] - added a guide for configuring AwsKinesisLogger backend. * [Doc] - Updated README based on reviews * AwsKinesisLogger should pass aws_credentials config option to the Kinesis Service
1 parent 7bd77b7 commit 5a25918

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

src/lua/api-gateway/logger/backend/AwsKinesisLogger.lua

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,16 @@ function _M:constructor(o)
4848
self.aws_access_key = o.aws_access_key
4949
self.aws_iam_user = o.aws_iam_user
5050

51-
local iam_user = o.aws_iam_user
52-
5351
local kinesisServiceConfig = {
5452
aws_region = o.aws_region,
55-
aws_secret_key = o.aws_secret_key,
56-
aws_access_key = o.aws_access_key,
57-
aws_debug = true, -- print warn level messages on the nginx logs
58-
aws_conn_keepalive = 60000, -- how long to keep the sockets used for AWS alive
59-
aws_conn_pool = 100 -- the connection pool size for sockets used to connect to AWS
53+
aws_credentials = o.aws_credentials, -- credentials provider
54+
aws_secret_key = o.aws_secret_key, -- deprecated but kept for backwards compatibility
55+
aws_access_key = o.aws_access_key, -- deprecated but kept for backwards compatibility
56+
aws_debug = o.aws_debug, -- print warn level messages on the nginx logs
57+
aws_conn_keepalive = o.aws_conn_keepalive, -- how long to keep the sockets used for AWS alive
58+
aws_conn_pool = o.aws_conn_pool -- the connection pool size for sockets used to connect to AWS
6059
}
6160

62-
if (iam_user ~= nil) then
63-
kinesisServiceConfig.aws_iam_user = iam_user.iam_user
64-
kinesisServiceConfig.security_credentials_host = iam_user.security_credentials_host
65-
kinesisServiceConfig.security_credentials_port = iam_user.security_credentials_port
66-
kinesisServiceConfig.shared_cache_dict = iam_user.shared_cache_dict
67-
end
68-
6961
kinesisService = KinesisService:new(kinesisServiceConfig)
7062
end
7163

test/perl/aws_kinesis_logger.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ __DATA__
100100
backend_opts = {
101101
aws_region = ngx.var.aws_region,
102102
kinesis_stream_name = ngx.var.kinesis_stream_name,
103-
aws_iam_user = {
103+
aws_credentials = {
104+
provider = "api-gateway.aws.AWSIAMCredentials",
104105
security_credentials_host = "127.0.0.1", -- test only
105106
security_credentials_port = $TEST_NGINX_PORT, -- test only
106107
security_credentials_timeout = 60 * 60 * 24,

0 commit comments

Comments
 (0)