I'm trying to create a rule with description but Boto3 doesn't seem to support it. Please check the syntax below:
securityGroup.authorize_ingress(IpProtocol='tcp', FromPort=22, ToPort=22, CidrIp='0.0.0.0/0', Description='SSH Access')
Here is the error:
botocore.exceptions.ParamValidationError: Parameter validation failed: Unknown parameter in input: "Description", must be one of: CidrIp, FromPort, GroupId, GroupName, IpPermissions, IpProtocol, SourceSecurityGroupName, SourceSecurityGroupOwnerId, ToPort, DryRun
I can add description to the security group just fine but not to the rule. Any suggestions?
Check the documentation for the detailed example. There isn't a Description
key on the top level but you can find it from the value of IpPermissions
and IpRanges
.
response = security_group.authorize_ingress(
CidrIp='string',
FromPort=123,
GroupName='string',
IpPermissions=[
{
'FromPort': 123,
'IpProtocol': 'string',
'IpRanges': [
{
'CidrIp': 'string',
'Description': 'string'
},
],
'Ipv6Ranges': [
{
'CidrIpv6': 'string',
'Description': 'string'
},
],
'PrefixListIds': [
{
'Description': 'string',
'PrefixListId': 'string'
},
],
'ToPort': 123,
'UserIdGroupPairs': [
{
'Description': 'string',
'GroupId': 'string',
'GroupName': 'string',
'PeeringStatus': 'string',
'UserId': 'string',
'VpcId': 'string',
'VpcPeeringConnectionId': 'string'
},
]
},
],
IpProtocol='string',
SourceSecurityGroupName='string',
SourceSecurityGroupOwnerId='string',
ToPort=123,
DryRun=True|False
)
So, in your case it should be look like as follows.
response = security_group.authorize_ingress(
IpPermissions=[
{
'FromPort': 22,
'IpProtocol': 'tcp',
'IpRanges': [
{
'CidrIp': '0.0.0.0/0',
'Description': 'SSH Access'
},
],
'ToPort': 22,
]
},
]
)