AppRunner CLI error when setting RuntimeEnvironmentVariables

1

I'm trying to pass some environment variables to AppRunner on the command line. Here's my approximate command line:

aws apprunner create-service --service-name some_name --source-configuration '{"AuthenticationConfiguration": {...}, "ImageRepository": {"ImageIdentifier": "my-image:latest",
 "ImageConfiguration": {
    "Port": "8080", 
    "RuntimeEnvironmentVariables": [ { "ITERATIONS": "2000"} ]
},
  "ImageRepositoryType": "ECR"}}' --region us-east-1

When I call this, I get the following error: Parameter validation failed: Invalid type for parameter SourceConfiguration.ImageRepository.ImageConfiguration.RuntimeEnvironmentVariables, value: [OrderedDict([('ITERATIONS', '2000')])], type: <class 'list'>, valid types: <class 'dict'>

Looking at the create-service docs, I believe my usage is correct, so the OrderedDict error doesn't make too much sense. Can anyone spot something wrong with my CLI command, or anyone have an example of their use of the RuntimeEnvironmentVariables option?

howellz
asked 2 years ago459 views
1 Answer
0

I removed the list from the value I was passing to RuntimeEnvironmentVariables & it worked. So specifically: "ImageConfiguration": {"Port": "8080", "RuntimeEnvironmentVariables": { "PI_ITERATIONS": "2000"} } rather than "RuntimeEnvironmentVariables": [{...}].

This does NOT look like the example given in the docs:

                    "RuntimeEnvironmentVariables": [
                        {
                            "NAME": "Jane"
                        }
                    ]

So I think either the docs or the CLI is wrong. I'm using CLI version aws-cli/2.4.6. I'd still appreciate some other answers of example usages of CLI commands if anyone has, since the doc ones seem to be wrong. I also haven't tried passing multiple environment variables yet.

howellz
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions