如何通过 AWS 上的 shell 脚本在安全组中添加多个入口规则?
How to add multiple ingress rules in a security group via shell script on AWS?
我正在尝试通过 运行 EC2 实例上的 shell 脚本将 100 个 IP 的规则添加到安全组。
aws ec2 authorize-security-group-ingress --protocol tcp --port 9997 --cidr ${fixed_ips} --group-id $group_ids
虽然我有管理员权限,但我遇到了以下错误:
An error occurred (UnauthorizedOperation) when calling the AuthorizeSecurityGroupIngress operation: You are not authorized to perform this operation. Encoded authorization failure message:
错误写道:
You are not authorized
这意味着您没有执行 authorize-security-group-ingress
操作的权限。您必须仔细检查您的 IAM user/role 和您可能受到的任何 SCP,以确保您有权执行相关操作。这可能包括使用了错误的区域。
更新:
如果代码在 EC2 实例上运行,您必须设置 Instance Role 所需的权限。
我正在尝试通过 运行 EC2 实例上的 shell 脚本将 100 个 IP 的规则添加到安全组。
aws ec2 authorize-security-group-ingress --protocol tcp --port 9997 --cidr ${fixed_ips} --group-id $group_ids
虽然我有管理员权限,但我遇到了以下错误:
An error occurred (UnauthorizedOperation) when calling the AuthorizeSecurityGroupIngress operation: You are not authorized to perform this operation. Encoded authorization failure message:
错误写道:
You are not authorized
这意味着您没有执行 authorize-security-group-ingress
操作的权限。您必须仔细检查您的 IAM user/role 和您可能受到的任何 SCP,以确保您有权执行相关操作。这可能包括使用了错误的区域。
更新:
如果代码在 EC2 实例上运行,您必须设置 Instance Role 所需的权限。