Procedures

Automation procedures in the AWS EC2 book.

The following documentation is for AWS EC2 v1.6.2 (BDK).

to attach a rule to a security group

Adds an ingress or egress rule to a security group.

Input Concepts

Concept
Description
Type
Required
Default Value

A security group to authorize

ec2 security group

Yes

(no default)

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

FILTER - CAPABLE

Gets security groups from EC2

Output Concepts

Concept
Description
Type

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

Concept
Description
Type
Required
Default Value

The security group to get rules for.

ec2 security group

Yes

(no default)

Output Concepts

Concept
Description
Type

A list of security group rules.

ec2 security group rule

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

Concept
Description
Type
Required
Default Value

A security group rule to be revoked

ec2 security group rule

Yes

(no default)

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?