Carina

Resource

aws.ec2.SecurityGroupIngress

Describes a security group rule.

Example

let vpc = aws.ec2.Vpc {
  cidr_block = '10.0.0.0/16'

  tags = {
    Environment = 'example'
  }
}

let sg = aws.ec2.SecurityGroup {
  group_name  = 'carina-example-sg-ingress'
  description = 'SG for ingress rule example'
  vpc_id      = vpc.vpc_id

  tags = {
    Environment = 'example'
  }
}

aws.ec2.SecurityGroupIngress {
  group_id    = sg.group_id
  description = 'Allow HTTPS from VPC'
  ip_protocol = tcp
  from_port   = 443
  to_port     = 443
  cidr_ip     = '10.0.0.0/16'
}

Argument Reference

cidr_ip

The IPv4 address range, in CIDR format. Amazon Web Services canonicalizes IPv4 and IPv6 CIDRs. For example, if you specify 100.68.0.18/18 for the CIDR block, Amazon Web Services canonicalizes the CIDR block to 100.68.0.0/18. Any subsequent DescribeSecurityGroups and DescribeSecurityGroupRules calls will return the canonicalized form of the CIDR block. Additionally, if you attempt to add another rule with the non-canonical form of the CIDR (such as 100.68.0.18/18) and there is already a rule for the canonicalized form of the CIDR block (such as 100.68.0.0/18), the API throws an duplicate rule error. To specify an IPv6 address range, use IP permissions instead. To specify multiple rules and descriptions for the rules, use IP permissions instead.

cidr_ipv6

The IPv6 CIDR range.

description

The security group rule description.

from_port

If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP type or -1 (all ICMP types). To specify multiple rules and descriptions for the rules, use IP permissions instead.

group_id

The ID of the security group.

ip_protocol

The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). To specify all protocols, use -1. To specify icmpv6, use IP permissions instead. If you specify a protocol other than one of the supported values, traffic is allowed on all ports, regardless of any ports that you specify. To specify multiple rules and descriptions for the rules, use IP permissions instead.

source_prefix_list_id

The ID of the source prefix list.

source_security_group_owner_id

The Amazon Web Services account ID for the source security group, if the source security group is in a different account. The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, use IP permissions instead.

to_port

If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code or -1 (all ICMP codes). If the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP codes). To specify multiple rules and descriptions for the rules, use IP permissions instead.

source_security_group_id

The ID of the source security group.

Enum Values

ip_protocol (IpProtocol)

Value DSL Identifier
tcp aws.ec2.SecurityGroupIngress.IpProtocol.tcp
udp aws.ec2.SecurityGroupIngress.IpProtocol.udp
icmp aws.ec2.SecurityGroupIngress.IpProtocol.icmp
icmpv6 aws.ec2.SecurityGroupIngress.IpProtocol.icmpv6
-1 aws.ec2.SecurityGroupIngress.IpProtocol.all

Shorthand formats: tcp or IpProtocol.tcp

Attribute Reference

security_group_rule_id

The ID of the security group rule.