I have created an AWS VPC, subnet and security group and want to deploy my docker containers to these premade resources as a fargate ecs service.
However I don’t know how to tell the service to use a premade subnet (it looks like it randomly picks a subnet from an ‘allowed’ list of subnets which is currently all subnets I have in my VPC
The below file correctly deploys to the desired vpc, cluster and security group, just not subnet:
version: '2'
x-aws-cluster: "Test Cluster"
x-aws-vpc: "vpc-02dffc2a8782579d4"
x-aws-security-group: "sg-02511658ffc184884"
services:
nginx:
image: nginx:1.19
networks:
- Backend-Access
networks:
Backend-Access:
external:
name: sg-02511658ffc184884
ipam:
driver: default
config:
- subnet: subnet-0aeef680f1f9e5cda # this has no effect
#- subnet: 172.31.4.0/24 also does not place the service in this subnet
I am running it using docker compose up -d
(running it without -d gives a cluster does not exist error)
2
Answers
This is currently not possible and there is a GitHub issue open to ask for this specifically. If you could made your voice be heard there that’s where we are consolidating this feedback. Thank you.
It is possible to make a subnet using the documented overlay method now and I solved it.
See the Github issue again! It was solved and closed two weeks ago.