Fork me on GitHub
#aws
<
2022-06-12
>
Martynas M08:06:05

What does aws_ecs_service.network_configuration.assign_public_ip do? For me the doc seems to be very vague and maybe even misleading. The doc says that it somehow assigns public IP. And when I deploy it with false then it says it's 503. Default is false but then what does it do? Is it meant for tasks that can't be reached from the internet? I deployed with false and that container should then serve a webpage but it was 503-ing for 5 minutes. And when I redeployed using true then it came online. So does it mean that it exposes the container to the subnet or does it mean that the container actually gets a real public IP with all ports visible publicly? This is the doc (I use Fargate instances): https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#assign_public_ip

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_ecs_service.landing_service will be updated in-place
  ~ resource "aws_ecs_service" "my_service" {
        id                                 = "<removed>"
        name                               = "my_service"
        tags                               = {}
        # (15 unchanged attributes hidden)




      ~ network_configuration {
          ~ assign_public_ip = false -> true
            # (2 unchanged attributes hidden)
        }
        # (3 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.