You can call this operation to grant a permission on an elastic network interface (ENI) to an Alibaba Cloud partner (a certified ISV) or an individual user.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates a sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesCreateNetworkInterfacePermission

The operation that you want to perform. Set the value to CreateNetworkInterfacePermission.

RegionIdStringYescn-hangzhou

The region ID of the ENI. You can call the DescribeRegions operation to query the most recent region list.

NetworkInterfaceIdStringYeseni-bp14v2sdd3v8htln****

The ID of the ENI.

PermissionStringYesInstanceAttach

The permission on the ENI. Valid values:

InstanceAttach: allows authorized users to attach the ENI to an ECS instance. The ENI and the ECS instance must be in the same zone.

AccountIdLongYes1234567890

The ID of the Alibaba Cloud partner (a certified ISV) or individual user.

Response parameters

ParameterTypeExampleDescription
NetworkInterfacePermissionStruct

Details about the permission on the ENI.

AccountIdLong1234567890

The ID of the Alibaba Cloud partner (a certified ISV).

NetworkInterfaceIdStringeni-bp14v2sdd3v8htln****

The ID of the ENI.

NetworkInterfacePermissionIdStringeni-perm-bp1cs4lwn56lfb****

The ID of the permission on the ENI.

PermissionStringInstanceAttach

The permission on the ENI.

PermissionStateStringGranted

The status of the permission on the ENI. Valid values:

  • Pending: The permission is being granted.
  • Granted: The permission has been granted.
  • Revoking: The permission is being revoked.
  • Revoked: The permission has been revoked.
ServiceNameStringElastic Compute Service

The name of the Alibaba Cloud service.

RequestIdString0FCD3DEF-63D3-4605-A818-805C8BD7DB87

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=CreateNetworkInterfacePermission
&AccountId=1234567890
&RegionId=cn-hangzhou
&NetworkInterfaceId=eni-bp14v2sdd3v8htln****
&Permission=InstanceAttach
&<Common request parameters>

Sample success responses

XML format

<CreateNetworkInterfacePermissionResponse>
      <RequestId>0FCD3DEF-63D3-4605-A818-805C8BD7DB87</RequestId>
      <NetworkInterfacePermission>
            <PermissionState>Granted</PermissionState>
            <Permission>InstanceAttach</Permission>
            <AccountId>1234567890</AccountId>
            <NetworkInterfacePermissionId>eni-perm-bp1cs4lwn56lfb****</NetworkInterfacePermissionId>
            <NetworkInterfaceId>eni-bp14v2sdd3v8htln****</NetworkInterfaceId>
            <ServiceName>Elastic Compute Service</ServiceName>
      </NetworkInterfacePermission>
</CreateNetworkInterfacePermissionResponse>

JSON format

{
    "RequestId": "0FCD3DEF-63D3-4605-A818-805C8BD7DB87",
    "NetworkInterfacePermission": {
        "PermissionState": "Granted",
        "Permission": "InstanceAttach",
        "AccountId": "1234567890",
        "NetworkInterfacePermissionId": "eni-perm-bp1cs4lwn56lfb****",
        "NetworkInterfaceId": "eni-bp14v2sdd3v8htln****",
        "ServiceName": "Elastic Compute Service"
    }
}

Error codes

HTTP status codeError codeError messageDescription
403InvalidUserType.NotSupported%sThe error message returned because your account does not support this operation.
403Abs.InvalidAccount.NotFound%sThe error message returned because your Alibaba Cloud account does not exist or your AccessKey pair has expired.
400MissingParameter%sThe error message returned because a required parameter is not specified.
403Forbidden.NotSupportRAM%sThe error message returned because RAM users are not authorized to perform this operation.
400UnsupportedParameter%sThe error message returned because a specified parameter is not supported.
403Forbidden.SubUser%sThe error message returned because you are not authorized to manage the specified resource. Contact the owner of the Alibaba Cloud account for authorization.
400InvalidParameter%sThe error message returned because a specified parameter is invalid.
400InvalidInstanceID.Malformed%sThe error message returned because the specified InstanceId parameter is invalid.
400InvalidOperation.InvalidEniState%sThe error message returned because the operation is not supported while the ENI is in the current state.
400NotBelongUser%sThe error message returned because you are not authorized to manage the specified resource.
400InvalidOperation.PermissionExisted%sThe error message returned because the specified permission already exists.
404InvalidOperation.PermissionNotExisted%sThe error message returned because the specified permission does not exist.
404InvalidEniId.NotFound%sThe error message returned because the specified NetworkInterfaceId parameter does not exist.

For a list of error codes, visit the API Error Center.