CreateAccessKey

Last Updated: Nov 10, 2017

Interface description

Creates an access key for an RAM user.

Request parameters

Action

  • Type: String
  • Required: Yes
  • Description: Operation interface, required. The parameter value is “CreateAccessKey”.

UserName

  • Type: String
  • Required: No
  • Description: User name. When you use a sub-account to call this interface, you create an access key for yourself.

Return parameters

AccessKey

Required permissions

Action

ram:CreateAccessKey

Resource

acs:ram:*:${AccountId}:user/${UserName}

Error messages

InvalidParameter.UserName.InvalidChars
  • HTTP Status: 400
  • Error Message: The parameter - “UserName” contains invalid chars.
InvalidParameter.UserName.Length
  • HTTP Status: 400
  • Error Message: The parameter - “UserName” beyond the length limit.
LimitExceeded.User.AccessKey
  • HTTP Status: 409
  • Error Message: The access key count of the user access keys beyond the current limits.

Operation examples

Request example

  1. https://ram.aliyuncs.com/?Action=CreateAccessKey
  2. &UserName=zhangqiang
  3. &<Public request parameters>

Return example

XML format

  1. <CreateAccessKeyResponse>
  2. <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
  3. <AccessKey>
  4. <AccessKeyId>0wNEpMMlzy7szvai</AccessKeyId>
  5. <AccessKeySecret>PupkTg8jdmau1cXxYacgE736PJj4cA</AccessKeySecret>
  6. <Status>Active</Status>
  7. <CreateDate>2015-01-23T12:33:18Z</CreateDate>
  8. </AccessKey>
  9. </CreateAccessKeyResponse>

JSON format

  1. {
  2. "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
  3. "AccessKey": {
  4. "AccessKeyId": "0wNEpMMlzy7szvai",
  5. "AccessKeySecret": "PupkTg8jdmau1cXxYacgE736PJj4cA",
  6. "Status": "Active",
  7. "CreateDate": "2015-01-23T12:33:18Z"
  8. }
  9. }
Thank you! We've received your feedback.