Skip to content

Add AWS CloudWatch permissions to the Federated Identity CFT - #7622

Closed
seanrathier wants to merge 6 commits into
mainfrom
seanrathier/federated-identity-aws-cloudwatch
Closed

Add AWS CloudWatch permissions to the Federated Identity CFT#7622
seanrathier wants to merge 6 commits into
mainfrom
seanrathier/federated-identity-aws-cloudwatch

Conversation

@seanrathier

Copy link
Copy Markdown
Contributor

Summary

Adds ElasticAwsCloudwatch inline IAM policy to the federated identity CloudFormation template, covering both log and metric collection for the AWS CloudWatch policy template:

  • logs:DescribeLogGroups + logs:FilterLogEvents — for cloudwatch_logs via the aws-cloudwatch Beats input
  • cloudwatch:ListMetrics + cloudwatch:GetMetricData — for cloudwatch_metrics via the aws/metrics Beats input

Paired integrations PR: elastic/integrations#20525

Base: sibling of #7422 (same baseline commit as #7589 and #7590 — each adds one policy, whichever merges last rebases over a trivial same-resource conflict)

E2E test plan

  1. Deploy this CFT (or update an existing federated-identity stack to include this change)
  2. In Fleet, configure the CloudWatch policy template with credential type = Identity Federation; enter the role ARN and external ID from the stack outputs
  3. Enable cloudwatch_logs — confirm logs land in logs-aws.cloudwatch_logs-* and Fleet shows no DEGRADED status
  4. Enable cloudwatch_metrics — confirm metrics land in metrics-aws.cloudwatch_metrics-*
  5. Verify no AccessDeniedException errors for DescribeLogGroups, FilterLogEvents, ListMetrics, or GetMetricData in the agent logs
  6. Regression: A Direct Access Keys policy against the same AWS account must still collect data unaffected

seanrathier and others added 6 commits July 21, 2026 16:13
Introduces federated-identity-aws.yml — a single CFT with one Enable*
boolean parameter per AWS integration. CloudFormation Conditions attach
only the IAM policies needed for the selected data streams, keeping the
role minimal. Transport-layer policies (S3/SQS, CloudWatch Logs, Metrics)
are auto-derived so users never need to think about them.

Adds the template to publish_cft.sh so it is uploaded to S3 alongside
the existing cloud-connectors templates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nally

Drops the 24 Enable* parameters and all CloudFormation Conditions in
favor of a single static read-only role. Every IAM policy needed by the
agentless-enabled AWS policy templates is always attached, so Kibana
only needs to pass ElasticResourceId in the quick-create URL and users
never have to update the stack when they add integrations later.

Policies are grouped into four inline policy resources (transport,
metrics, security findings, service inventory) plus the GuardDuty
managed policy. Trust policy, ExternalId derivation, and outputs are
unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extends the federated identity role to cover CSPM, Cloud Asset
Inventory, and KSPM-EKS: attaches the SecurityAudit managed policy and
adds an ElasticSecurityPosture inline policy with the supplemental
config, organizations, access-analyzer, account, cross-account
sts:AssumeRole, and EKS read permissions declared in the per-package
IaC patches of elastic/integrations#20240.

CNVM is deliberately excluded: its scan operations (snapshot
create/delete, RunInstances/TerminateInstances, iam:PassRole) require
write access, and this role stays read-only. CNVM keeps its dedicated
template.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cross-checked every inline action against the provider_permissions
declarations in elastic/integrations#19405 (the AWS package's
per-datastream permission manifest) and added the missing actions the
agentless data streams require at runtime:

- ec2:DescribeInstanceStatus (ec2_metrics)
- ecs:DescribeClusters (ecs_metrics)
- elasticloadbalancing:DescribeTargetHealth (elb_metrics)
- lambda:GetFunction (lambda)
- rds:DescribeDBClusters (rds)
- health:DescribeAffectedEntities (awshealth)
- securityhub:BatchGetSecurityControls, GetInsightResults
  (securityhub_findings_full_posture, securityhub_insights)

securityhub:ListInsights, declared by #19405, is NOT added: cfn-lint
confirms no such IAM action exists — listing insights is
securityhub:GetInsights, which was already granted.

Also corrects the Config grant: the aws.config data stream polls rule
compliance (DescribeConfigRules, DescribeComplianceByConfigRule,
GetComplianceDetailsByConfigRule), not resource inventory; the
inventory-style Config reads moved to the SecurityPosturePolicy with
the rest of the Asset Inventory permission set.

Actions not declared by #19405 are retained when another primary source
documents them (e.g. iam:ListAccountAliases in the package README);
services whose policy templates are not agentless-enabled (apigateway,
natgateway, vpn, emr, kafka, kinesis, redshift, s3_storage_lens) stay
out of scope.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the all-at-once grant (five inline policies + SecurityAudit
covering every agentless-enabled AWS integration upfront) with an
incremental model: the template carries only the permissions of
integrations that are actually federated, one block per integration,
mirroring the provider_permissions declared in that integration's
package manifest in elastic/integrations. Never grant ahead of a
declaration.

The baseline is GuardDuty only — the single integration federated in
production today. Its AmazonGuardDutyReadOnlyAccess grant is carried
over verbatim from the shipped cloud-connectors-guardduty template,
pre-dating provider_permissions; it converts to a mirrored block when
the aws package gains declarations.

Per-integration additions land as separate PRs stacked on this one,
each paired with the elastic/integrations PR that declares the
permissions it mirrors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds ElasticAwsCloudwatch inline policy with permissions for both
cloudwatch_logs and cloudwatch_metrics data streams:
- logs:DescribeLogGroups, logs:FilterLogEvents (aws-cloudwatch input)
- cloudwatch:ListMetrics, cloudwatch:GetMetricData (aws/metrics input)

Paired integrations PR: elastic/integrations#20525

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mergify

mergify Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label. Could you fix it @seanrathier? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@seanrathier

Copy link
Copy Markdown
Contributor Author

Closing in favour of a single combined cloudbeat PR covering all remaining CFT permissions.

@seanrathier seanrathier closed this Aug 4, 2026
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