RAM用户可以调用AssumeRole接口扮演可信实体为阿里云账号的RAM角色。本文为您介绍RAM用户角色扮演事件的示例及含义。

示例

以下示例表示ID为23890260100229****的RAM用户Alice,在北京时间2021年08月02日11:42:19通过调用AssumeRole接口扮演159498693826****账号的custom-role-for-actiontrail角色。

{
  "eventId": "2546c4b7-6b56-403e-97d3-500d8d29339a",
  "eventVersion": 1,
  "responseElements": {
    "requestId": "2546c4b7-6b56-403e-97d3-500d8d29339a",
    "assumedRoleUser": {
      "arn": "acs:ram::159498693826****:role/custom-role-for-actiontrail/Alice",
      "assumedRoleId": "39484351102463****:Alice"
    },
    "credentials": {
      "accessKeyId": "STS.NUQNP4PiGyckMsNiGELCs****",
      "accessKeySecret": "Ss7sq2j0ZoJujZnmVgXcu6QT9e****",
      "expiration": "2021-08-02T04:42:19Z"
    }
  },
  "eventSource": "sts.aliyuncs.com",
  "requestParameters": {
    "AcsHost": "sts.aliyuncs.com",
    "AcsProduct": "Sts",
    "RequestId": "2546c4b7-6b56-403e-97d3-500d8d29339a",
    "RoleSessionName": "Alice",
    "DurationSeconds": 3600,
    "HostId": "sts.aliyuncs.com",
    "RoleArn": "acs:ram::159498693826****:role/custom-role-for-actiontrail"
  },
  "sourceIpAddress": "192.168.XX.XX",
  "userAgent": "Jakarta Commons-HttpClient/3.1",
  "eventType": "ApiCall",
  "referencedResources": {
    "ACS::RAM::AccessKey": [
      "STS.NUQNP4PiGyckMsNiGELCs****"
    ]
  },
  "userIdentity": {
    "sessionContext": {
      "attributes": {
        "mfaAuthenticated": "false",
        "creationDate": "2021-08-02T03:42:19Z"
      }
    },
    "accountId": "159498693826****",
    "principalId": "23890260100229****",
    "type": "ram-user",
    "userName": "Alice"
  },
  "serviceName": "Sts",
  "additionalEventData": {
    "Scheme": "https",
    "CallerBid": "26842"
  },
  "apiVersion": "2015-04-01",
  "requestId": "2546c4b7-6b56-403e-97d3-500d8d29339a",
  "eventTime": "2021-08-02T03:42:19Z",
  "isGlobal": false,
  "acsRegion": "cn-shanghai",
  "eventName": "AssumeRole"
}

示例中关键字段含义如下:

  • userIdentity.accountId:请求者的阿里云账号ID,在本示例中表示RAM用户归属的账号ID。取值为159498693826****
  • userIdentity.principalId:请求者的ID,即发起角色扮演的RAM用户ID。
  • userIdentity.type:请求者的身份类型。取值为ram-user,表示RAM用户发起请求,申请扮演某个RAM角色。
  • userIdentity.userName:请求者的用户名。取值为Alice
  • userIdentity.attributes.creationDate:事件的发生时间(UTC格式)。取值为2021-08-02T03:42:19Z,表示北京时间2021年08月02日11:42:19。
  • requestParameters.RoleArn:被扮演的RAM角色ARN。取值为acs:ram::159498693826****:role/custom-role-for-actiontrail159498693826****表示角色所属的阿里云账号,custom-role-for-actiontrail表示角色的名称。
  • responseElements.assumedRoleUser.assumedRoleId:扮演成功后,RAM用户Alice后续操作时的身份ID。格式为{roleId}:{sessionName}roleId表示被扮演的RAM角色ID,sessionName表示进行角色扮演时指定的名称。取值为39484351102463****:Alice,表示被扮演的RAM角色ID是39484351102463****,进行角色扮演时指定的名称为Alice
  • referencedResources:相关资源列表。取值为{ "ACS::RAM::AccessKey": [ "STS.NUQNP4PiGyckMsNiGELCs****"]},表示本次角色扮演获取的临时凭证。