All Products
Search
Document Center

Elastic Compute Service:ModifySecurityGroupPolicy

最終更新日:Dec 23, 2024

Modifies the internal access control policy of a basic security group.

Operation description

  • By default, advanced security groups use the internal isolation policy, and Elastic Compute Service (ECS) instances in each advanced security group cannot communicate with each other. The internal access control policy of advanced security groups cannot be modified.
  • You can call the DescribeSecurityGroupAttribute operation to query the internal access control policy of a security group.
  • If the internal access control policy of a security group is set to Accept, the security group uses the internal interconnectivity policy and all ECS instances in the security group can communicate with each other over the internal network, regardless of whether custom rules exist in the security group.
  • If the internal access control policy of a security group is set to Drop and the security group contains no custom rules, the security group uses the internal isolation policy and all ECS instances in the security group cannot communicate with each other over the internal network. In this case, you can use custom rules to allow ECS instances in the security group to communicate with each other. For example, you can call the AuthorizeSecurityGroup operation to configure custom rules.

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:
    • 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
ecs:ModifySecurityGroupPolicyupdate
*SecurityGroup
acs:ecs:{#regionId}:{#accountId}:securitygroup/{#securitygroupId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
SecurityGroupIdstringYes

The ID of the security group.

sg-bp67acfmxazb4ph****
RegionIdstringYes

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

cn-hangzhou
InnerAccessPolicystringYes

The internal access control policy of the security group. Valid values:

  • Accept: the internal interconnectivity policy
  • Drop: the internal isolation policy
Note The value of this parameter is case-insensitive.
Drop
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-426655440000

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984

Examples

Sample success responses

JSONformat

{
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParamter.RegionIdThe RegionId should not be null.The RegionId parameter is required.
400InvalidSecurityGroupId.MalformedThe SecurityGroupId is invalid. Only letters, numbers and underscores are supported. Maximum length is 100 characters.The specified SecurityGroupId parameter is invalid. The value can be up to 100 characters in length and can contain only letters, digits, and underscores (_).
400InvalidPolicy.MalformedThe Policy is invalid. Only 'Accept' and 'Drop' are supported. Ignore case.-
403InvalidOperation.ResourceManagedByCloudProduct%sYou cannot modify security groups managed by cloud services.
404InvalidSecurityGroupId.NotFoundThe specified SecurityGroupId does not exist.The specified security group does not exist in this account. Check whether the security group ID is correct.
404InvalidParameter.InnerAccessPolicyThe InnerAccessPolicy attribute of enterprise level security group can't be modified.-

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

Change history

Change timeSummary of changesOperation
No change history