Access to the containers deployed in AWS

Hello,

We have deployed an application with Waypoint to an AWS account, using the AWS ECS service.

The HCL file is similar to this:

app "api" {
    path = "./api"

    build {
        use "docker" {
            dockerfile = var.Dockerfile-name
            context = "api"
        }
        registry {
            use "aws-ecr" {
                region     = "eu-west-2"
                repository = "api"
                tag        = "latest"
            }
        }
    }

    deploy {
        use "aws-ecs" {
            region = "eu-west-2"
            memory = 4096
            alb {
                certificate = var.api-aws-alb-certificate
                ingress_port = 443
                internal = false
                subnets = var.aws-alb-subnets
                zone_id = var.aws-alb-zone_id
                domain_name = var.api-aws-alb-domain_name
            }
            subnets = var.aws-subnets
            security_group_ids = var.aws-security_group_ids
        }
    }
}

As you can see we have used variables to store all the information about the AWS services used. The application is deployed and is up and running. But when I try to access to the container, with this command:

waypoint exec -app api /bin/bash

It says:

! No running instances found for exec!
  
  If you just recently deployed, the instances could still be starting up.
  Otherwise, please diagnose the issue by inspecting your application logs.
  If application logs are not available, the application may have failed to start.

I also have tried with AWS, with the following command:

aws ecs execute-command  \
    --region eu-west-2 \
    --cluster <name of the cluster that is created> \
    --task <ID of the task in AWS> \
    --command "/bin/bash" \ 
    --interactive

But the following error is thrown:

An error occurred (InvalidParameterException) when calling the ExecuteCommand operation: The execute command failed because execute command was not enabled when the task was run or the execute command agent isn’t running. Wait and try again or run a new task with execute command enabled and try again.

So I’m not sure if there is some configuration I’m missing.

Thanks!