---
title: "POST /targetgroups"
method: POST
path: "/targetgroups"
---

# POST /targetgroups

`POST /targetgroups`

Creates a target group. A target group is a collection of targets, or compute resources, that run your application or service. A target group can only be used by a single service.

For more information, see [Target groups](https://docs.aws.amazon.com/vpc-lattice/latest/ug/target-groups.html) in the _Amazon VPC Lattice User Guide_.

## Request body

- object
  - `name` string, required — The name of the target group. The name must be unique within the account. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen.
  - `type` 'IP' | 'LAMBDA' | 'INSTANCE' | 'ALB', required — The type of target group.
  - `config` object — <p>Describes the configuration of a target group.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/vpc-lattice/latest/ug/target-groups.html">Target groups</a> in the <i>Amazon VPC Lattice User Guide</i>.</p>
    - `port` integer — The port on which the targets are listening. For HTTP, the default is 80. For HTTPS, the default is 443. Not supported if the target group type is <code>LAMBDA</code>.
    - `protocol` 'HTTP' | 'HTTPS' | 'TCP' — The protocol to use for routing traffic to the targets. The default is the protocol of the target group. Not supported if the target group type is <code>LAMBDA</code>.
    - `protocolVersion` 'HTTP1' | 'HTTP2' | 'GRPC' — The protocol version. The default is <code>HTTP1</code>. Not supported if the target group type is <code>LAMBDA</code>.
    - `ipAddressType` 'IPV4' | 'IPV6' — The type of IP address used for the target group. Supported only if the target group type is <code>IP</code>. The default is <code>IPV4</code>.
    - `vpcIdentifier` string — The ID of the VPC. Not supported if the target group type is <code>LAMBDA</code>.
    - `healthCheck` object — The health check configuration. Not supported if the target group type is <code>LAMBDA</code> or <code>ALB</code>.
      - `enabled` boolean — Indicates whether health checking is enabled.
      - `protocol` 'HTTP' | 'HTTPS' | 'TCP' — The protocol used when performing health checks on targets. The possible protocols are <code>HTTP</code> and <code>HTTPS</code>. The default is <code>HTTP</code>.
      - `protocolVersion` 'HTTP1' | 'HTTP2' — The protocol version used when performing health checks on targets. The possible protocol versions are <code>HTTP1</code> and <code>HTTP2</code>.
      - `port` integer — The port used when performing health checks on targets. The default setting is the port that a target receives traffic on.
      - `path` string — The destination for health checks on the targets. If the protocol version is <code>HTTP/1.1</code> or <code>HTTP/2</code>, specify a valid URI (for example, <code>/path?query</code>). The default path is <code>/</code>. Health checks are not supported if the protocol version is <code>gRPC</code>, however, you can choose <code>HTTP/1.1</code> or <code>HTTP/2</code> and specify a valid URI.
      - `healthCheckIntervalSeconds` integer — The approximate amount of time, in seconds, between health checks of an individual target. The range is 5–300 seconds. The default is 30 seconds.
      - `healthCheckTimeoutSeconds` integer — The amount of time, in seconds, to wait before reporting a target as unhealthy. The range is 1–120 seconds. The default is 5 seconds.
      - `healthyThresholdCount` integer — The number of consecutive successful health checks required before considering an unhealthy target healthy. The range is 2–10. The default is 5.
      - `unhealthyThresholdCount` integer — The number of consecutive failed health checks required before considering a target unhealthy. The range is 2–10. The default is 2.
      - `matcher` object — The codes to use when checking for a successful response from a target.
        - `httpCode` string — The HTTP code to use when checking for a successful response from a target.
    - `lambdaEventStructureVersion` 'V1' | 'V2' — The version of the event structure that your Lambda function receives. Supported only if the target group type is <code>LAMBDA</code>. The default is <code>V1</code>.
  - `clientToken` string — A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token and parameters, the retry succeeds without performing any actions. If the parameters aren't identical, the retry fails.
  - `tags` object — The tags for the target group.

## Response `201`

Success

- CreateTargetGroupResponse
  - `id` string — The ID of the target group.
  - `arn` string — The Amazon Resource Name (ARN) of the target group.
  - `name` string — The name of the target group.
  - `type` 'IP' | 'LAMBDA' | 'INSTANCE' | 'ALB' — The type of target group.
  - `config` object — The target group configuration.
    - `port` integer — The port on which the targets are listening. For HTTP, the default is 80. For HTTPS, the default is 443. Not supported if the target group type is <code>LAMBDA</code>.
    - `protocol` 'HTTP' | 'HTTPS' | 'TCP' — The protocol to use for routing traffic to the targets. The default is the protocol of the target group. Not supported if the target group type is <code>LAMBDA</code>.
    - `protocolVersion` 'HTTP1' | 'HTTP2' | 'GRPC' — The protocol version. The default is <code>HTTP1</code>. Not supported if the target group type is <code>LAMBDA</code>.
    - `ipAddressType` 'IPV4' | 'IPV6' — The type of IP address used for the target group. Supported only if the target group type is <code>IP</code>. The default is <code>IPV4</code>.
    - `vpcIdentifier` string — The ID of the VPC. Not supported if the target group type is <code>LAMBDA</code>.
    - `healthCheck` object — The health check configuration. Not supported if the target group type is <code>LAMBDA</code> or <code>ALB</code>.
      - `enabled` boolean — Indicates whether health checking is enabled.
      - `protocol` 'HTTP' | 'HTTPS' | 'TCP' — The protocol used when performing health checks on targets. The possible protocols are <code>HTTP</code> and <code>HTTPS</code>. The default is <code>HTTP</code>.
      - `protocolVersion` 'HTTP1' | 'HTTP2' — The protocol version used when performing health checks on targets. The possible protocol versions are <code>HTTP1</code> and <code>HTTP2</code>.
      - `port` integer — The port used when performing health checks on targets. The default setting is the port that a target receives traffic on.
      - `path` string — The destination for health checks on the targets. If the protocol version is <code>HTTP/1.1</code> or <code>HTTP/2</code>, specify a valid URI (for example, <code>/path?query</code>). The default path is <code>/</code>. Health checks are not supported if the protocol version is <code>gRPC</code>, however, you can choose <code>HTTP/1.1</code> or <code>HTTP/2</code> and specify a valid URI.
      - `healthCheckIntervalSeconds` integer — The approximate amount of time, in seconds, between health checks of an individual target. The range is 5–300 seconds. The default is 30 seconds.
      - `healthCheckTimeoutSeconds` integer — The amount of time, in seconds, to wait before reporting a target as unhealthy. The range is 1–120 seconds. The default is 5 seconds.
      - `healthyThresholdCount` integer — The number of consecutive successful health checks required before considering an unhealthy target healthy. The range is 2–10. The default is 5.
      - `unhealthyThresholdCount` integer — The number of consecutive failed health checks required before considering a target unhealthy. The range is 2–10. The default is 2.
      - `matcher` object — The codes to use when checking for a successful response from a target.
        - `httpCode` string — The HTTP code to use when checking for a successful response from a target.
    - `lambdaEventStructureVersion` 'V1' | 'V2' — The version of the event structure that your Lambda function receives. Supported only if the target group type is <code>LAMBDA</code>. The default is <code>V1</code>.
  - `status` 'CREATE_IN_PROGRESS' | 'ACTIVE' | 'DELETE_IN_PROGRESS' | 'CREATE_FAILED' | 'DELETE_FAILED' — The status. You can retry the operation if the status is <code>CREATE_FAILED</code>. However, if you retry it while the status is <code>CREATE_IN_PROGRESS</code>, there is no change in the status.

## Other responses

- `480` — ValidationException
- `481` — AccessDeniedException
- `482` — ConflictException
- `483` — ResourceNotFoundException
- `484` — ThrottlingException
- `485` — ServiceQuotaExceededException
- `486` — InternalServerException

---

[API](https://skmtc.net/aws/apis/vpc-lattice.md) · [All operations](https://skmtc.net/aws/apis/vpc-lattice/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/vpc-lattice/versions/bbec5439e0f7/schema)
