> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/logging/appsec-aws-333.md).

# AWS ECS services have automatic public IP address assignment enabled misconfiguration detected in co

## Rule Details

|                        |                                      |
| ---------------------- | ------------------------------------ |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_333                     |
| Category - Subcategory | Logging - Public Exposure            |
| Provider               | AWS                                  |
| Severity               | LOW                                  |
| Framework              | Terraform, Terraform Plan            |
| Mapped CSPM/KSPM Rule  | 2e58c953-9a4e-4e59-bf3a-3ac93f4cd27b |

## Impact

This rule verifies that Elastic Container Service (ECS) services do not automatically assign public IP addresses. The main risk of non-compliance with this rule is increased vulnerability. If ECS services are automatically assigned public IP addresses, it opens the possibility for unauthorized entities to interact with and potentially exploit these services. This can lead to data breaches, service interruptions, and other security incidents. Therefore, it's critical to ensure IP addresses aren't automatically publicly exposed to limit potential attack vectors and maintain the security of the services.

## How to Fix

*Resource:* aws\_ecs\_service

* *Arguments:* network\_configuration.assign\_public\_ip

In order to fix this issue, you need to ensure that the ECS services do not have public IP addresses assigned to them automatically. This can be done by setting the `assign_public_ip` attribute to `false` in the `aws_ecs_service` resource block.

## By setting the `assign_public_ip` attribute to `false`, the ECS services will not have public IP addresses automatically assigned to them. This makes the ECS services more secure as they can't be reached directly from the internet. They can only be accessed via the load balancer, providing an additional layer of security. \[source,go]

resource "aws\_ecs\_service" "example" { name = "example" cluster = aws\_ecs\_cluster.example.id task\_definition = aws\_ecs\_task\_definition.example.arn

network\_configuration { subnets = \[aws\_subnet.example.id] assign\_public\_ip = false }

## load\_balancer { target\_group\_arn = aws\_lb\_target\_group.example.arn container\_name = "example" container\_port = 8080 } }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/logging/appsec-aws-333.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
