Skip to content

Add ability to use AWS Cloud-based Authentication within the agent config#46291

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 68 commits intomainfrom
wyn.bennett/delegated_auth_integration
Mar 4, 2026
Merged

Add ability to use AWS Cloud-based Authentication within the agent config#46291
gh-worker-dd-mergequeue-cf854d[bot] merged 68 commits intomainfrom
wyn.bennett/delegated_auth_integration

Conversation

@wynbennett
Copy link
Copy Markdown
Contributor

@wynbennett wynbennett commented Feb 11, 2026

What does this PR do?

This adds a new authentication method for the agent. This give the agent the ability to exchange a AWS Cloud Auth Proof for an API key which is automatically managed and rotated on behalf of the customer. This is essentially extending the https://docs.datadoghq.com/account_management/cloud_provider_authentication into the agent.

This PR integrates the following PR into the config #46272

The flow is as so:

  • Agent get AWS credentials from the environment the agent is running in
  • Agent signs a request to AWS which will prove it's access to the credentials
  • Agent passed the signed request to Datadog service
  • Service validates the signed request against AWS and validates it against Datadog configuration
  • Service response with a Managed and automatically rotated API key
  • Agent propagates that API key throughout it's config
  • If the delegated auth flow fails it will fallback to using the API key provided in the yaml file. The allows customers to onboard with limited risk to their current flow.

Configuration

Global provider config + per-key-prefix enablement:

# Global delegated auth provider settings (used for all instances)
delegated_auth:
  org_uuid: ${YOUR_ORG_UUID}
  # Optional: explicitly specify provider (auto-detects if omitted)
  provider: aws
  aws:
    region: us-east-1  # Optional: auto-detects from IMDS if omitted

# Per-prefix enablement (logs can use a different org)
logs_config:
  delegated_auth:
    org_uuid: ${LOGS_ORG_UUID}  # Can be different org

Motivation

This should enable customers to not need to manage the API used by the agent and instead use the AWS credentials in the AWS environment the agent is deploy to.

Describe how you validated your changes

Ran the agent locally to validate changes and deployed to multiple staging clusters charcadet and entei. I have deployed it to staging clusters with both the feature enabled and the feature disabled.

I have marked this a something for RC testing as it is a large shift in how we can authenticate so it seems like it is more RC related.

To test this see the above YAML settings to turn on this method of getting an API key. You will need to ensure the AWS account you are authenticating with is allowed by our configuration. Please reach out to allow us to enable any AWS ARNs to use cloud auth.

Additional Notes

wynbennett and others added 6 commits February 11, 2026 10:31
Introduces the comp/core/delegatedauth component for cloud-based
API key retrieval using delegated authentication (AWS SigV4).

Also adds pkg/util/aws/creds for AWS credential detection and handling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Module consolidation:
- Consolidate 9 separate Go modules into a single comp/core/delegatedauth module
- Keep api/cloudauth/aws as a separate module to isolate AWS SDK dependency
- This enables future cloud providers (GCP, Azure) to be added as separate
  modules without bloating the core dependency graph

Graceful noop behavior:
- Initialize() now succeeds even when no supported cloud provider is detected
- AddInstance() becomes a noop on unsupported platforms instead of erroring
- Agent gracefully falls back to traditional API key method
- Debug logs available for troubleshooting

This change makes delegated auth easier to deploy in mixed environments
where some agents run on AWS and others run on-prem or other clouds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…2b.yaml

Co-authored-by: Bryce Eadie <bryce.eadie@datadoghq.com>
defaultConfPath,
configOptions...,
)),
delegatedauthfx.Module(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is added everywhere. Would it make sense to add this to the core bundle?

Copy link
Copy Markdown
Contributor Author

@wynbennett wynbennett Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already part of core.Bundle() see https://github.com/DataDog/datadog-agent/blob/wyn.bennett/delegated_auth_integration/comp/core/bundle.go#L70-L78. When core.Bundle(core.WithSecrets()) is used, both secretsfx.Module() and delegatedauthfx.Module() are injected together.

However, there are a few entry points that don't use core.Bundle() and instead call secretsfx.Module() directly:

  • cmd/trace-agent/subcommands/run/command.go
  • cmd/serverless-init/main.go
  • cmd/dogstatsd/subcommands/start/command.go

For these cases, delegatedauthfx.Module() must be added explicitly alongside secretsfx.Module()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something we'll want to improve later, I thought all commands used core.Bundle tbh

Comment thread cmd/system-probe/subcommands/run/command.go Outdated
System-probe already uses secretsnoopfx.Module() (the noop version of secrets), so it should use delegatedauthnoopfx.Module() for consistency. Delegated auth is designed to work with secrets to fetch API keys dynamically, which isn't applicable when secrets aren't supported.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@pgimalac pgimalac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks but LGTM !

defaultConfPath,
configOptions...,
)),
delegatedauthfx.Module(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something we'll want to improve later, I thought all commands used core.Bundle tbh

logfx.Module(),
ipcfx.ModuleReadOnly(),
otelagentStatusfx.Module(),
delegatedauthfx.Module(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command doesn't use secrets so I don't think it needs delegated auth

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by making it use delegatedauthnoopfx.Module(), but because the delegatedauth.Component is non-optional we do need to actually include the noop module.

Comment thread cmd/otel-agent/subcommands/run/command.go Outdated
Comment thread cmd/system-probe/subcommands/run/command.go
Comment thread comp/core/config/config.go
Comment thread comp/otelcol/otlp/integrationtest/integration_test.go Outdated
Comment thread pkg/config/setup/config.go Outdated
Comment thread pkg/config/setup/config.go
Comment thread pkg/config/setup/config.go Outdated
Comment on lines +46 to +47
registeredDelegatedAuthConfigs = make(map[string]string)
registeredDelegatedAuthConfigsMu sync.Mutex
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just use a sync map here ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sync.Map was considered but not used because the map is small, writes happen during initialization, and we need maps.Clone() for bulk reads which sync.Map doesn't support efficiently.

# Conflicts:
#	comp/otelcol/collector-contrib/impl/go.mod
#	comp/otelcol/ddflareextension/impl/go.mod
#	comp/otelcol/ddprofilingextension/impl/go.mod
#	comp/otelcol/otlp/components/exporter/datadogexporter/go.mod
#	comp/otelcol/otlp/components/exporter/datadogexporter/go.sum
#	comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod
#	comp/otelcol/otlp/components/exporter/serializerexporter/go.mod
#	comp/otelcol/otlp/components/exporter/serializerexporter/go.sum
#	go.mod
#	test/otel/go.mod
Copy link
Copy Markdown
Member

@L3n41c L3n41c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the file owned by @DataDog/container-integrations.

wynbennett and others added 4 commits March 4, 2026 14:36
# Conflicts:
#	comp/core/config/go.mod
#	comp/core/log/fx/go.mod
#	comp/core/log/impl-trace/go.mod
#	comp/core/log/impl/go.mod
#	comp/core/secrets/impl/go.mod
#	comp/otelcol/converter/impl/go.mod
#	comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod
#	comp/serializer/logscompression/go.mod
#	comp/serializer/metricscompression/go.mod
#	pkg/logs/client/go.mod
#	pkg/logs/pipeline/go.mod
#	pkg/logs/sender/go.mod
#	pkg/metrics/go.mod
#	pkg/util/compression/go.mod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.