如何将描述添加到AWS CLI的安全组中

发布于 2025-01-30 08:41:41 字数 595 浏览 3 评论 0原文

我正在尝试将IP地址添加到CLI的安全组中,但我可以这样做,但是我正在尝试添加描述。有人可以支持我知道如何添加描述。

我在下面尝试:

aws ec2 authorize-security-group-ingress --group-id sg-123456778 --protocol tcp --port 22 --cidr `echo "$(curl -s https://checkip.amazonaws.com)/32"` --description "testing" 

似乎正常工作的确切命令如下,但是如何通过同一命令传递IP,

下面的命令正常工作,但是有什么方法可以使用卷曲通过CIDR?我尝试的方式与所讨论的方式相同,但不陷入困境

aws ec2 authorize-security-group-ingress \ 
--group-id sg-12345678 \ 
--ip-permissions IpProtocol=tcp,FromPort=22,ToPort=22,IpRanges='[{CidrIp=1.1.1.1/32,Description="Testing"}]' --profile xyz

I am trying to add the IP address to a security group from CLI and I am able to do so, however I am trying to add the description . Can someone support me to know how to add description.

I am trying below way:

aws ec2 authorize-security-group-ingress --group-id sg-123456778 --protocol tcp --port 22 --cidr `echo "$(curl -s https://checkip.amazonaws.com)/32"` --description "testing" 

seems the exact command for that to work is as below, but how to pass IP in the same command

The below command is working fine, but is there a way I can pass my cidr using curl? I tried same way as in question but not going trough

aws ec2 authorize-security-group-ingress \ 
--group-id sg-12345678 \ 
--ip-permissions IpProtocol=tcp,FromPort=22,ToPort=22,IpRanges='[{CidrIp=1.1.1.1/32,Description="Testing"}]' --profile xyz

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

可爱暴击 2025-02-06 08:41:41
aws ec2 authorize-security-group-ingress \
    --group-id sg-123456778 \
    --ip-permissions "IpProtocol=tcp,FromPort=22,ToPort=22,IpRanges=[{CidrIp=`curl -s https://checkip.amazonaws.com`/32,Description=\"testing\"}]"
aws ec2 authorize-security-group-ingress \
    --group-id sg-123456778 \
    --ip-permissions "IpProtocol=tcp,FromPort=22,ToPort=22,IpRanges=[{CidrIp=`curl -s https://checkip.amazonaws.com`/32,Description=\"testing\"}]"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文