我想访问安全组ID。这是我用来创建它的命令,任何人都可以提供一行命令来再次查看该表吗?
aws --profile awscli-user-1 \
ec2 create-security-group \
--group-name ssh-access \
--description "Security group for SSH access" \
--vpc-id vpc-xxxxxxxxxxxxxxxxx \
--output table
这是我创建后得到的
-------------------------------------
| CreateSecurityGroup |
+----------+------------------------+
| GroupId | sg-XXXXXXXXXXXXXXXX |
+----------+------------------------+
如何再次查看此内容?
要使用单行命令再次查看安全组 ID,您可以使用带有过滤器的 aws ec2 describe-security-groups 命令来获取您创建的特定安全组。这是命令:
aws --profile awscli-user-1 ec2 描述安全组 --group-names ssh-access --query "SecurityGroups[0].GroupId" --输出文本