0

I'm writing an AWS Lambda function in Python and have an issue. Here is the relevant piece of code:

containerInstances = listContainerInstances['containerInstanceArns'][j]

containerInstancesDetails = ecs.describe_container_instances(cluster=cluster, containerInstances=containerInstances)

I get the following error:

Invalid type for parameter containerInstances, value: arn:aws:ecs:eu-west-1:11111111111:container-instance/11111111-1111-1111-1111-111111111111, type: <type 'unicode'>, valid types: <type 'list'>, <type 'tuple'>: ParamValidationError

Anyone knows how the fix this issue? Do i need to convert from unicode to list? If so, how? I tried several things which didn't help.

Please advise.

2
  • 1
    What happens if you remove the final [j] on the first line ? According to the error msg, containerInstances should be a tuple or a list, but you only pick up one item at index 'j', instead of the whole list. Commented Apr 10, 2018 at 15:29
  • I will get the whole list, While i want the result of just one of them. I'm able to use this specific command in CLI, which gives me the expected result. Please see here: docs.aws.amazon.com/cli/latest/reference/ecs/… (see their example). However, The same command doesn't work well in their SDK, Which expecting to a tulip or a list. See here: boto3.readthedocs.io/en/latest/reference/services/…. Commented Apr 10, 2018 at 15:46

1 Answer 1

1

I don't know AWS Lambda, but given @sciroccorics's hint, and assuming it works like you would expect Python to work, all you need to do is ensure that containerInstances is a list:

containerInstances = [listContainerInstances['containerInstanceArns'][j]]

should do the trick.

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome! So simple :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.