Skip to content

[TON-197] Add EC2 agent install IAM permissions to CloudFormation template#298

Draft
swang392 wants to merge 3 commits intoray.eah/ton-xxx-agent-install-eventbridgefrom
sarah.wang/ton-197-ec2-agent-install-iam
Draft

[TON-197] Add EC2 agent install IAM permissions to CloudFormation template#298
swang392 wants to merge 3 commits intoray.eah/ton-xxx-agent-install-eventbridgefrom
sarah.wang/ton-197-ec2-agent-install-iam

Conversation

@swang392
Copy link
Copy Markdown

Summary

  • Adds DatadogAgentInstallEC2Policy (gated on AgentOnCloudResources condition / InstallAgentOnCloudResources=true) with 5 IAM statements covering all API calls the EC2 handler makes:
    • SSM: DescribeInstanceInformation, SendCommand, GetDocument, CreateDocument, UpdateDocument, UpdateDocumentDefaultVersion (Resource: *)
    • SecretsManager: DescribeSecret, CreateSecret (scoped to /datadog/ec2-instrumenter/*)
    • IAM create: CreateRole, CreateInstanceProfile, AddRoleToInstanceProfile (scoped to datadog-ssm-*)
    • IAM read/attach: GetInstanceProfile, ListAttachedRolePolicies, AttachRolePolicy, PutRolePolicy (Resource: *, needed for existing customer instance profiles in Cases B/C)
    • iam:PassRole scoped to datadog-ssm-* roles with ec2.amazonaws.com condition
  • Bumps version to v4.8.1 and adds CHANGELOG entry

Depends on

#296

Test plan

  • Refresh SSO session and run aws cloudformation validate-template on the modified template
  • Deploy template to sandbox account with InstallAgentOnCloudResources=true and verify DatadogAgentInstallEC2Policy is created and attached
  • Run EC2 handler Install against a tagged instance and confirm no AccessDenied errors

🤖 Generated with Claude Code

swang392 and others added 3 commits April 13, 2026 15:17
…plate

Adds DatadogAgentInstallEC2Policy (gated on AgentOnCloudResources condition)
with 5 statements covering: SSM document/command operations, SecretsManager
secrets scoped to /datadog/ec2-instrumenter/*, datadog-ssm-* role/profile
creation, IAM read+attach for existing customer resources, and iam:PassRole
scoped to datadog-ssm-* roles with ec2.amazonaws.com condition. Bumps to v4.8.1.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…emplate

Adds DatadogAgentInstallEKSPolicy (gated on AgentOnCloudResources) with the
5 delete permissions needed for EKS uninstall: eks:DeleteAccessEntry,
lambda:DeleteFunction, iam:DeleteRolePolicy, iam:DeleteRole, and
secretsmanager:DeleteSecret. All scoped to dd-eks-instrumenter-* resources
and the /datadog/eks-instrumenter/* secret path.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ninstall

Replaces the uninstall-only stub with a complete 5-statement policy matching
the enclave instrumenter-snap policy for EKS operations: EKS cluster
list/describe/access-entry management (Resource: *), Lambda CRUD scoped to
dd-eks-instrumenter-*, IAM role CRUD scoped to dd-eks-instrumenter-*,
SecretsManager CRUD scoped to /datadog/eks-instrumenter/*, and iam:PassRole
to lambda.amazonaws.com for dd-eks-instrumenter-* roles. Also adds
ec2:DescribeNatGateways and iam:SimulatePrincipalPolicy (used in
MatchesFilters preflight check).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant