Closed Madhu1512 closed 7 years ago
hi, thank you for interested in lua-aws. I think ECS service definition is already added this repository and json request/v4 signature is already supported, so it should work. I will write test and if it passed, release it public at later of this week (or weekend).
test with createCluster/listClusters/deleteCluster seems good. @Madhu1512, can you try and check that meets your requirement? thanks!
Thanks @umegaya for adding ECS Api. I will test it today and will let you know how it goes.
@umegaya i cloned your ecs branch and I used your test/ecs.lua to test ecs api.
It is throwing errors when i don't specify the endpoint or region.
lua test/ecs.lua ecs:v[2014-11-13]: CreateCluster:error:/usr/local/share/lua/5.2/lua-aws/api.lua:9: neither config.endpoint given nor EC2_URL environment set. @ stack traceback: /usr/local/share/lua/5.2/lua-aws/api.lua:126: in function </usr/local/share/lua/5.2/lua-aws/api.lua:125> [C]: in function 'error' /usr/local/share/lua/5.2/lua-aws/api.lua:9: in function 'get_endpoint_from_env' /usr/local/share/lua/5.2/lua-aws/api.lua:61: in function 'endpoint' /usr/local/share/lua/5.2/lua-aws/requests/base.lua:74: in function 'base_build_request' /usr/local/share/lua/5.2/lua-aws/requests/base.lua:20: in function </usr/local/share/lua/5.2/lua-aws/requests/base.lua:18> (...tail calls...) [C]: in function 'xpcall' /usr/local/share/lua/5.2/lua-aws/api.lua:122: in function 'createCluster' test/ecs.lua:17: in main chunk [C]: in ? lua: ./test/helper/util.lua:22: bad argument #1 to 'pairs' (table expected, got nil) stack traceback: [C]: in function 'pairs' ./test/helper/util.lua:22: in function 'dump_res' test/ecs.lua:22: in main chunk [C]: in ?
To make it work, i need to add region and endpoint url.
local helper = require 'test.helper.util' helper.dump = true local AWS = require ('lua-aws.init') local Region = os.getenv('AWS_REGION') or 'us-east-1' local aws = AWS.new({ accessKeyId = os.getenv('AWS_ACCESS_KEY'), secretAccessKey = os.getenv('AWS_SECRET_KEY'), sslEnabled = true, region = Region, endpoint = "https://ecs." .. Region .. ".amazonaws.com" })
print("https://ecs." .. Region .. ".amazonaws.com") local api = aws.ECS:api_by_version('2014-11-13')
local ok, r ok, r = api:createCluster({ clusterName = "test", })
if (not ok) or (not r.cluster) then dump_res(r) assert(false, "create cluster fails") end
local arn = r.cluster.clusterArn print("clusterArn", arn)
@Madhu1512 ya. it works as I expected. lua-aws try to inject region from EC2_URL. or you put region explicitly. I think basically you don't need to set endpoint if you set region correctly. what behavior you expect? or you just report it works?
@Madhu1512 I merged pull request for this into master. if you have problem, feel free to reopen this issue.
is there any plan to support AWS ECS API?