如何使用NodeJS将安全组添加到已经运行的EC2实例中?
标题几乎说明了所有内容,但为了明确说明,我不想
(1)使用该控制台或 (2)使用CLI,
我想使用nodejs动态添加SG。令我震惊的是,在AWS文档中没有明显的答案,但是,如果有的话,我当然找不到它!
the title says almost everything, but just to make it clear, I DON'T want to
(1) use the console, OR
(2) use the CLI,
I want to add a SG dynamically using nodejs. I am shocked that there is not an obvious answer to this in the AWS documentation, but, if there is, I certainly can't find it!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过 modifynetworktork interflibute /代码>参数:
因此,您必须首先获得实例的
networkInterfaceid
(一个实例可以具有多个接口)。您可以使用 docidentIxinstances 。拥有NetworkInterfaceID
后,您可以使用modifynetworkInterfaceAttribute
修改其SGS。You do this through modifyNetworkInterfaceAttribute which takes
Groups
parameter:So you have to get
NetworkInterfaceId
of your instance (an instance can have multiple interfaces) first. You can do that using describeInstances. Once you have theNetworkInterfaceId
you modify their SGs usingmodifyNetworkInterfaceAttribute
.