【发布时间】:2021-03-31 14:18:48
【问题描述】:
我正在尝试向非默认 VPC 中的安全组添加入站规则。我正在使用此代码:
import boto3
ec2 = boto3.client('ec2')
def modify_sg_add_rules():
response = ec2.authorize_security_group_ingress(
IpPermissions=
[
{
'FromPort': 3306,
'IpProtocol': 'tcp',
'IpRanges':
[
{
'CidrIp': '64.192.85.294/32',
'Description': 'My home IP',
},
],
'ToPort': 3306,
'UserIdGroupPairs':
[
{
'Description': 'My home IP',
'GroupId': 'sg-0123',
# 'GroupName': 'mysql-sg-0123',
'VpcId': 'vpc-0f93q3',
},
]
},
],
)
但是,我收到以下错误:
botocore.exceptions.ClientError:调用AuthorizeSecurityGroupIngress操作时发生错误(MissingParameter):请求必须包含参数groupName或groupId
我试过了,包括组名,但还是不行。
【问题讨论】:
标签: amazon-web-services boto3 aws-security-group