---
title: "Create an AWS integration"
method: POST
path: "/api/v2/integration/aws/accounts"
tags: ["AWS Integration"]
---

# Create an AWS integration

`POST /api/v2/integration/aws/accounts`

Create a new AWS Account Integration Config.

## Request body

- AWSAccountCreateRequest — AWS Account Create Request body.
  - `data` AWSAccountCreateRequestData, required — AWS Account Create Request data.
    - `attributes` AWSAccountCreateRequestAttributes, required — The AWS Account Integration Config to be created.
      - `account_tags` string[], nullable — Tags to apply to all hosts and metrics reporting for this account. Defaults to `[]`.
      - `auth_config` union, required — AWS Authentication config.
        - AWSAuthConfigKeys — AWS Authentication config to integrate your account using an access key pair.
          - `access_key_id` string, required — AWS Access Key ID.
          - `secret_access_key` string — AWS Secret Access Key.
        - AWSAuthConfigRole — AWS Authentication config to integrate your account using an IAM role.
          - `external_id` string — AWS IAM External ID for associated role.
          - `role_name` string, required — AWS IAM Role name.
      - `aws_account_id` string, required — AWS Account ID.
      - `aws_partition` 'aws' | 'aws-cn' | 'aws-us-gov', required — AWS partition your AWS account is scoped to. Defaults to `aws`. See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) in the AWS documentation for more information.
      - `aws_regions` union — AWS Regions to collect data from. Defaults to `include_all`.
        - AWSRegionsIncludeAll — Include all regions. Defaults to `true`.
          - `include_all` boolean, required — Include all regions.
        - AWSRegionsIncludeOnly — Include only these regions.
          - `include_only` string[], required — Include only these regions.
      - `logs_config` AWSLogsConfig — AWS Logs Collection config.
        - `lambda_forwarder` AWSLambdaForwarderConfig — Log Autosubscription configuration for Datadog Forwarder Lambda functions. Automatically set up triggers for existing and new logs for some services, ensuring no logs from new resources are missed and saving time spent on manual configuration.
          - `lambdas` string[] — List of Datadog Lambda Log Forwarder ARNs in your AWS account. Defaults to `[]`.
          - `log_source_config` AWSLambdaForwarderConfigLogSourceConfig — Log source configuration.
            - `tag_filters` AWSLogSourceTagFilter[] — List of AWS log source tag filters. Defaults to `[]`.
              - …
          - `sources` string[] — List of service IDs set to enable automatic log collection. Discover the list of available services with the [Get list of AWS log ready services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) endpoint.
      - `metrics_config` AWSMetricsConfig — AWS Metrics Collection config.
        - `automute_enabled` boolean — Enable EC2 automute for AWS metrics. Defaults to `true`.
        - `collect_cloudwatch_alarms` boolean — Enable CloudWatch alarms collection. Defaults to `false`.
        - `collect_custom_metrics` boolean — Enable custom metrics collection. Defaults to `false`.
        - `enabled` boolean — Enable AWS metrics collection. Defaults to `true`.
        - `metric_name_filters` AWSMetricNameFilters[] — AWS CloudWatch metric name filters. Each filter applies to a single namespace. Exactly one of `include_only` or `exclude_only` must be set on each filter.
          - union — AWS CloudWatch metric name filter for a single namespace. Exactly one of `include_only` or `exclude_only` must be set.
            - AWSMetricNameFiltersIncludeOnly — Include only metric names matching one of these patterns for a single namespace.
              - …
            - AWSMetricNameFiltersExcludeOnly — Exclude metric names matching one of these patterns for a single namespace.
              - …
        - `namespace_filters` union — AWS Metrics namespace filters. Defaults to `exclude_only`.
          - AWSNamespaceFiltersExcludeOnly — Exclude only these namespaces from metrics collection. Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default to reduce your AWS CloudWatch costs from `GetMetricData` API calls.
            - `exclude_only` string[], required — Exclude only these namespaces from metrics collection. Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default to reduce your AWS CloudWatch costs from `GetMetricData` API calls.
          - AWSNamespaceFiltersIncludeOnly — Include only these namespaces.
            - `include_only` string[], required — Include only these namespaces.
        - `tag_filters` AWSNamespaceTagFilter[] — AWS Metrics collection tag filters list. Defaults to `[]`.
          - `namespace` string — The AWS service for which the tag filters defined in `tags` will be applied.
          - `tags` string[], nullable — The AWS resource tags to filter on for the service specified by `namespace`.
      - `resources_config` AWSResourcesConfig — AWS Resources Collection config.
        - `cloud_security_posture_management_collection` boolean — Enable Cloud Security Management to scan AWS resources for vulnerabilities, misconfigurations, identity risks, and compliance violations. Defaults to `false`. Requires `extended_collection` to be set to `true`.
        - `extended_collection` boolean — Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Defaults to `true`. Required for `cloud_security_posture_management_collection`.
      - `traces_config` AWSTracesConfig — AWS Traces Collection config.
        - `xray_services` union — AWS X-Ray services to collect traces from. Defaults to `include_only`.
          - XRayServicesIncludeAll — Include all services.
            - `include_all` boolean, required — Include all services.
          - XRayServicesIncludeOnly, nullable — Include only these services. Defaults to `[]`.
            - `include_only` string[], required — Include only these services.
    - `type` 'account', required — AWS Account resource type.

## Response `200`

AWS Account object

- AWSAccountResponse — AWS Account response body.
  - `data` AWSAccountResponseData, required — AWS Account response data.
    - `attributes` AWSAccountResponseAttributes — AWS Account response attributes.
      - `account_tags` string[], nullable — Tags to apply to all hosts and metrics reporting for this account. Defaults to `[]`.
      - `auth_config` union — AWS Authentication config.
        - AWSAuthConfigKeys — AWS Authentication config to integrate your account using an access key pair.
          - `access_key_id` string, required — AWS Access Key ID.
          - `secret_access_key` string — AWS Secret Access Key.
        - AWSAuthConfigRole — AWS Authentication config to integrate your account using an IAM role.
          - `external_id` string — AWS IAM External ID for associated role.
          - `role_name` string, required — AWS IAM Role name.
      - `aws_account_id` string, required — AWS Account ID.
      - `aws_partition` 'aws' | 'aws-cn' | 'aws-us-gov' — AWS partition your AWS account is scoped to. Defaults to `aws`. See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) in the AWS documentation for more information.
      - `aws_regions` union — AWS Regions to collect data from. Defaults to `include_all`.
        - AWSRegionsIncludeAll — Include all regions. Defaults to `true`.
          - `include_all` boolean, required — Include all regions.
        - AWSRegionsIncludeOnly — Include only these regions.
          - `include_only` string[], required — Include only these regions.
      - `created_at` string, date-time — Timestamp of when the account integration was created.
      - `logs_config` AWSLogsConfig — AWS Logs Collection config.
        - `lambda_forwarder` AWSLambdaForwarderConfig — Log Autosubscription configuration for Datadog Forwarder Lambda functions. Automatically set up triggers for existing and new logs for some services, ensuring no logs from new resources are missed and saving time spent on manual configuration.
          - `lambdas` string[] — List of Datadog Lambda Log Forwarder ARNs in your AWS account. Defaults to `[]`.
          - `log_source_config` AWSLambdaForwarderConfigLogSourceConfig — Log source configuration.
            - `tag_filters` AWSLogSourceTagFilter[] — List of AWS log source tag filters. Defaults to `[]`.
              - …
          - `sources` string[] — List of service IDs set to enable automatic log collection. Discover the list of available services with the [Get list of AWS log ready services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) endpoint.
      - `metrics_config` AWSMetricsConfig — AWS Metrics Collection config.
        - `automute_enabled` boolean — Enable EC2 automute for AWS metrics. Defaults to `true`.
        - `collect_cloudwatch_alarms` boolean — Enable CloudWatch alarms collection. Defaults to `false`.
        - `collect_custom_metrics` boolean — Enable custom metrics collection. Defaults to `false`.
        - `enabled` boolean — Enable AWS metrics collection. Defaults to `true`.
        - `metric_name_filters` AWSMetricNameFilters[] — AWS CloudWatch metric name filters. Each filter applies to a single namespace. Exactly one of `include_only` or `exclude_only` must be set on each filter.
          - union — AWS CloudWatch metric name filter for a single namespace. Exactly one of `include_only` or `exclude_only` must be set.
            - AWSMetricNameFiltersIncludeOnly — Include only metric names matching one of these patterns for a single namespace.
              - …
            - AWSMetricNameFiltersExcludeOnly — Exclude metric names matching one of these patterns for a single namespace.
              - …
        - `namespace_filters` union — AWS Metrics namespace filters. Defaults to `exclude_only`.
          - AWSNamespaceFiltersExcludeOnly — Exclude only these namespaces from metrics collection. Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default to reduce your AWS CloudWatch costs from `GetMetricData` API calls.
            - `exclude_only` string[], required — Exclude only these namespaces from metrics collection. Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default to reduce your AWS CloudWatch costs from `GetMetricData` API calls.
          - AWSNamespaceFiltersIncludeOnly — Include only these namespaces.
            - `include_only` string[], required — Include only these namespaces.
        - `tag_filters` AWSNamespaceTagFilter[] — AWS Metrics collection tag filters list. Defaults to `[]`.
          - `namespace` string — The AWS service for which the tag filters defined in `tags` will be applied.
          - `tags` string[], nullable — The AWS resource tags to filter on for the service specified by `namespace`.
      - `modified_at` string, date-time — Timestamp of when the account integration was updated.
      - `resources_config` AWSResourcesConfig — AWS Resources Collection config.
        - `cloud_security_posture_management_collection` boolean — Enable Cloud Security Management to scan AWS resources for vulnerabilities, misconfigurations, identity risks, and compliance violations. Defaults to `false`. Requires `extended_collection` to be set to `true`.
        - `extended_collection` boolean — Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Defaults to `true`. Required for `cloud_security_posture_management_collection`.
      - `traces_config` AWSTracesConfig — AWS Traces Collection config.
        - `xray_services` union — AWS X-Ray services to collect traces from. Defaults to `include_only`.
          - XRayServicesIncludeAll — Include all services.
            - `include_all` boolean, required — Include all services.
          - XRayServicesIncludeOnly, nullable — Include only these services. Defaults to `[]`.
            - `include_only` string[], required — Include only these services.
    - `id` string, required — Unique Datadog ID of the AWS Account Integration Config. To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) endpoint and query by AWS Account ID.
    - `type` 'account', required — AWS Account resource type.

## Other responses

- `400` — Bad Request
- `403` — Forbidden
- `409` — Conflict
- `429` — Too many requests

---

[API](https://skmtc.net/datadog/apis/api-v2.md) · [All operations](https://skmtc.net/datadog/apis/api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datadog/api-v2/revisions/da68bf029e4c/schema)
