This topic describes how to call the ModifyImageSharePermission operation by using Alibaba Cloud CLI to manage the share permission of an image.

Background information

After you share a custom image with another Alibaba Cloud account, the account owner can use the shared image to create ECS instances (RunInstances) or replace the system disk of an ECS instance (ReplaceSystemDisk). We recommend that you read the description of the operation before you call the operation. For more information, see ModifyImageSharePermission.

When you call an API operation through Alibaba Cloud CLI, make sure that request parameter values of different data types are in required formats. For more information, see Parameter format overview.

Request examples

  1. Call the DescribeImages operation to query the ID of the image that you want to share. For more information, see DescribeImages.
    In this example, the image name is used to query the ID of the image.
    aliyun ecs DescribeImages --RegionId cn-hangzhou --ImageName demoName --output cols=Images.Image[].ImageId
    Sample response:
  2. Share the image with another Alibaba Cloud account.
    aliyun ecs ModifyImageSharePermission --RegionId cn-hangzhou --ImageId m-bp1503ydxxrppctb**** --AddAccount.1 1234567890