Skip to content

awscc.ec2.security_group

CloudFormation Type: AWS::EC2::SecurityGroup

Resource Type definition for AWS::EC2::SecurityGroup

Example

let vpc = awscc.ec2.vpc {
cidr_block = '10.0.0.0/16'
}
awscc.ec2.security_group {
vpc_id = vpc.vpc_id
group_description = 'Example security group'
security_group_ingress {
ip_protocol = 'tcp'
from_port = 80
to_port = 80
cidr_ip = '0.0.0.0/0'
}
security_group_ingress {
ip_protocol = 'tcp'
from_port = 443
to_port = 443
cidr_ip = '0.0.0.0/0'
}
tags = {
Environment = 'example'
}
}

Argument Reference

group_description

  • Type: String
  • Required: Yes
  • Create-only: Yes

A description for the security group.

group_name

  • Type: String
  • Required: No
  • Create-only: Yes

The name of the security group.

security_group_egress

[VPC only] The outbound rules associated with the security group. There is a short interruption during which you cannot connect to the security group.

security_group_ingress

The inbound rules associated with the security group. There is a short interruption during which you cannot connect to the security group.

tags

  • Type: Map(String)
  • Required: No

Any tags assigned to the security group.

vpc_id

  • Type: VpcId
  • Required: No
  • Create-only: Yes

The ID of the VPC for the security group.

Enum Values

ip_protocol (IpProtocol)

ValueDSL Identifier
tcpawscc.ec2.security_group.IpProtocol.tcp
udpawscc.ec2.security_group.IpProtocol.udp
icmpawscc.ec2.security_group.IpProtocol.icmp
icmpv6awscc.ec2.security_group.IpProtocol.icmpv6
-1awscc.ec2.security_group.IpProtocol.all
allawscc.ec2.security_group.IpProtocol.all

Shorthand formats: tcp or IpProtocol.tcp

Struct Definitions

Egress

FieldTypeRequiredDescription
cidr_ipIpv4CidrNo
cidr_ipv6Ipv6CidrNo
descriptionStringNo
destination_prefix_list_idPrefixListIdNo
destination_security_group_idSecurityGroupIdNo
from_portInt(-1..=65535)No
ip_protocolEnum (IpProtocol)Yes
to_portInt(-1..=65535)No

Ingress

FieldTypeRequiredDescription
cidr_ipIpv4CidrNo
cidr_ipv6Ipv6CidrNo
descriptionStringNo
from_portInt(-1..=65535)No
ip_protocolEnum (IpProtocol)Yes
source_prefix_list_idPrefixListIdNo
source_security_group_idSecurityGroupIdNo
source_security_group_nameStringNo
source_security_group_owner_idAwsAccountIdNo
to_portInt(-1..=65535)No

Attribute Reference

group_id

  • Type: SecurityGroupId

The group ID of the specified security group.

id

  • Type: SecurityGroupId

The group name or group ID depending on whether the SG is created in default or specific VPC