docker-archive / compose-cli

Easily run your Compose application to the cloud with compose-cli
Apache License 2.0
958 stars 254 forks source link

Allows flexible setting of AssignPublicIp (Fargate) #2135

Closed nobiit closed 1 year ago

nobiit commented 2 years ago

Description I don't want clients to be able to directly access my service via public ip in any way.

Describe the results you received: Currently there is no way to disable flexible public ip

Describe the results you expected: I expected to be able to set up assignPublicIP simply via ecs-compo.yml

Additional environment details (AWS ECS, Azure ACI, local, etc.): https://github.com/docker/compose-cli/blob/main/ecs/cloudformation.go#L238-L245

nobiit commented 2 years ago

In the meantime, you can try

x-aws-cloudformation:
  Resources:
    <Service>Service:
      Properties:
        NetworkConfiguration:
          AwsvpcConfiguration:
            AssignPublicIp: DISABLED
JohnPreston commented 2 years ago

Hello @nobiit If you want to give it a spin, you can do just that using ECS Compose-X. AssignPublicIp, in combination to putting your service in a subnet that has the internet gateway as default gateway, and you are good to go.

Instead of using x-aws-cloudformation, you define a "service level extension" that will allow to define extra settings. Here, with x-network you can set AssignPublicIp which will automatically take care of the rest for the final cloudformation template.

See this Deploy services with EIP on public subnets example.

Hope this helps :)

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically closed because it had not recent activity during the stale period.