Skip to content

(sagemaker): Add L2 construct for ModelPackageGroup #53

@bweigel

Description

@bweigel

Is your feature request related to a problem? Please describe.

Currently, managing SageMaker Model Package Groups with AWS CDK requires the use of lower-level (L1) constructs, adding complexity to CDK code. By introducing an L2 construct, developers can more easily interact with and manage Model Package Groups, which are essential in MLOps workflows for storing, versioning, and sharing machine learning models.

Would you be willing to help with a PR?

  • Yes, absolutely
  • Yes, with some guidance
  • Unfortunately no time :'-(

Describe the solution you'd like

I propose the creation of L2 construct to manage ModelPackageGroup resources.

Features could include:

  • permissions management using grant, also cross account access possibilities

Additional context

ℹ️ This is basically created with AI, from the API.md of the constructs we use internally.

The ModelPackageGroup L2 construct will define the properties and methods needed to manage a SageMaker Model Package Group. It will allow the ability to manage access policies and permissions.

ModelPackageGroup Construct

  • Implements: IModelPackageGroup
  • Properties:
    • modelPackageGroupName (string, required): Name of the SageMaker Model Package
    • description (string, optional): A description for the model package group.
    • modelPackageGroupArn (string): Returns the ARN of the model package group.
    • creationTime (string, optional): The creation time of the model package group.
    • status (string, optional): Status of the model package group.
  • Methods:
    • grantAccess(grantee: IGrantable): Grants read access to the model package group to the specified IAM principal (e.g. role, user, group).
    • addToResourcePolicy(statement: PolicyStatement): Adds a statement to the resource policy for controlling access to the model package group.
  • Static Methods:
    • fromModelPackageGroupArn(scope: Construct, id: string, modelPackageGroupArn: string): Imports an existing Model Package Group using its ARN.
    • fromModelPackageGroupName(scope: Construct, id: string, modelPackageGroupName: string): Imports an existing Model Package Group using its name.

Usage example

const modelPackageGroup = new ModelPackageGroup(this, 'MyModelPackageGroup', {
  modelPackageGroupName: 'MyModelGroup',
  description: 'A group for versioning my machine learning models',
});

const role = new iam.Role(this, 'myrole', ...);

// Grant SageMaker role access to the model package group
modelPackageGroup.grantAccess(role);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions