395
魔獸
授權出方向安全組權限__安全組相關接口_API 參考_雲服務器 ECS-阿裏雲
描述
設定安全組Out方向的訪問權限。
- 可支持的授權策略為:
accept
(接受訪問),drop
(拒絕訪問)。 - 可支持不同的網絡類型,如
NicType
可選擇internet
或intranet
,分別表示公網或內網。 - 單個安全組的授權規則最多為100條。
- 安全組的優先級根據創建的時間降序排序匹配。
- 組和組之間的授權隻能在內網,即
NicType
隻能選擇intranet
。 - 規則優先級可選範圍為1-100,默認值為1,即最高優先級。數字越大,代表優先級越低。
- 相同優先級的授權規則,授權策略為drop的規則優先。
- 安全組規則由兩組可選參數中的一組組成:
DestGroupOwnerAccount
、DestGroupId
、IpProtocol
、PortRange
、NicType
、Policy
或者DestCidrIp
、IpProtocol
、PortRange
、NicType
、Policy
。如匹配的規則已存在將會報錯。
支持兩種授權方式: 1、開放對同一region內其他安全組(允許跨用戶授權)的訪問權限;2、開放對指定某IP地址範圍(CIDR格式)的訪問權限
請求參數
名稱 | 類型 | 是否必須 | 描述 |
---|---|---|---|
Action | String | 是 | 係統規定參數,取值:AuthorizeSecurityGroupEgress |
SecurityGroupId | String | 是 | 源安全組編碼 |
RegionId | String | 是 | 源安全組所屬Region ID |
IpProtocol | String | 是 | IP協議,取值:tcp | udp | icmp | gre | all; all表示同時支持四種協議 |
PortRange | String | 是 | IP協議相關的端口號範圍
|
DestGroupId | String | 否 | 同一Region內的目標安全組Id,DestGroupId或者DestCidrIp參數必須設置一項,如果兩項都設置,則默認對DestCidrIp授權。如果指定了該字段且沒有指定DestCidrIp,則NicType隻能選擇intranet |
DestGroupOwnerAccount | String | 否 | 跨用戶安全組授權時,目標安全組所屬用戶阿裏雲賬號。該參數可選,如果該參數及DestGroupOwnerId均未設置,則默認為同一賬戶安全組間授權。DestCidrIp如果已經被設置,則該參數無效。 |
DestGroupOwnerId | String | 否 | 跨用戶安全組授權時,目標安全組所屬用戶阿裏雲賬號ID。該參數可選,如果該參數及DestGroupOwnerAccount均未設置,則默認為同一賬戶安全組間授權。DestCidrIp如果已經被設置,則該參數無效。 |
DestCidrIp | String | 否 | 目標IP地址範圍,必須采用CIDR格式來指定IP地址範圍,默認值為0.0.0.0/0(表示不受限製),其他支持的格式如10.159.6.18/12。僅支持IPV4。 |
Policy | String | 否 | 授權策略,參數值可為:accept(接受訪問), drop (拒絕訪問) 默認值為:accept |
Priority | String | 否 | 授權策略優先級,參數值可為:1-100 默認值為:1 |
NicType | String | 否 | 網絡類型,取值:
當對安全組進行相互授權時(即指定了DestGroupId且沒有指定DestCidrIp),必須指定NicType為intranet |
返回參數
全是公共返回參數,詳見公共返回參數
錯誤碼
錯誤代碼 | 描述 | Http 狀態碼 | 語義 |
---|---|---|---|
InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | 404 | 指定的RegionId不存在 |
MissingParameter | The input parameter “RegionId” that is mandatory for processing this request is not supplied. | 400 | RegionId參數未指定 |
InvalidSecurityGroupId.NotFound | The SecurityGroupId provided does not exist in our records. | 404 | 指定的SecurityGroupId不存在 |
MissingParameter | The input parameter “SecurityGroupId” that is mandatory for processing this request is not supplied. | 400 | SecurityGroupId參數未指定 |
OperationDenied | The specified IpProtocol does not exist or IpProtocol and PortRange do not match. | 400 | IP協議不存在或者IP協議和端口不匹配 |
MissingParameter | The input parameter “IpProtocol” that is mandatory for processing this request is not supplied. | 400 | IpProtocol參數未指定 |
InvalidIpProtocol.Malformed | The specified parameter “PortRange” is not valid. | 400 | IpProtocol參數格式不正確 |
InvalidPriority.Malformed | The specified parameter “Priority” is not valid. | 400 | Priority參數格式不正確 |
MissingParameter | The input parameter “PortRange” that is mandatory for processing this request is not supplied. | 400 | PortRange參數未指定 |
InvalidDestGroupId.Mismatch | NicType is required or NicType expects intrnet. | 403 | 需要明確NicType參數或者NicType必須為intranet |
InvalidDestCidrIp.Malformed | The specified parameter “DestCidrIp” is not valid. | 400 | DestCidrIp參數格式不正確 |
MissingParameter | The input parameter “DestGroupId” or “DestCidrIp” cannot be both blank. | 403 | DestGroupId或者DestCidrIp參數未指定 |
InvalidPolicy.Malformed | The specified parameter “Policy” is not valid. | 400 | Policy參數格式不正確 |
InvalidNicType.ValueNotSupported | The specified NicType does not exist. | 400 | NicType指定的值不支持 |
AuthorizationLimitExceed | The limit of Authorization in one security group reachs. | 403 | 安全組授權規則數達到上限 |
InvalidParamter.Conflict | The specified SecurityGroupId should be different from the DestGroupId. | 403 | SecurityGroupId和DestGroupId為同一個安全組 |
InvalidDestGroupId.Mismatch | DestGroupOwnerUserAccount is required. | 403 | 指定的其他用戶的DestGroup但是沒有指定DestGroupOwnerUserAccount |
InvalidDestGroupId.Mismatch | Specified security group and destination group are not in the same VPC. | 403 | 指定的安全組和目標安全組不屬於同一個vpc |
InvalidDestGroupOwnerUserAccount.Mismatch | The specified DestGroupId is not belong to the DestGroupOwnerUserAccount | 403 | 指定的DestGroup不屬於DestGroupOwnerUserAccount指定的用戶 |
InvalidDestGroupId.NotFound | The DestGroupId provided does not exist in our records. | 404 | 指定的DestGroup未找到 |
示例
請求示例
- 配置對其他安全組的訪問權限
https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroupEgress
&SecurityGroupId=sg-94n63e80l
&IpProtocol=all
&DestGroupId=sg-94oi1r1bp
&PortRange=1/65535
&<公共請求參數>
- 授權對指定的IP地址範圍的訪問權限
https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroupEgress
&SecurityGroupId=sg-94n63e80l
&IpProtocol=all
&DestCidrIp=10.0.0.0/8
&PortRange=1/65535
&<公共請求參數>
返回示例
XML
格式
<AuthorizeSecurityGroupEgressResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</AuthorizeSecurityGroupEgressResponse>
JSON
格式
{
"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}
最後更新:2016-11-23 17:16:02
上一篇:
撤銷安全組規則__安全組相關接口_API 參考_雲服務器 ECS-阿裏雲
下一篇:
撤銷出方向安全組規則__安全組相關接口_API 參考_雲服務器 ECS-阿裏雲
搜索文件__管理文件_控製台用戶指南_對象存儲 OSS-阿裏雲
創建RAM用戶__快速入門_訪問控製-阿裏雲
CreateVServerGroup__VServerGroup相關API_API 參考_負載均衡-阿裏雲
安卓版Google Authenticator安裝及使用指導__附錄2: Google Authenticator安裝及使用指導_用戶指南_訪問控製-阿裏雲
DeleteTrail__實例相關接口_API參考_操作審計-阿裏雲
查看雲服務器實例的監控信息__監控相關接口_API 參考_雲服務器 ECS-阿裏雲
發布APP__快速開始_移動數據分析-阿裏雲
示例二__快速開始_Quick BI-阿裏雲
Encrypt__API 參考_密鑰管理服務-阿裏雲
渠道專屬API接口文檔__渠道商問題_渠道合作夥伴_合作夥伴-阿裏雲
相關內容
常見錯誤說明__附錄_大數據計算服務-阿裏雲
發送短信接口__API使用手冊_短信服務-阿裏雲
接口文檔__Android_安全組件教程_移動安全-阿裏雲
運營商錯誤碼(聯通)__常見問題_短信服務-阿裏雲
設置短信模板__使用手冊_短信服務-阿裏雲
OSS 權限問題及排查__常見錯誤及排除_最佳實踐_對象存儲 OSS-阿裏雲
消息通知__操作指南_批量計算-阿裏雲
設備端快速接入(MQTT)__快速開始_阿裏雲物聯網套件-阿裏雲
查詢API調用流量數據__API管理相關接口_API_API 網關-阿裏雲
使用STS訪問__JavaScript-SDK_SDK 參考_對象存儲 OSS-阿裏雲