AWS:VPC 內的authorizeSecurityGroupIngress

AWS:VPC 內的authorizeSecurityGroupIngress

我正在使用 NodeJS SDK 將入站規則從資料庫存取安全性群組新增至資料庫安全性群組。

這兩個安全群組都存在於 VPC 中,但是當我使用以下命令新增入口規則時

params =
  GroupId: <Target Group Id>
  SourceSecurityGroupOwnerId: <Source Group Id>

ec2.authorizeSecurityGroupIngress(params, ...)

我收到以下錯誤: { [MissingParameter: Source group ID missing.] message: 'Source group ID missing.', code: 'MissingParameter', time: Mon Nov 24 2014 19:44:13 GMT-0800 (PST), statusCode: 400, retryable: false, retryDelay: 30 }

我發送的有效負載具有有效的安全性群組,當我查看 EC2 文件時,來源組 ID 似乎來自的唯一位置是來源安全群組擁有者 ID範圍。

有其他人遇過這個嗎?這個端點只是不穩定嗎?

答案1

查看文件:

http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EC2.html#authorizeSecurityGroupIngress-property

看來您正確使用了該功能。但是,根據參數的名稱SourceSecurityGroupOwnerId,我懷疑這可能是您要允許存取的安全群組的所有者帳戶ID,如果您想要允許跨帳戶存取的話。

相反,嘗試使用IpPermissions陣列來指示安全組資訊。

var params = {
  GroupId: <Target Group Id>,
  IpPermissions: [
    {
      IpProtocol: 'tcp',
      FromPort: <port>,
      ToPort: <port>,
      UserIdGroupPairs: [
        {
          GroupId: <Source Group Id>
        }
      ]
    }
  ]
};

相關內容