Custom permission configuration for live transcoding

Updated at:

If system permission policies cannot meet your requirements, you can create custom policies to implement the principle of least privilege. Custom policies can help achieve fine-grained permission management and effectively improve resource access security. This topic describes scenarios and examples of custom policies for the live transcoding feature of Intelligent Media Management (IMM).

Grant custom permissions to a service role

When you create an IMM project, you must specify a service role for the project so that IMM can assume the role to access authorized resources in other Alibaba Cloud services, such as Object Storage Service (OSS).

Create a service role

  1. Create a regular service role. For more information, see Create a regular service role.

  2. Create a custom policy. For more information, see Create a custom policy.

    To use live transcoding of IMM, the following permissions must be granted to the service role:

    • Read and write permissions on OSS buckets. When you use live transcoding, the system needs to read source files from OSS buckets and then store the transcoded files to them.

    • Permissions used to allow IMM to assume the service role to access authorized resources in other Alibaba Cloud services, such as OSS.

  3. Grant permissions to the service role. For more information, see Manage permissions for a RAM role.

Sample policies

Grant the read and write permissions on a specific OSS bucket

The following RAM policy is used to grant a service role the read and write permissions on a bucket named my-bucket.

Parameter description

The Resource field in OSS is in the acs:oss:*:*:<BucketName>/* format. Replace the parameter with your actual rseource name.

Parameter

Description

BucketName

The name of the OSS bucket. You can view the name on the Buckets page in the OSS console.

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "oss:GetObject",
                "oss:PutObject"
            ],
            "Resource": "acs:oss:*:*:my-bucket/*",
            "Effect": "Allow"
        },
        {
            "Action": "ram:PassRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "acs:Service": "imm.aliyuncs.com"
                }
            }
        }
    ]
}

Grant custom permissions to a RAM user

RAM provides a persistent permission control mechanism by creating RAM users with different permissions. If the AccessKey pair of a RAM user is leaked, only limited information will be potentially exposed.

Create a RAM user and grant permissions to it

  1. Create a RAM user. For more information, see Create a RAM user.

  2. Create a custom policy. For more information, see Create a custom policy.

    To use live transcoding, the following permissions must be granted to the RAM user:

    • Permissions to call API operations related to live transcoding.

    • Permissions to read OSS objects and use IMM to process the objects.

  3. Grant permissions to the RAM user. For more information, see Manage RAM user permissions.

Sample policy

Grant the permissions to call API operations related to live transcoding in a specific project and use IMM to process objects in a specific bucket

The following RAM policy is used to grant a RAM user permissions to call the GenerateVideoPlaylist and LiveTranscoding operations in the video-process-project project in the China (Shanghai) region and use IMM to process objects in a bucket named my-bucket.

Important

Live transcoding is implemented using an IMM project bound to an OSS bucket. Therefore, you must grant the RAM user the permissions to call API operations related to the bound project.

Parameter description

The Resource field in OSS is in the acs:oss:*:*:<BucketName>/* format. Replace the parameter with your actual rseource name.

Parameter

Description

BucketName

The name of the OSS bucket. You can view the name on the Buckets page in the OSS console.

The Resource field in IMM is in the acs:imm:<RegionId>:<UID>:project/<ProjectName> format. Replace the parameters with your actual rseource names.

Parameter

Description

RegionId

The region ID. Examples: cn-shanghai and cn-beijing. You can view the ID corresponding to each region in the Endpoints topic.

UID

The account ID. You can view the ID on the Overview page of the Account Center.

ProjectName

The project name specified when you created the project. You can view the name in the IMM console.

The Resource field in Simple Message Queue (SMQ, formerly MNS) is in the acs:mns:<RegionId>:<UID>:/queues/<QueueName>/messages format. Replace the parameters with your actual rseource names.

Parameter

Description

RegionId

The region ID. Example: cn-shanghai and cn-beijing. You can view the ID corresponding to each region in the Endpoints topic.

UID

The account ID. You can view the ID on the Overview page of the Account Center.

QueueName

The name of the SMQ queue. You can view the name on the Queues page in the SMQ console.

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "oss:GetObject",
                "oss:PostProcessTask",
                "oss:ProcessImm"
            ],
            "Resource": "acs:oss:*:*:my-bucket/*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "imm:GenerateVideoPlaylist",
                "imm:LiveTranscoding"
            ],
            "Resource": "acs:imm:cn-shanghai:150910xxxxxxxxxx:project/video-process-project",
            "Effect": "Allow"
        }
    ]
}