Store SageMaker Canvas application data in your own SageMaker space - Amazon SageMaker
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Store SageMaker Canvas application data in your own SageMaker space

Your Amazon SageMaker Canvas application data, such as datasets that you import and your model artifacts, is stored in a Amazon SageMaker Studio private space. The space consists of a storage volume for your application data with 100 GB of storage per user profile, the type of the space (in this case, a Canvas application), and the image for your application's container. When you set up Canvas and launch your application for the first time, SageMaker creates a default private space that is assigned to your user profile and stores your Canvas data. You don't have to do any additional configuration to set up the space because SageMaker automatically creates the space on your behalf.

However, if you don't want to use the default space, you have the option to specify a space that you created yourself. This can be useful if you want to isolate your data. The following page shows you how to create and configure your own Studio space for storing Canvas application data.

Note

You can only configure a custom Studio space for new Canvas applications. You can't modify the space configuration for existing Canvas applications.

Create a new space

First, create a new Studio space that is configured to store Canvas application data. This is the space that you specify when creating a new Canvas application in the next step.

To create a space, you can use the Amazon SDK for Python (Boto3) or the Amazon CLI.

SDK for Python (Boto3)

The following example shows you how to use the Amazon SDK for Python (Boto3) create_space method to create a space that you can use for Canvas applications. Make sure to specify these parameters:

  • DomainId: Specify the ID for your SageMaker domain. To find your ID, you can go to the SageMaker console at https://console.amazonaws.cn/sagemaker/ and locate your domain in the Domains section.

  • SpaceName: Specify a name for the new space.

  • EbsVolumeSizeinGb: Specify the storage volume size for your space (in GB). The minimum value is 5 and the maximum is 16384.

  • SharingType: Specify this field as Private. For more information, see Amazon SageMaker Studio spaces.

  • OwnerUserProfileName: Specify the user profile name. To find user profile names associated with a domain, you can go to the SageMaker console at https://console.amazonaws.cn/sagemaker/ and locate your domain in the Domains section. In the domain's settings, you can view the user profiles.

  • AppType: Specify this field as Canvas.

response = client.create_space( DomainId='<your-domain-id>', SpaceName='<your-new-space-name>', SpaceSettings={ 'AppType': 'Canvas', 'SpaceStorageSettings': { 'EbsStorageSettings': { 'EbsVolumeSizeInGb': <storage-volume-size> } }, }, OwnershipSettings={ 'OwnerUserProfileName': '<your-user-profile>' }, SpaceSharingSettings={ 'SharingType': 'Private' } )
Amazon CLI

The following example shows you how to use the Amazon CLI create-space method to create a space that you can use for Canvas applications. Make sure to specify these parameters:

  • domain-id: Specify the ID for your domain. To find your ID, you can go to the SageMaker console at https://console.amazonaws.cn/sagemaker/ and locate your domain in the Domains section.

  • space-name: Specify a name for the new space.

  • EbsVolumeSizeinGb: Specify the storage volume size for your space (in GB). The minimum value is 5 and the maximum is 16384.

  • SharingType: Specify this field as Private. For more information, see Amazon SageMaker Studio spaces.

  • OwnerUserProfileName: Specify the user profile name. To find user profile names associated with a domain, you can go to the SageMaker console at https://console.amazonaws.cn/sagemaker/ and locate your domain in the Domains section. In the domain's settings, you can view the user profiles.

  • AppType: Specify this field as Canvas.

create-space --domain-id <your-domain-id> --space-name <your-new-space-name> --space-settings '{ "AppType": "Canvas", "SpaceStorageSettings": { "EbsStorageSettings": {"EbsVolumeSizeInGb": <storage-volume-size>} }, }' --ownership-settings '{"OwnerUserProfileName": "<your-user-profile>"}' --space-sharing-settings '{"SharingType": "Private"}'

You should now have a space. Keep track of your space's name for the next step.

Create a new Canvas application

After creating a space, create a new Canvas application that specifies the space as its storage location.

To create a new Canvas application, you can use the Amazon SDK for Python (Boto3) or the Amazon CLI.

Important

You must use the Amazon SDK for Python (Boto3) or the Amazon CLI to create your Canvas application. Specifying a custom space when creating Canvas applications through the SageMaker console isn't supported.

SDK for Python (Boto3)

The following example shows you how to use the Amazon SDK for Python (Boto3) create_app method to create a new Canvas application. Make sure to specify these parameters:

  • DomainId: Specify the ID for your SageMaker domain.

  • SpaceName: Specify the name of the space that you created in the previous step.

  • AppType: Specify this field as Canvas.

  • AppName: Specify default as the app name.

response = client.create_app( DomainId='<your-domain-id>', SpaceName='<your-space-name>', AppType='Canvas', AppName='default' )
Amazon CLI

The following example shows you how to use the Amazon CLI create-app method to create a new Canvas application. Make sure to specify these parameters:

  • DomainId: Specify the ID for your SageMaker domain.

  • SpaceName: Specify the name of the space that you created in the previous step.

  • AppType: Specify this field as Canvas.

  • AppName: Specify default as the app name.

create-app --domain-id <your-domain-id> --space-name <your-space-name> --app-type Canvas --app-name default

You should now have a new Canvas application that uses a custom Studio space as the storage location for application data.

Important

Any time you delete the Canvas application (or log out) and have to re-create the application, you must provide your space in the SpaceName field to make sure that Canvas uses your space.

The space is attached to the user profile you specified in the space configuration. You can delete your Canvas application without deleting the space, and the data stored in the space remains. The data stored in your space is only deleted if you delete your user profile, or if you directly delete the space.