If predefined system policies do not meet your requirements, you can create custom permission policies to follow the principle of least privilege. They provide fine-grained access control, improving the security of your resources. This topic describes use cases and provides example policies for IMM media transcoding tasks.
Custom permissions for a project service role
When you create an IMM project, you must assign a service role to it. This allows the IMM service to assume the role and access your resources in other cloud services, such as OSS.
Create a custom service role
Custom service role policy example
Read/write access to a specific OSS bucket
This RAM policy allows read and write operations on a bucket named my-bucket and allows publishing messages to an MNS topic named test-topic in the China (Shanghai) region.
Example parameters
The OSS resource uses the format acs:oss:*:*:<BucketName>/*. Replace the placeholders with your actual values based on the following parameter description:
Parameter | Description |
| The name of the OSS bucket. You can find the bucket name on the Buckets page of the OSS console. |
The MNS resource uses the format acs:mns:<RegionId>:<UID>:/topics/<TopicName>/messages. Replace the placeholders with your actual values based on the following parameter descriptions:
Parameter | Description |
| The region ID, such as |
| The account ID. You can find it on the Overview page of Account Center. |
| The name of the MNS topic. You can find the topic name on the Topics page of the MNS console. |
{
"Version": "1",
"Statement": [
{
"Action": [
"oss:GetObject",
"oss:PutObject"
],
"Resource": "acs:oss:*:*:my-bucket/*",
"Effect": "Allow"
},
{
"Action":"mns:PublishMessage",
"Resource": "acs:mns:cn-shanghai:150910xxxxxxxxxx:/topics/test-topic/messages",
"Effect": "Allow"
},
{
"Action": "ram:PassRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"acs:Service": "imm.aliyuncs.com"
}
}
}
]
}Custom IMM permissions for a RAM user
RAM provides a robust permission control mechanism. You can delegate access by creating RAM users with specific permissions. This ensures that even if a RAM user's AccessKey is compromised, your global resources remain secure.
Create and authorize a RAM user
Custom RAM user policy example
API access for a specific project
This RAM policy allows a user to call the CreateMediaConvertTask, ListTasks, and GetTask API operations of IMM only by using the project video-convert-project in the China (Shanghai) region.
Example parameters
The IMM resource uses the format acs:imm:<RegionId>:<UID>:project/<ProjectName>. Replace the placeholders with your actual values based on the following parameter descriptions:
Parameter | Description |
| The region ID, such as |
| The account ID. You can find it on the Overview page of Account Center. |
| The project name, which you specified when creating the project in IMM. You can find the name in the IMM console. |
The MNS resource uses the format acs:mns:<RegionId>:<UID>:/queues/<QueueName>/messages. Replace the placeholders with your actual values based on the following parameter descriptions:
Parameter | Description |
| The region ID, such as |
| The account ID. You can find it on the Overview page of Account Center. |
| The name of the MNS queue. You can find the queue name on the Queues page of the MNS console. |
{
"Version": "1",
"Statement": [
{
"Action": ["imm:CreateMediaConvertTask", "imm:ListTasks", "imm:GetTask"],
"Resource": "acs:imm:cn-shanghai:150910xxxxxxxxxx:project/video-convert-project",
"Effect": "Allow"
},
{
"Action": ["mns:ReceiveMessage", "mns:DeleteMessage"],
"Resource": "acs:mns:cn-shanghai:150910xxxxxxxxxx:/queues/test-queue/messages",
"Effect": "Allow"
}
]
}