authorize_security_group_egress
async
¶
authorize_security_group_egress(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
tag_specifications: Optional[TagSpecificationList] = None,
dry_run: Optional[Boolean] = None,
group_id: Optional[SecurityGroupId] = None,
source_security_group_name: Optional[String] = None,
source_security_group_owner_id: Optional[String] = None,
ip_protocol: Optional[String] = None,
from_port: Optional[Integer] = None,
to_port: Optional[Integer] = None,
cidr_ip: Optional[String] = None,
ip_permissions: Optional[IpPermissionList] = None,
) -> AuthorizeSecurityGroupEgressResult
Adds the specified outbound (egress) rules to a security group.
An outbound rule permits instances to send traffic to the specified IPv4 or IPv6 address ranges, the IP address ranges specified by a prefix list, or the instances that are associated with a source security group. For more information, see Security group rules.
You must specify exactly one of the following destinations: an IPv4 or IPv6 address range, a prefix list, or a security group. You must specify a protocol for each rule (for example, TCP). If the protocol is TCP or UDP, you must also specify a port or port range. If the protocol is ICMP or ICMPv6, you must also specify the ICMP type and code.
Rule changes are propagated to instances associated with the security group as quickly as possible. However, a small delay might occur.
For examples of rules that you can add to security groups for specific access scenarios, see Security group rules for different use cases in the Amazon EC2 User Guide.
For information about security group quotas, see Amazon VPC quotas in the Amazon VPC User Guide.
Parameters:
-
tag_specifications(Optional[TagSpecificationList], default:None) –The tags applied to the security group rule.
-
dry_run(Optional[Boolean], default:None) –Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
group_id(Optional[SecurityGroupId], default:None) –The ID of the security group.
-
source_security_group_name(Optional[String], default:None) –Not supported. Use IP permissions instead.
-
source_security_group_owner_id(Optional[String], default:None) –Not supported. Use IP permissions instead.
-
ip_protocol(Optional[String], default:None) –Not supported. Use IP permissions instead.
-
from_port(Optional[Integer], default:None) –Not supported. Use IP permissions instead.
-
to_port(Optional[Integer], default:None) –Not supported. Use IP permissions instead.
-
cidr_ip(Optional[String], default:None) –Not supported. Use IP permissions instead.
-
ip_permissions(Optional[IpPermissionList], default:None) –The permissions for the security group rules.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To add a rule that allows outbound traffic to a specific address range This example adds a rule that grants access to the specified address ranges on TCP port 80.
>>> await client.authorize_security_group_egress(group_id='sg-1a2b3c4d', ip_permissions=[{'IpProtocol': 'tcp', 'FromPort': 80, 'ToPort': 80, 'IpRanges': [{'CidrIp': '10.0.0.0/16'}]}])
To add a rule that allows outbound traffic to a specific security group
This example adds a rule that grants access to the specified security group on TCP port 80.
>>> await client.authorize_security_group_egress(group_id='sg-1a2b3c4d', ip_permissions=[{'IpProtocol': 'tcp', 'FromPort': 80, 'ToPort': 80, 'UserIdGroupPairs': [{'GroupId': 'sg-4b51a32f'}]}])
Source code in docs_src/capo_ec2/_services/async_ec2.py
5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 | |