Skip to content

InvalidInputException error for containerName when deploying to AWS lightsail using AWS-CLI in Mac M1

0

Hello, I am trying to deploy my application to the AWS Lightsail container service that I have created. When I try to run the create-container-service-deployment command from the aws-cli, I get the following error: An error occurred (InvalidInputException) when calling the CreateContainerServiceDeployment operation: Invalid container name. You must specify the name of a container that is in the containers portion of the request. This seems to be an issue cause by the containerName parameter specified in the public-endpoint.json file. If I use 'flask' as the container name (as mentioned in this tutorial), the deployment works. But if I use any other string as name it throws the above error. But when I try to deploy from the AWS Lightsail console directly, any container name proceeds with successful deployment. If I try to use the exact same name with the cli, under the same options, it fails.

Please find the details in the image below: Enter image description here

I am using a Mac OS with the M1 chip Solutions tried:

  • Tried updating the aws-cli package and lightsail package; does not resolve the error
  • Tried different container names, without hyphens, with hyphens, other words with 'flask'. Everything throws the same error, even for the example tutorial.
  • Tried the example tutorial in a linux machine, the issue persists. Application gets deployed if public-endpoint.json file's containerName parameter is defined as 'flask' and fails otherwise.

Kindly help with this, Thanks!

1 Answer
0
Accepted Answer

Hi,

Thank you for reaching out, the container name in public-endpoint.json should match the container name in containers.json

for example containers.json

{
    "test1": {
        "image": ":flask-service.flask-container.1",
        "ports": {
            "5000": "HTTP"
        }
    }
}

public-endpoint.json

{
    "containerName": "test1",
    "containerPort": 5000
}

the containerName here should match whatever you defined in containers.json

Thank you

Yujie

AWS

answered a year ago

EXPERT

reviewed a year ago

  • Thank you so much for pointing this out Yujie! It works now! I did not realise that the 'flask' in the containers.json file was supposed to be the container name.

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.