CreateDomain - AWS CodeArtifact

CreateDomain

Creates a domain. CodeArtifact domains make it easier to manage multiple repositories across an organization. You can use a domain to apply permissions across many repositories owned by different AWS accounts. An asset is stored only once in a domain, even if it's in multiple repositories.

Although you can have multiple domains, we recommend a single production domain that contains all published artifacts so that your development teams can find and share packages. You can use a second pre-production domain to test changes to the production domain configuration.

Request Syntax

POST /v1/domain?domain=domain HTTP/1.1 Content-type: application/json { "encryptionKey": "string", "tags": [ { "key": "string", "value": "string" } ] }

URI Request Parameters

The request uses the following URI parameters.

domain

The name of the domain to create. All domain names in an AWS Region that are in the same AWS account must be unique. The domain name is used as the prefix in DNS hostnames. Do not use sensitive information in a domain name because it is publicly discoverable.

Length Constraints: Minimum length of 2. Maximum length of 50.

Pattern: [a-z][a-z0-9\-]{0,48}[a-z0-9]

Required: Yes

Request Body

The request accepts the following data in JSON format.

encryptionKey

The encryption key for the domain. This is used to encrypt content stored in a domain. An encryption key can be a key ID, a key Amazon Resource Name (ARN), a key alias, or a key alias ARN. To specify an encryptionKey, your IAM role must have kms:DescribeKey and kms:CreateGrant permissions on the encryption key that is used. For more information, see DescribeKey in the AWS Key Management Service API Reference and AWS Key Management Service API Permissions Reference in the AWS Key Management Service Developer Guide.

Important

CodeArtifact supports only symmetric CMKs. Do not associate an asymmetric CMK with your domain. For more information, see Using symmetric and asymmetric keys in the AWS Key Management Service Developer Guide.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1011.

Pattern: \S+

Required: No

tags

One or more tag key-value pairs for the domain.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "domain": { "arn": "string", "assetSizeBytes": number, "createdTime": number, "encryptionKey": "string", "name": "string", "owner": "string", "repositoryCount": number, "s3BucketArn": "string", "status": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

domain

Contains information about the created domain after processing the request.

Type: DomainDescription object

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

The operation did not succeed because of an unauthorized access attempt.

HTTP Status Code: 403

ConflictException

The operation did not succeed because prerequisites are not met.

HTTP Status Code: 409

InternalServerException

The operation did not succeed because of an error that occurred inside AWS CodeArtifact.

HTTP Status Code: 500

ResourceNotFoundException

The operation did not succeed because the resource requested is not found in the service.

HTTP Status Code: 404

ServiceQuotaExceededException

The operation did not succeed because it would have exceeded a service limit for your account.

HTTP Status Code: 402

ThrottlingException

The operation did not succeed because too many requests are sent to the service.

HTTP Status Code: 429

ValidationException

The operation did not succeed because a parameter in the request was sent with an invalid value.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: