I have a sagemaker pipeline and have manually created a sagemaker project in studio. I want to tag that pipeline to the project. It is mentioned in aws documentation that we can add tags to the pipeline for adding it to a domain. But I want to add the pipeline to specific project inside the domain. I want to do it manually and not via code commit.
Found the way to achieve the same. We have to add domain name and project name in the pipeline tags like shown below:
pipeline = Pipeline(
name='pipeline-test',
steps=[processing_step, training_step],
sagemaker_session=sm_session
)
tag_domain = {'Key': 'sagemaker:domain-arn', 'Value': '---'}
tag_project = {'Key': 'sagemaker:project-id', 'Value': '---'}
tag_project_name = {'Key': 'sagemaker:project-name', 'Value': '--'}
pipeline.upsert(role_arn=sm_role, tags = [tag_domain, tag_project, tag_project_name])
execution = pipeline.start()