AWS Amazon SageMaker Code Repository

This page shows how to write Terraform and CloudFormation for Amazon SageMaker Code Repository and write them securely.

aws_sagemaker_code_repository (Terraform)

The Code Repository in Amazon SageMaker can be configured in Terraform with the resource name aws_sagemaker_code_repository. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

sagemaker.tf#L1
resource "aws_sagemaker_code_repository" "prm_gp2gp_data_sandbox" {
  code_repository_name = "prm-gp2gp-data-sandbox"

  git_config {
    repository_url = var.data_sandbox_url
  }
sagemaker_notebook.tf#L1
resource "aws_sagemaker_code_repository" "sagemaker-model-repository" {
  code_repository_name = "sagemaker-model-repository"

  git_config {
    repository_url = "https://github.com/ldynczuki/MLPlatformEngineer"
  }
git_repo.tf#L2
resource "aws_sagemaker_code_repository" "git_repo" {
  code_repository_name = "aws-sm-notebook-instance-repo"

  git_config {
    repository_url = "https://github.com/AndreasLuckert/aws-sm-notebook-instance.git"
  }
code-repo.tf#L1
resource "aws_sagemaker_code_repository" "repo" {
  count = var.default_code_repository != null ? 1 : 0
  code_repository_name = var.default_code_repository

  git_config {
    repository_url = var.repository_url
git_repo.tf#L2
resource "aws_sagemaker_code_repository" "git_repo" {
  code_repository_name = "aws-sm-notebook-instance-repo"

  git_config {
    repository_url = "https://github.com/AndreasLuckert/fraud-detection-using-terraform-and-sagemaker.git"
  }

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a Sagemaker Code Repository resource.

AWS::SageMaker::CodeRepository (CloudFormation)

The CodeRepository in SageMaker can be configured in CloudFormation with the resource name AWS::SageMaker::CodeRepository. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

Creates a Git repository as a resource in your Amazon 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 Amazon 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 AWS CodeCommit or in any other Git repository.

Frequently asked questions

What is AWS Amazon SageMaker Code Repository?

AWS Amazon SageMaker Code Repository is a resource for Amazon SageMaker of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon SageMaker Code Repository?

For Terraform, the nhsconnect/prm-gp2gp-data-sandbox-infra, ldynczuki/ml-platform-engineer and AndreasLuckert/aws-sm-notebook-instance source code examples are useful. See the Terraform Example section for further details.