> 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/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/aws-ec2-instance-is-assigned-with-public-ip.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# AWS EC2 instance is assigned with public IP

### Synopsis

| Field               | Value                                        |
| ------------------- | -------------------------------------------- |
| Rule Type           | Detection                                    |
| Finding Type        | AWS EC2 instance is assigned with public IP  |
| Finding ID          | 60000979                                     |
| Generates a Finding | This detection rule also generates a finding |
| Severity            | Informational                                |
| Category            | CONFIGURATION                                |
| Cloud Providers     | AWS                                          |
| Platform Module     | CSPM                                         |
| Asset Types         | EC2\_INSTANCE                                |
| ATT\&CK Tactic      | TA0112 (TA0112)                              |
| ATT\&CK Technique   | T1685 (T1685)                                |

### Description

Publicly accessible AWS EC2 instances increase the risk of unauthorized access and compromise. These instances, assigned public IP addresses, present a larger attack surface than those using private IP addresses.

AWS EC2 instances are virtual servers within the AWS cloud. Assigning a public IP address allows direct internet access, bypassing any network security controls. Untrusted actors could exploit this misconfiguration to gain unauthorized access, potentially leading to data breaches, lateral movement within the AWS environment, and further compromise of other resources.

The impact of this misconfiguration includes increased risk of data breaches, service disruptions, and financial losses. Restricting public IP address assignment reduces the attack surface, improving the overall security posture. Private IPs, combined with security groups and network ACLs, provide a more secure communication method between EC2 instances.

To mitigate this risk, avoid assigning public IP addresses to EC2 instances whenever possible. Utilize private IP addressing for internal communication. Employ security groups to control inbound and outbound network traffic, limiting access only to necessary ports and IPs. Consider using NAT Gateways or NAT Instances for outbound internet access from private instances.

### Remediation

**Manual steps:**

EC2 Instance - Manual remediation steps:

In a default VPC, instances get a public IP address. In a non-default VPC, the subnet configuration determines this.

You can't manually change an automatically-assigned public IP. To control public IP assignment:

To unassign the IP addresses associated with a network interface, follow the instructions here:

<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#managing-network-interface-ip-addresses>

Note: If you specify an existing network interface for eth0 (the primary network interface), you can't change its public IP address settings using the auto-assign public IP feature; the subnet settings will take precedence.

Modify the subnet's public IP addressing attribute by following these actions:

<https://docs.aws.amazon.com/vpc/latest/userguide/vpc-ip-addressing.html#subnet-public-ip>

If you are using an Elastic IP, the instance is internet-reachable. To disassociate an Elastic IP, follow these actions:

<https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html#using-instance-addressing-eips-associating-different>


---

# 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/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/aws-ec2-instance-is-assigned-with-public-ip.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.
