All Products
Search
Document Center

Server Load Balancer:CreateSecurityPolicy

Last Updated:Mar 21, 2025

Creates a custom security policy for a TCP/SSL listener.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:
    • For mandatory resource types, indicate with a prefix of * .
    • 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
nlb:CreateSecurityPolicycreate
*SecurityPolicy
acs:nlb:{#regionId}:{#accountId}:securitypolicy/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TlsVersionsarrayYes

The Transport Layer Security (TLS) versions supported by the security policy. Valid values: TLSv1.0, TLSv1.1, TLSv1.2, and TLSv1.3.

stringYes

A TLS version supported by the security policy. Valid values: TLSv1.0, TLSv1.1, TLSv1.2, and TLSv1.3. All four versions can be specified for a security policy.

TLSv1.0
SecurityPolicyNamestringNo

The name of the security policy.

It must be 1 to 200 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-).

TLSCipherPolicy
ResourceGroupIdstringNo

The ID of the resource group to which the security policy belongs.

rg-atstuj3rtop****
CiphersarrayYes

The cipher suites supported by the security policy. Valid values of this parameter vary based on TlsVersions. A security policy supports up to 32 cipher suites.

TLSv1.0 and TLSv1.1 support the following cipher suites:

  • ECDHE-ECDSA-AES128-SHA
  • ECDHE-ECDSA-AES256-SHA
  • ECDHE-RSA-AES128-SHA
  • ECDHE-RSA-AES256-SHA
  • AES128-SHA
  • AES256-SHA
  • DES-CBC3-SHA

TLSv1.2 supports the following cipher suites:

  • ECDHE-ECDSA-AES128-SHA
  • ECDHE-ECDSA-AES256-SHA
  • ECDHE-RSA-AES128-SHA
  • ECDHE-RSA-AES256-SHA
  • AES128-SHA
  • AES256-SHA
  • DES-CBC3-SHA
  • ECDHE-ECDSA-AES128-GCM-SHA256
  • ECDHE-ECDSA-AES256-GCM-SHA384
  • ECDHE-ECDSA-AES128-SHA256
  • ECDHE-ECDSA-AES256-SHA384
  • ECDHE-RSA-AES128-GCM-SHA256
  • ECDHE-RSA-AES256-GCM-SHA384
  • ECDHE-RSA-AES128-SHA256
  • ECDHE-RSA-AES256-SHA384
  • AES128-GCM-SHA256
  • AES256-GCM-SHA384
  • AES128-SHA256
  • AES256-SHA256

TLSv1.3 supports the following cipher suites:

  • TLS_AES_128_GCM_SHA256
  • TLS_AES_256_GCM_SHA384
  • TLS_CHACHA20_POLY1305_SHA256
  • TLS_AES_128_CCM_SHA256
  • TLS_AES_128_CCM_8_SHA256
CipherstringYes

A cipher suite supported by the security policy. Valid values of this parameter vary based on TlsVersions. You can specify up to 32 cipher suites.

TLSv1.0 and TLSv1.1 support the following cipher suites:

  • ECDHE-ECDSA-AES128-SHA
  • ECDHE-ECDSA-AES256-SHA
  • ECDHE-RSA-AES128-SHA
  • ECDHE-RSA-AES256-SHA
  • AES128-SHA
  • AES256-SHA
  • DES-CBC3-SHA

TLSv1.2 supports the following cipher suites:

  • ECDHE-ECDSA-AES128-SHA
  • ECDHE-ECDSA-AES256-SHA
  • ECDHE-RSA-AES128-SHA
  • ECDHE-RSA-AES256-SHA
  • AES128-SHA
  • AES256-SHA
  • DES-CBC3-SHA
  • ECDHE-ECDSA-AES128-GCM-SHA256
  • ECDHE-ECDSA-AES256-GCM-SHA384
  • ECDHE-ECDSA-AES128-SHA256
  • ECDHE-ECDSA-AES256-SHA384
  • ECDHE-RSA-AES128-GCM-SHA256
  • ECDHE-RSA-AES256-GCM-SHA384
  • ECDHE-RSA-AES128-SHA256
  • ECDHE-RSA-AES256-SHA384
  • AES128-GCM-SHA256
  • AES256-GCM-SHA384
  • AES128-SHA256
  • AES256-SHA256

TLSv1.3 supports the following cipher suites:

  • TLS_AES_128_GCM_SHA256
  • TLS_AES_256_GCM_SHA384
  • TLS_CHACHA20_POLY1305_SHA256
  • TLS_AES_128_CCM_SHA256
  • TLS_AES_128_CCM_8_SHA256
ECDHE-ECDSA-AES128-SHA
DryRunbooleanNo

Specifies whether to perform a dry run. Valid values:

  • true: validates the request without performing the operation. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails the validation, the corresponding error message is returned. If the request passes the validation, the DryRunOperation error code is returned.
  • false (default): validates the request and performs the operation. If the request passes the validation, a 2xx HTTP status code is returned and the operation is performed.
false
ClientTokenstringNo

The client token used to ensure the idempotence of the request.

You can use the client to generate the token. Ensure that the token is unique among different requests. Only ASCII characters are allowed.

Note If you do not set this parameter, the value of RequestId is used.**** The value of RequestId is different for each request.
123e4567-e89b-12d3-a456-426655440000
RegionIdstringNo

The ID of the region where the NLB instance is deployed.

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
Tagarray<object>No

The tags.

objectNo

The tag.

KeystringNo

The key of the tag. It must be 1 to 64 characters in length, cannot start with aliyun or acs:, and cannot contain http:// or https://. It can contain letters, digits, underscores (_), periods (.), colons (:), forward slashes (/), equal signs (=), plus signs (+), minus signs (-), and at signs (@).

You can add up to 20 tags for the security policy in each call.

KeyTest
ValuestringNo

The value of the tag. It must be 1 to 128 characters in length, cannot start with acs: or aliyun, and cannot contain http:// or https://. It can contain letters, digits, underscores (_), periods (.), colons (:), forward slashes (/), equal signs (=), plus signs (+), minus signs (-), and at signs (@).

You can add up to 20 tags for the security policy in each call.

ValueTest

Response parameters

ParameterTypeDescriptionExample
object

RpcResponse

RequestIdstring

The ID of the request.

D7A8875F-373A-5F48-8484-25B07A61F2AF
SecurityPolicyIdstring

The ID of the TLS security policy.

tls-bp14bb1e7dll4f****
JobIdstring

The ID of the asynchronous task.

72dcd26b-f12d-4c27-b3af-18f6aed5****

Examples

Sample success responses

JSONformat

{
  "RequestId": "D7A8875F-373A-5F48-8484-25B07A61F2AF",
  "SecurityPolicyId": "tls-bp14bb1e7dll4f****",
  "JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****"
}

Error codes

HTTP status codeError codeError messageDescription
400IllegalParamThe param of %s is illegal.-
403Forbidden.NoPermissionAuthentication is failed for NoPermission.Authentication is failed for NoPermission.

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

Change history

Change timeSummary of changesOperation
2024-01-22The Error code has changedView Change Details
2023-09-05The Error code has changedView Change Details
2023-08-22The Error code has changedView Change Details
2023-06-30The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-06-29The request parameters of the API has changedView Change Details