All Products
Search
Document Center

ApsaraDB RDS:CreateAccount

Last Updated:May 16, 2023

Creates an account to manage databases on an instance.

Operation Description

Before you call this operation, make sure that the following requirements are met:

  • The instance is in the Running state.
  • The database is in the Running state.
  • The number of accounts that are created on the instance does not exceed the upper limit. For more information, see Limits.
Note
  • This operation is supported for instances that run MySQL, MariaDB, PostgreSQL, and SQL Server. However, if the instance runs SQL Server 2017 or SQL Server 2019 on RDS Cluster Edition, this operation is not supported.

  • You can create multiple privileged accounts and standard accounts on an instance that runs PostgreSQL.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
rds:CreateAccountWRITE
  • RDS
    acs:rds:{#regionId}:{#accountId}:dbinstance/{#dbinstanceId}
  • rds:ResourceTag
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringYes

The ID of the instance. You can call the DescribeDBInstances operation to query the ID of the instance.

rm-uf6wjk5xxxxxxx
AccountNamestringYes

The username of the account.

Note
  • The value must be unique.

  • The value must start with a lowercase letter, and end with a lowercase letter or a digit.

  • The value can contain lowercase letters, digits, and underscores (_).

  • The length of the value must meet the following requirements:

    • If the instance runs MySQL 5.7 or MySQL 8.0, the value must be 2 to 32 characters in length.
    • If the instance runs MySQL 5.6, the value must be 2 to 16 characters in length.
    • If the instance runs SQL Server, the value must be 2 to 64 characters in length.
    • If the instance runs PostgreSQL with cloud disks, the value must be 2 to 63 characters in length.
    • If the instance runs PostgreSQL with local disks, the value must be 2 to 16 characters in length.
    • If the instance runs MariaDB, the value must be 2 to 16 characters in length.
  • For more information about invalid characters, see Forbidden keywords table.

test1
AccountPasswordstringYes

The password of the account.

Note
  • The value must be 8 to 32 characters in length.

  • The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.

  • Special characters include ! @ # $ % ^ & * ( ) _ + - =

Test123456
AccountDescriptionstringNo

The description of the account. The value must be 2 to 256 characters in length. The value can contain letters, digits, underscores (_), and hyphens (-). The value must start with a letter.

NoteThe value cannot start with http:// or https://.
Test Account A
AccountTypestringNo

The type of the account. Valid values:

  • Normal: standard account
  • Super: privileged account

Default value: Normal.

Normal

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

D4D4BE8A-DD46-440A-BFCD-EE31DA81C9DD

Examples

Sample success responses

JSONformat

{
  "RequestId": "D4D4BE8A-DD46-440A-BFCD-EE31DA81C9DD"
}

Error codes

HTTP status codeError codeError messageDescription
400GeneralIns.CreatingThe general instance is creating.An RDS instance is in production. Please wait.
400GeneralIns.MaintainingThe general instance is maintaining.An RDS instance is being migrated or maintained. Please wait.
400GeneralIns.SwitchingThe general instance is Switching.A switchover for high availability is in progress. Please wait.
400InvalidEngineVersion.NotSupportedCurrent db instance does not support sysadmin.The operation failed. A sysAdmin account cannot be created on the RDS instance.
400Database.ConnectErrorDatabase connect error. please check instance status and database processlistA database connection error occurred. Check the instance state and the database connection pool.
400Account.AddErrorCreate Account failed, please check your input value or may your input value not satisfy instance current policyFailed to create the account. Check the specified parameters or the parameter policy configuration.
400InvalidAccountPassword.FormatSpecified account password is not valid.The password of the account is invalid. Specify a valid password.
400InvalidAccountDescription.FormatSpecified account description is not valid.The account description is invalid. Specify a valid description. The description can be up to 256 characters in length and cannot be left unspecified.
400InvalidGeneralGroupNameOrGdnInstanceNameThe specified params generalGroupName or gdnInstanceName should not be null.-
400InvalidAccountPrivilege.MalformedSpecified account privilege is not valid.Your account does not have the required permissions.
400InvalidAccountName.ForbidSpecified account name is a keyword in RDS.The username is invalid. Forbidden keywords cannot be used for a username. Modify the username.
400InvalidAccountName.DuplicateSpecified account name already exists in this instance.The username already exists in the RDS instance. Specify a different username.
400InvalidDBDescription.FormatSpecified DB description is not valid.The database description is invalid. Specify a valid description.
403IncorrectDBInstanceStateCurrent DB instance state does not support this operation.-
403IncorrectAccountTypeCurrent account type does not support this operation.This operation is not supported for the current account type. Check the account type.
403AccountLimitExceededAccountQuotaExceeded: Exceeding the allowed amount of accountThe number of accounts exceeds the maximum number of accounts that are allowed.
404InvalidDBInstanceName.NotFoundThe database instance does not exist.The name of the RDS instance cannot be found. Check the name of the RDS instance.
404IncorrectDBInstanceLockModeCurrent DB instance lock mode does not support this operation.The operation failed. The RDS instance is locked.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-10-28The error codes of the API operation change.
Change itemChange content
Error CodesThe error codes of the API operation change.
    Error Codes 400 change
    Added Error Codes: 403
    Added Error Codes: 404
2022-06-23API Description Update,The error codes of the API operation change.
Change itemChange content
API DescriptionAPI Description Update
Error CodesThe error codes of the API operation change.
    delete Error Codes: 400
2021-08-13The error codes of the API operation change.
Change itemChange content
Error CodesThe error codes of the API operation change.
    Error Codes 400 change