create_code_repository

create_code_repository(**kwargs)

Creates a Git repository as a resource in your SageMaker account. You can associate the repository with notebook instances so that you can use Git source control for the notebooks you create. The Git repository is a resource in your SageMaker account, so it can be associated with more than one notebook instance, and it persists independently from the lifecycle of any notebook instances it is associated with.

The repository can be hosted either in Amazon Web Services CodeCommit or in any other Git repository.

See also: AWS API Documentation

Request Syntax

response = client.create_code_repository(
    CodeRepositoryName='string',
    GitConfig={
        'RepositoryUrl': 'string',
        'Branch': 'string',
        'SecretArn': 'string'
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters
  • CodeRepositoryName (string) --

    [REQUIRED]

    The name of the Git repository. The name must have 1 to 63 characters. Valid characters are a-z, A-Z, 0-9, and - (hyphen).

  • GitConfig (dict) --

    [REQUIRED]

    Specifies details about the repository, including the URL where the repository is located, the default branch, and credentials to use to access the repository.

    • RepositoryUrl (string) -- [REQUIRED]

      The URL where the Git repository is located.

    • Branch (string) --

      The default branch for the Git repository.

    • SecretArn (string) --

      The Amazon Resource Name (ARN) of the Amazon Web Services Secrets Manager secret that contains the credentials used to access the git repository. The secret must have a staging label of AWSCURRENT and must be in the following format:

      {"username": UserName, "password": Password}
  • Tags (list) --

    An array of key-value pairs. You can use tags to categorize your Amazon Web Services resources in different ways, for example, by purpose, owner, or environment. For more information, see Tagging Amazon Web Services Resources.

    • (dict) --

      A tag object that consists of a key and an optional value, used to manage metadata for SageMaker Amazon Web Services resources.

      You can add tags to notebook instances, training jobs, hyperparameter tuning jobs, batch transform jobs, models, labeling jobs, work teams, endpoint configurations, and endpoints. For more information on adding tags to SageMaker resources, see AddTags.

      For more information on adding metadata to your Amazon Web Services resources with tagging, see Tagging Amazon Web Services resources. For advice on best practices for managing Amazon Web Services resources with tagging, see Tagging Best Practices: Implement an Effective Amazon Web Services Resource Tagging Strategy.

      • Key (string) -- [REQUIRED]

        The tag key. Tag keys must be unique per resource.

      • Value (string) -- [REQUIRED]

        The tag value.

Return type

dict

Returns

Response Syntax

{
    'CodeRepositoryArn': 'string'
}

Response Structure

  • (dict) --

    • CodeRepositoryArn (string) --

      The Amazon Resource Name (ARN) of the new repository.