全部產品
Search
文件中心

Elastic Compute Service:DescribeSecurityGroupAttribute

更新時間:Jun 29, 2026

本介面主要用於查詢一個指定安全性群組的詳細資訊,並關聯查詢安全性群組規則詳細資訊列表。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:DescribeSecurityGroupAttribute

get

*SecurityGroup

acs:ecs:{#regionId}:{#accountId}:securitygroup/{#securitygroupId}

  • ecs:tag

請求參數

名稱

類型

必填

描述

樣本值

SecurityGroupId

string

安全性群組 ID。

sg-bp1gxw6bznjjvhu3****

RegionId

string

安全性群組所屬地域 ID。您可以呼叫 DescribeRegions 查看最新的阿里雲地域列表。

cn-hangzhou

NicType

string

安全性群組規則的網卡類型。

  • 專有網路類型安全性群組的取值只能為:intranet(預設),即內網。

    說明

    如果傳入 internet 或空值,則會預設轉化為 intranet。

  • 經典網路類型安全性群組的取值範圍:

    • internet(預設):公網。

    • intranet:內網。

    說明

    經典網路功能已下線,詳情請參見下線公告

intranet

Direction

string

安全性群組規則授權方向。取值範圍:

  • egress:安全性群組出方向。

  • ingress:安全性群組入方向。

  • all:不區分方向。

預設值:all。

all

NextToken

string

查詢憑證(Token)。取值為上一次呼叫該介面返回的 NextToken 參數值,初次呼叫介面時無需設置該參數。

AAAAAdDWBF2****

MaxResults

integer

分頁查詢時每頁的最大條目數。

  • 最小值:10。

  • 最大值:1000。

預設值為 500。

500

Attribute

string

安全性群組屬性,取值範圍:

  • snapshotPolicyIds:查詢安全性群組關聯的快照策略資訊。

snapshotPolicyIds

返回參數

名稱

類型

描述

樣本值

object

VpcId

string

VPC ID。返回 VPC ID,表示該安全性群組網路類型為 VPC。否則,表示是經典網路類型安全性群組。

說明

經典網路功能已下線,詳情請參見下線公告

vpc-bp1opxu1zkhn00gzv****

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

InnerAccessPolicy

string

安全性群組內網路連通策略。可能值:

  • Accept:內網互通。

  • Drop:內網隔離。

Accept

Description

string

安全性群組描述資訊。

This is description.

SecurityGroupId

string

安全性群組 ID。

sg-bp1gxw6bznjjvhu3****

SecurityGroupName

string

安全性群組名稱。

SecurityGroupName Sample

RegionId

string

地域 ID。

cn-hangzhou

Permissions

object

Permission

array<object>

安全性群組權限規則集合。

object

SecurityGroupRuleId

string

安全性群組規則 ID。

sgr-bp12kewq32dfwrdi****

Direction

string

授權方向。

ingress

SourceGroupId

string

源端安全性群組,用於入方向授權。

sg-bp12kc4rqohaf2js****

DestGroupOwnerAccount

string

目的端安全性群組所屬阿里雲賬戶 ID。

1234567890

DestPrefixListId

string

目的端首碼列表 ID,用於出方向授權。

pl-x1j1k5ykzqlixabc****

DestPrefixListName

string

目的端首碼列表的名稱。

DestPrefixListName Sample

SourceCidrIp

string

源端 IP 位址段,用於入方向授權。

0.0.0.0/0

Ipv6DestCidrIp

string

目的端 IPv6 位址區段。

2001:db8:1233:1a00::***

CreateTime

string

建立時間,UTC 時間。

2018-12-12T07:28:38Z

Ipv6SourceCidrIp

string

源端 IPv6 位址區段。

2001:db8:1234:1a00::***

DestGroupId

string

目的端安全性群組,用於出方向授權。

sg-bp1czdx84jd88i7v****

DestCidrIp

string

目的端 IP 位址段,用於出方向授權。

0.0.0.0/0

IpProtocol

string

IP 協議。

TCP

Priority

string

規則優先順序。

1

DestGroupName

string

目的端安全性群組名稱。

testDestGroupName

NicType

string

網路類型。

intranet

Policy

string

授權策略。

Accept

Description

string

安全性群組描述資訊。

Description Sample 01

PortRange

string

連接埠範圍。

80/80

SourcePrefixListName

string

源端首碼列表的名稱。

SourcePrefixListName Sample

SourcePrefixListId

string

源端首碼列表 ID,用於入方向授權。

pl-x1j1k5ykzqlixdcy****

SourceGroupOwnerAccount

string

源端安全性群組所屬阿里雲賬戶 ID。

1234567890

SourceGroupName

string

源端安全性群組名稱。

testSourceGroupName1

SourcePortRange

string

源端連接埠範圍。

80/80

PortRangeListId

string

連接埠列表 ID。

prl-2ze9743****

PortRangeListName

string

連接埠列表的名稱。

PortRangeListNameSample

NextToken

string

本次呼叫返回的查詢憑證(Token)。當使用 MaxResultsNextToken 方式進行分頁查詢,且該返回值為空時,表示無更多返回的資料資訊。

AAAAAdDWBF2****

SnapshotPolicyIds

object

SnapshotPolicyId

array

安全性群組關聯的快照策略 ID 列表。

string

安全性群組關聯的快照策略 ID。

sgsp-mj74****

樣本

正常返回樣本

JSON格式

{
  "VpcId": "vpc-bp1opxu1zkhn00gzv****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "InnerAccessPolicy": "Accept",
  "Description": "This is description.",
  "SecurityGroupId": "sg-bp1gxw6bznjjvhu3****",
  "SecurityGroupName": "SecurityGroupName Sample",
  "RegionId": "cn-hangzhou",
  "Permissions": {
    "Permission": [
      {
        "SecurityGroupRuleId": "sgr-bp12kewq32dfwrdi****",
        "Direction": "ingress",
        "SourceGroupId": "sg-bp12kc4rqohaf2js****",
        "DestGroupOwnerAccount": "1234567890",
        "DestPrefixListId": "pl-x1j1k5ykzqlixabc****",
        "DestPrefixListName": "DestPrefixListName Sample",
        "SourceCidrIp": "0.0.0.0/0",
        "Ipv6DestCidrIp": "2001:db8:1233:1a00::***",
        "CreateTime": "2018-12-12T07:28:38Z",
        "Ipv6SourceCidrIp": "2001:db8:1234:1a00::***",
        "DestGroupId": "sg-bp1czdx84jd88i7v****",
        "DestCidrIp": "0.0.0.0/0",
        "IpProtocol": "TCP",
        "Priority": "1",
        "DestGroupName": "testDestGroupName",
        "NicType": "intranet",
        "Policy": "Accept",
        "Description": "Description Sample 01",
        "PortRange": "80/80",
        "SourcePrefixListName": "SourcePrefixListName Sample",
        "SourcePrefixListId": "pl-x1j1k5ykzqlixdcy****",
        "SourceGroupOwnerAccount": "1234567890",
        "SourceGroupName": "testSourceGroupName1",
        "SourcePortRange": "80/80",
        "PortRangeListId": "prl-2ze9743****",
        "PortRangeListName": "PortRangeListNameSample"
      }
    ]
  },
  "NextToken": "AAAAAdDWBF2****",
  "SnapshotPolicyIds": {
    "SnapshotPolicyId": [
      "sgsp-mj74****"
    ]
  }
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidNicType.ValueNotSupported The specified NicType does not exist.
400 InvalidParamter Invalid Parameter.
400 InvalidSecurityGroupId.Malformed The specified parameter "SecurityGroupId" is not valid.
400 MissingParameter.RegionId The parameter RegionId is missing.
400 InvalidParameter.AttributeNotSupported The specified value for parameter Attribute is not supported. Valid values: snapshotPolicyIds.
500 InternalError The request processing has failed due to some unknown error.
500 ServiceUnavailable The service is unavailable, please try again later.
404 InvalidRegionId.NotFound The specified RegionId does not exist.
404 InvalidSecurityGroupId.NotFound The specified SecurityGroupId does not exist.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情