Create a repository - CodeArtifact

Create a repository

You can create a repository using the CodeArtifact console or the AWS Command Line Interface (AWS CLI). When you create a repository, it does not contain any packages. Each repository is associated with the AWS account that you use when you create it. An AWS account can have up to 10000 repositories, for more information on CodeArtifact service limits, see Quotas in AWS CodeArtifact. You can delete repositories to make room for more.

A repository can have one or more CodeArtifact repositories associated with it as upstream repositories. This allows a package manager client to access the packages contained in more than one repository using a single URL endpoint. For more information, see Working with upstream repositories in CodeArtifact.

Note

After you create a repository, you cannot change its name, associated AWS account, or domain.

Create a repository (console)

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

  2. On the navigation pane, choose Repositories, and then choose Create repository.

  3. For Repository name, enter a name for your repository.

  4. (Optional) In Repository description, enter an optional description for your repository.

  5. (Optional) In Publish upstream repositories, add intermediate repositories that connect your repositories to package authorities such as Maven Central or npmjs.com.

  6. Choose Next.

  7. In AWS account, choose This AWS account if you are signed in to the account that owns the domain. Choose Different AWS account if another AWS account owns the domain.

  8. In Domain, choose the domain that the repository will be created in.

    If there are no domains in the account, you must create one. Enter the name for the new domain in Domain name.

    Expand Additional configuration.

    You must use a customer master key (CMK) to encrypt all assets in your domain. You can use an AWS managed CMK or a CMK that you manage:

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

    • Choose Customer managed key if you want to use a CMK that you manage. If you use a CMK that you manage, in Customer master key, choose the CMK.

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

  9. Choose Next.

  10. In Review and create, review what CodeArtifact is creating for you.

    • Package flow shows how your domain and repositories are connected.

    • Step 1: Create repository shows details about the repository and optional upstream repositories that will be created.

    • Step 2: Select domain shows details about my-domain.

    When you're ready, choose Create repository.

Create a repository (AWS CLI)

Use the create-repository command to create a repository in your domain.

aws codeartifact create-repository --domain my-domain --domain-owner domain-owner-id --repository my-repo --description "My new repository"

Example output:

{ "repository": { "name": "my-repo", "administratorAccount": "123456789012 "domainName": "my-domain", "domainOwner": "123456789012", "arn": "arn:aws:codeartifact:region-id:123456789012:repository/my-domain/my-repo", "description": "My new repository", "upstreams": "[]", "externalConnections"" "[]" } }

A new repository doesn't contain any packages. Each repository is associated with the AWS account that you're authenticated to when the repository is created. An AWS account can have a maximum of 100 repositories. Repositories that have been deleted with the delete-repository command don't count towards this limit.

Create a repository with tags

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

aws codeartifact create-repository --domain my-domain --domain-owner domain-owner-id --repository my-repo --tags key=k1,value=v1 key=k2,value=v2

Create a repository with an upstream repository

You can specify one or more upstream repositories when you create a repository.

aws codeartifact create-repository --domain my-domain --domain-owner domain-owner-id --repository my-repo \ --upstreams repositoryName=my-upstream-repo --repository-description "My new repository"

Example output:

{ "repository": { "name": "my-repo", "administratorAccount": "123456789012 "domainName": "my-domain", "domainOwner": "123456789012", "arn": "arn:aws:codeartifact:region-id:123456789012:repository/my-domain/my-repo", "description": "My new repository", "upstreams": [ { "repositoryName": "my-upstream-repo" } ], "externalConnections"" "[]" } }
Note

To create a repository with an upstream, you must have permission for the AssociateWithDownstreamRepository action on the upstream repository.

To add an upstream to a repository after it's been created, see Add, update, or remove upstream repositories (console) and Add, update, or remove upstream repositories (AWS CLI).