Skip to content

Conversation

Copy link

Copilot AI commented Nov 13, 2025

The trust policy example for the target IAM role incorrectly referenced itself as the principal instead of the EC2 instance role that should be allowed to assume it.

Changes:

  • Updated trust policy example to use distinct role names: pbm-ec2-instance-role for the EC2 instance role and pbm-target-role for the target role
  • Fixed Principal.AWS field to reference the EC2 instance role ARN instead of the target role ARN
  • Updated accompanying text and notes to reflect the correct role names

Before:

{
  "Principal": {
    "AWS": "arn:aws:iam::EC2_ACCOUNT_ID:role/pbm-target-role"
  },
  "Action": "sts:AssumeRole"
}

After:

{
  "Principal": {
    "AWS": "arn:aws:iam::EC2_ACCOUNT_ID:role/pbm-ec2-instance-role"
  },
  "Action": "sts:AssumeRole"
}

This corrects the IAM role assumption pattern: the trust policy attached to the target role must specify which role (the EC2 instance role) is permitted to assume it.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…rget role

Co-authored-by: radoslawszulgo <175048287+radoslawszulgo@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on IAM roles examples from review Fix IAM trust policy example to reference EC2 instance role Nov 13, 2025
Copilot AI requested a review from radoslawszulgo November 13, 2025 12:36
Copilot finished work on behalf of radoslawszulgo November 13, 2025 12:36
@radoslawszulgo radoslawszulgo marked this pull request as ready for review November 13, 2025 12:37
@radoslawszulgo radoslawszulgo merged commit d11411b into radoslaw-szulgo-improve-aws-automation-with-iam-roles-examples Nov 13, 2025
@radoslawszulgo radoslawszulgo deleted the copilot/sub-pr-317 branch November 13, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants