> 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/iam/appsec-aws-249.md).

# AWS Execution Role ARN and Task Role ARN are different in ECS Task definitions misconfiguration dete

## Rule Details

|                        |                       |
| ---------------------- | --------------------- |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_249      |
| Category - Subcategory | IAM - Role Separation |
| Provider               | AWS                   |
| Severity               | LOW                   |
| Framework              | Terraform             |

## Impact

In Amazon ECS, it's important to distinguish between the execution task roles as they fulfill separate roles and serve distinct purposes:

* The *execution role* is used by the ECS agent to make AWS API calls on behalf of the user.
* The *task role* grants permissions specifically to the tasks.

If the same role is used for both purposes, it might lead to a broader set of permissions than required. For example, the execution role might end up with unnecessary task-specific permissions, or the task role might have permissions that are not relevant to the execution role.

## How to Fix

*Resource:* aws\_ecs\_task\_definition

* *Arguments:* execution\_role\_arn, task\_role\_arn

## Ensure that the `execution_role_arn` does not match the `task_role_arn` \[source,go]

resource "aws\_ecs\_task\_definition" "example" { ...

* execution\_role\_arn = "arn:aws:iam::123456789012:role/execution\_role"
* task\_role\_arn = "arn:aws:iam::123456789012:role/task\_role" ... }

***


---

# 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/iam/appsec-aws-249.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.
