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)