> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
