Procedures
Automation procedures in the AWS EC2 book.
Make sure to add the AWS EC2 book to your agent before using these automation procedures.
to attach a rule to a security group
Adds an ingress or egress rule to a security group.
Input Concepts
rule type
The type of rule to add (ingress or egress)
conceptual
or text
Yes
(no default)
A list of IpPermission objects representing the permissions to authorize
ec2 ip permission
Yes
(no default)
Examples
get '[{"cidr_ip": "186.137.54.107/32", "description": "SSH access from specific IP"}]' as a json
use the above as the ip ranges
create a json
use the above as the permission
set the permission's "ip_protocol" to "tcp"
set the permission's "from_port" to 22
set the permission's "to_port" to 22
set the permission's "ip_ranges" to the ip ranges
the permission
imagine the permissions
add the permission to the permissions
attach a rule to the security group
the rule type is "ingress"
the ip permissions are the permissions
attach a rule to the security group
the rule type is "egress"
the ip permissions are the permissions
to get (security groups) from ec2
Gets security groups from EC2
Output Concepts
security groups
A list of security groups.
json
Examples
Get all security groups from EC2
get some security groups from ec2
Get security groups filtered by name
get some security groups from ec2 whose group-name is "bdk-test"
to get some (security group's rules)
Gets security group rules from EC2
Input Concepts
Output Concepts
Examples
Get security group rules from a specific security group
get some security groups from ec2 whose group-name is "bdk-test"
get the security group's rules
to revoke a security group rule
Revokes egress from a security group
Input Concepts
Examples
Revoke all existing security group rules from a security group
get some security groups from ec2 whose group-name is "bdk-test"
get the security group's rules
the rules
process each rule as follows
the rule
use the above as the security rule
revoke the security rule
Last updated
Was this helpful?