Create a domain - CodeArtifact

Create a domain

You can create a domain using the CodeArtifact console, the AWS Command Line Interface (AWS CLI), or AWS CloudFormation. When you create a domain, it does not contain any repositories. For more information, see Create a repository. For more information about managing CodeArtifact domains with CloudFormation, see Creating CodeArtifact resources with AWS CloudFormation.

Create a domain (console)

  1. Open the AWS CodeArtifact console at https://console.aws.amazon.com/codesuite/codeartifact/home.

  2. In the navigation pane, choose Domains, and then choose Create domain.

  3. In Name, enter a name for your domain.

  4. Expand Additional configuration.

  5. Use an AWS KMS key (KMS key) to encrypt all assets in your domain. You can use an AWS managed KMS key or a KMS key that you manage. For more information about the supported types of KMS keys in CodeArtifact, see Types of AWS KMS keys supported in CodeArtifact.

    • Choose AWS managed key if you want to use the default AWS managed key.

    • Choose Customer managed key if you want to use a KMS key that you manage. To use a KMS key that you manage, in Customer managed key ARN, search for and choose the KMS key.

    For more information, see AWS managed key and Customer managed key in the AWS Key Management Service Developer Guide.

  6. Choose Create domain.

Create a domain (AWS CLI)

To create a domain with the AWS CLI, use the create-domain command. You must use an AWS KMS key (KMS key) to encrypt all assets in your domain. You can use an AWS managed KMS key or a KMS key that you manage. If you use an AWS managed KMS key, do not use the --encryption-key parameter.

For more information about the supported types of KMS keys in CodeArtifact, see Types of AWS KMS keys supported in CodeArtifact. For more information about KMS keys, see AWS managed key and Customer managed key in the AWS Key Management Service Developer Guide.

aws codeartifact create-domain --domain my_domain

JSON-formatted data appears in the output with details about your new domain.

{ "domain": { "name": "my_domain", "owner": "111122223333", "arn": "arn:aws:codeartifact:us-west-2:111122223333:domain/my_domain", "status": "Active", "encryptionKey": "arn:aws:kms:us-west-2:111122223333:key/your-kms-key", "repositoryCount": 0, "assetSizeBytes": 0, "createdTime": "2020-10-12T16:51:18.039000-04:00" } }

If you use a KMS key that you manage, include its Amazon Resource Name (ARN) with the --encryption-key parameter.

aws codeartifact create-domain --domain my_domain --encryption-key arn:aws:kms:us-west-2:111122223333:key/your-kms-key

JSON-formatted data appears in the output with details about your new domain.

{ "domain": { "name": "my_domain", "owner": "111122223333", "arn": "arn:aws:codeartifact:us-west-2:111122223333:domain/my_domain", "status": "Active", "encryptionKey": "arn:aws:kms:us-west-2:111122223333:key/your-kms-key", "repositoryCount": 0, "assetSizeBytes": 0, "createdTime": "2020-10-12T16:51:18.039000-04:00" } }

Create a domain with tags

To create a domain with tags, add the --tags parameter to your create-domain command.

aws codeartifact create-domain --domain my_domain --tags key=k1,value=v1 key=k2,value=v2