

# Service endpoints for EBS direct APIs
<a name="using-endpoints"></a>

An *endpoint* is a URL that serves as an entry point for an Amazon web service. EBS direct APIs supports the following endpoint types:
+ IPv4 endpoints
+ Dual-stack endpoints that support both IPv4 and IPv6

When you make a request, you can specify the endpoint and Region to use. If you do not specify an endpoint, the IPv4 endpoint is used by default. To use a different endpoint type, you must specify it in your request. For examples of how to do this, see [Specifying endpoints](#examples).

For more information about Regions, see [ Regions and Availability Zones](https://docs.amazonaws.cn/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) in the *Amazon EC2 User Guide*. For a list of endpoints for EBS direct APIs, see [ Endpoints for the EBS direct APIs](https://docs.amazonaws.cn/general/latest/gr/ebs-service.html#ebs_direct_apis) in the *Amazon Web Services General Reference*.

**Topics**
+ [IPv4 endpoints](#ipv4)
+ [Dual-stack (IPv4 and IPv6) endpoints](#ipv6)
+ [Specifying endpoints](#examples)

## IPv4 endpoints
<a name="ipv4"></a>

IPv4 endpoints support IPv4 traffic only. IPv4 endpoints are available for all Regions.

EBS direct APIs supports only Regional IPv4 endpoints that you can use to make your requests. You must specify the Region as part of the endpoint name. The endpoint names use the following naming convention:
+ `ebs.region.amazonaws.com.cn`

For example, the IPv4 endpoint name for the Beijing Region is `ebs.cn-northwest-1.amazonaws.com.cn`.

**Pricing**  
You are not charged for data transferred directly between EBS direct APIs and Amazon EC2 instances using an IPv4 endpoint in the same Region. However, if there are intermediate services, such as Amazon PrivateLink endpoints, NAT Gateway, or Amazon VPC Transit Gateways, you are charged their associated costs.

## Dual-stack (IPv4 and IPv6) endpoints
<a name="ipv6"></a>

Dual-stack endpoints support both IPv4 and IPv6 traffic. Dual-stack endpoints are available for all Regions.

To use IPv6, you must use a dual-stack endpoint. When you make a request to a dual-stack endpoint, the endpoint URL resolves to an IPv6 or an IPv4 address, depending on the protocol used by your network and client.

EBS direct APIs supports only regional dual-stack endpoints, which means that you must specify the Region as part of the endpoint name. Dual-stack endpoint names use the following naming convention:
+ `ebs.region.api.amazonwebservices.com.cn`

For example, the dual-stack endpoint name for the Beijing Region is `ebs.cn-northwest-1.api.aws`.

**Pricing**  
You are not charged for data transferred directly between EBS direct APIs and Amazon EC2 instances using a dual-stack endpoint in the same Region. However, if there are intermediate services, such as Amazon PrivateLink endpoints, NAT Gateway, or Amazon VPC Transit Gateways, you are charged their associated costs.

## Specifying endpoints
<a name="examples"></a>

This section provides some examples of how to specify an endpoint when making a request.

------
#### [ Amazon CLI ]

The following examples show how to specify an endpoint for the Beijing Region using the Amazon CLI.
+ **Dual-stack**

  ```
  aws ebs list-snapshot-blocks --snapshot-id snap-0987654321 --starting-block-index 1000 --endpoint-url https://ebs.cn-northwest-1.api.amazonwebservices.com.cn
  ```
+ **IPv4**

  ```
  aws ebs list-snapshot-blocks --snapshot-id snap-0987654321 --starting-block-index 1000 --endpoint-url https://ebs.cn-northwest-1.amazonaws.com.cn
  ```

------
#### [ Amazon SDK for Java 2.x ]

The following examples show how to specify an endpoint for the Beijing Region using the Amazon SDK for Java 2.x.
+ **Dual-stack**

  ```
  AwsClientBuilder.EndpointConfiguration config = new AwsClientBuilder.EndpointConfiguration("https://ebs.cn-northwest-1.api.amazonwebservices.com.cn", "cn-northwest-1");
  AmazonEBS ebs = AmazonEBSClientBuilder.standard()
      .withEndpointConfiguration(config)
      .build();
  ```
+ **IPv4**

  ```
  AwsClientBuilder.EndpointConfiguration config = new AwsClientBuilder.EndpointConfiguration("https://ebs.cn-northwest-1.amazonaws.com.cn", "cn-northwest-1");
  AmazonEBS ebs = AmazonEBSClientBuilder.standard()
      .withEndpointConfiguration(config)
      .build();
  ```

------
#### [ Amazon SDK for Go ]

The following examples show how to specify an endpoint for the Beijing Region using the Amazon SDK for Go.
+ **Dual-stack**

  ```
  sess := session.Must(session.NewSession())
  svc := ebs.New(sess, &aws.Config{
      Region: aws.String(endpoints.CnNorth1RegionID),
      Endpoint: aws.String("https://ebs.cn-northwest-1.api.amazonwebservices.com.cn")
  })
  ```
+ **IPv4**

  ```
  sess := session.Must(session.NewSession())
  svc := ebs.New(sess, &aws.Config{
      Region: aws.String(endpoints.CnNorth1RegionID),
      Endpoint: aws.String("https://ebs.cn-northwest-1.amazonaws.com.cn")
  })
  ```

------