CreateDomainNameCommand

Creates a domain name.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ApiGatewayV2Client, CreateDomainNameCommand } from "@aws-sdk/client-apigatewayv2"; // ES Modules import
// const { ApiGatewayV2Client, CreateDomainNameCommand } = require("@aws-sdk/client-apigatewayv2"); // CommonJS import
const client = new ApiGatewayV2Client(config);
const input = { // CreateDomainNameRequest
  DomainName: "STRING_VALUE", // required
  DomainNameConfigurations: [ // DomainNameConfigurations
    { // DomainNameConfiguration
      ApiGatewayDomainName: "STRING_VALUE",
      CertificateArn: "STRING_VALUE",
      CertificateName: "STRING_VALUE",
      CertificateUploadDate: new Date("TIMESTAMP"),
      DomainNameStatus: "AVAILABLE" || "UPDATING" || "PENDING_CERTIFICATE_REIMPORT" || "PENDING_OWNERSHIP_VERIFICATION",
      DomainNameStatusMessage: "STRING_VALUE",
      EndpointType: "REGIONAL" || "EDGE",
      HostedZoneId: "STRING_VALUE",
      IpAddressType: "ipv4" || "dualstack",
      SecurityPolicy: "TLS_1_0" || "TLS_1_2",
      OwnershipVerificationCertificateArn: "STRING_VALUE",
    },
  ],
  MutualTlsAuthentication: { // MutualTlsAuthenticationInput
    TruststoreUri: "STRING_VALUE",
    TruststoreVersion: "STRING_VALUE",
  },
  Tags: { // Tags
    "<keys>": "STRING_VALUE",
  },
};
const command = new CreateDomainNameCommand(input);
const response = await client.send(command);
// { // CreateDomainNameResponse
//   ApiMappingSelectionExpression: "STRING_VALUE",
//   DomainName: "STRING_VALUE",
//   DomainNameConfigurations: [ // DomainNameConfigurations
//     { // DomainNameConfiguration
//       ApiGatewayDomainName: "STRING_VALUE",
//       CertificateArn: "STRING_VALUE",
//       CertificateName: "STRING_VALUE",
//       CertificateUploadDate: new Date("TIMESTAMP"),
//       DomainNameStatus: "AVAILABLE" || "UPDATING" || "PENDING_CERTIFICATE_REIMPORT" || "PENDING_OWNERSHIP_VERIFICATION",
//       DomainNameStatusMessage: "STRING_VALUE",
//       EndpointType: "REGIONAL" || "EDGE",
//       HostedZoneId: "STRING_VALUE",
//       IpAddressType: "ipv4" || "dualstack",
//       SecurityPolicy: "TLS_1_0" || "TLS_1_2",
//       OwnershipVerificationCertificateArn: "STRING_VALUE",
//     },
//   ],
//   MutualTlsAuthentication: { // MutualTlsAuthentication
//     TruststoreUri: "STRING_VALUE",
//     TruststoreVersion: "STRING_VALUE",
//     TruststoreWarnings: [ // __listOf__string
//       "STRING_VALUE",
//     ],
//   },
//   Tags: { // Tags
//     "<keys>": "STRING_VALUE",
//   },
// };

CreateDomainNameCommand Input

See CreateDomainNameCommandInput for more details

Parameter
Type
Description
DomainName
Required
string | undefined

The domain name.

DomainNameConfigurations
DomainNameConfiguration[] | undefined

The domain name configurations.

MutualTlsAuthentication
MutualTlsAuthenticationInput | undefined

The mutual TLS authentication configuration for a custom domain name.

Tags
Record<string, string> | undefined

The collection of tags associated with a domain name.

CreateDomainNameCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ApiMappingSelectionExpression
string | undefined

The API mapping selection expression.

DomainName
string | undefined

The name of the DomainName resource.

DomainNameConfigurations
DomainNameConfiguration[] | undefined

The domain name configurations.

MutualTlsAuthentication
MutualTlsAuthentication | undefined

The mutual TLS authentication configuration for a custom domain name.

Tags
Record<string, string> | undefined

The collection of tags associated with a domain name.

Throws

Name
Fault
Details
AccessDeniedException
client
BadRequestException
client

The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

ConflictException
client

The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

NotFoundException
client

The resource specified in the request was not found. See the message field for more information.

TooManyRequestsException
client

A limit has been exceeded. See the accompanying error message for details.

ApiGatewayV2ServiceException
Base exception class for all service exceptions from ApiGatewayV2 service.