I am creating my infrastructure with Ansible. I create a VPC and an ECS cluster where I use Fargate to run my docker containers.
When the tasks are started I am prompted that the task was not able to pull the Image from the ECR.
STOPPED (CannotPullContainerError: Error response from daem)
I know for a fact that the URI to the image and the IAM permissions are correct. Also I don't think the issue is in the AMI or docker image, because when I create the same scenario over the AWS UI, it works fine.
Therefore, I assume my VPC is not configured correctly in a way that it can not connect to the ECR.
This is how I create my VPC and Subnet:
- name: "2) Create VPC"
ec2_vpc_net:
name: "{{vpc_name}}"
state: present
cidr_block: 10.10.0.0/16
region: "{{ region_name }}"
register: vpc_net
- name: "3) Create VPC Subnet"
ec2_vpc_subnet:
state: present
map_public: yes
vpc_id: "{{vpc_net.vpc.id}}"
cidr: 10.10.0.0/24
tags:
name: "test-subnet"
register: vpc_subnet
How can I ensure my VPC and subnet is configured correctly so that the docker daemon can connect and pull the image from the ECR repo? Am I missing an important attribute?