1. Packages
  2. AWS
  3. API Docs
  4. vpc
  5. SecurityGroupIngressRule
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.vpc.SecurityGroupIngressRule

Explore with Pulumi AI

Manages an inbound (ingress) rule for a security group.

When specifying an inbound rule for your security group in a VPC, the configuration must include a source for the traffic.

NOTE: Using aws.vpc.SecurityGroupEgressRule and aws.vpc.SecurityGroupIngressRule resources is the current best practice. Avoid using the aws.ec2.SecurityGroupRule resource and the ingress and egress arguments of the aws.ec2.SecurityGroup resource for configuring in-line rules, as they struggle with managing multiple CIDR blocks, and tags and descriptions due to the historical lack of unique IDs.

!> WARNING: You should not use the aws.vpc.SecurityGroupEgressRule and aws.vpc.SecurityGroupIngressRule resources in conjunction with the aws.ec2.SecurityGroup resource with in-line rules (using the ingress and egress arguments of aws.ec2.SecurityGroup) or the aws.ec2.SecurityGroupRule resource. Doing so may cause rule conflicts, perpetual differences, and result in rules being overwritten.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ec2.SecurityGroup("example", {
    name: "example",
    description: "example",
    vpcId: main.id,
    tags: {
        Name: "example",
    },
});
const exampleSecurityGroupIngressRule = new aws.vpc.SecurityGroupIngressRule("example", {
    securityGroupId: example.id,
    cidrIpv4: "10.0.0.0/8",
    fromPort: 80,
    ipProtocol: "tcp",
    toPort: 80,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ec2.SecurityGroup("example",
    name="example",
    description="example",
    vpc_id=main["id"],
    tags={
        "Name": "example",
    })
example_security_group_ingress_rule = aws.vpc.SecurityGroupIngressRule("example",
    security_group_id=example.id,
    cidr_ipv4="10.0.0.0/8",
    from_port=80,
    ip_protocol="tcp",
    to_port=80)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ec2.NewSecurityGroup(ctx, "example", &ec2.SecurityGroupArgs{
			Name:        pulumi.String("example"),
			Description: pulumi.String("example"),
			VpcId:       pulumi.Any(main.Id),
			Tags: pulumi.StringMap{
				"Name": pulumi.String("example"),
			},
		})
		if err != nil {
			return err
		}
		_, err = vpc.NewSecurityGroupIngressRule(ctx, "example", &vpc.SecurityGroupIngressRuleArgs{
			SecurityGroupId: example.ID(),
			CidrIpv4:        pulumi.String("10.0.0.0/8"),
			FromPort:        pulumi.Int(80),
			IpProtocol:      pulumi.String("tcp"),
			ToPort:          pulumi.Int(80),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Ec2.SecurityGroup("example", new()
    {
        Name = "example",
        Description = "example",
        VpcId = main.Id,
        Tags = 
        {
            { "Name", "example" },
        },
    });

    var exampleSecurityGroupIngressRule = new Aws.Vpc.SecurityGroupIngressRule("example", new()
    {
        SecurityGroupId = example.Id,
        CidrIpv4 = "10.0.0.0/8",
        FromPort = 80,
        IpProtocol = "tcp",
        ToPort = 80,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.SecurityGroup;
import com.pulumi.aws.ec2.SecurityGroupArgs;
import com.pulumi.aws.vpc.SecurityGroupIngressRule;
import com.pulumi.aws.vpc.SecurityGroupIngressRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new SecurityGroup("example", SecurityGroupArgs.builder()
            .name("example")
            .description("example")
            .vpcId(main.id())
            .tags(Map.of("Name", "example"))
            .build());

        var exampleSecurityGroupIngressRule = new SecurityGroupIngressRule("exampleSecurityGroupIngressRule", SecurityGroupIngressRuleArgs.builder()
            .securityGroupId(example.id())
            .cidrIpv4("10.0.0.0/8")
            .fromPort(80)
            .ipProtocol("tcp")
            .toPort(80)
            .build());

    }
}
Copy
resources:
  example:
    type: aws:ec2:SecurityGroup
    properties:
      name: example
      description: example
      vpcId: ${main.id}
      tags:
        Name: example
  exampleSecurityGroupIngressRule:
    type: aws:vpc:SecurityGroupIngressRule
    name: example
    properties:
      securityGroupId: ${example.id}
      cidrIpv4: 10.0.0.0/8
      fromPort: 80
      ipProtocol: tcp
      toPort: 80
Copy

Create SecurityGroupIngressRule Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new SecurityGroupIngressRule(name: string, args: SecurityGroupIngressRuleArgs, opts?: CustomResourceOptions);
@overload
def SecurityGroupIngressRule(resource_name: str,
                             args: SecurityGroupIngressRuleArgs,
                             opts: Optional[ResourceOptions] = None)

@overload
def SecurityGroupIngressRule(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             ip_protocol: Optional[str] = None,
                             security_group_id: Optional[str] = None,
                             cidr_ipv4: Optional[str] = None,
                             cidr_ipv6: Optional[str] = None,
                             description: Optional[str] = None,
                             from_port: Optional[int] = None,
                             prefix_list_id: Optional[str] = None,
                             referenced_security_group_id: Optional[str] = None,
                             tags: Optional[Mapping[str, str]] = None,
                             to_port: Optional[int] = None)
func NewSecurityGroupIngressRule(ctx *Context, name string, args SecurityGroupIngressRuleArgs, opts ...ResourceOption) (*SecurityGroupIngressRule, error)
public SecurityGroupIngressRule(string name, SecurityGroupIngressRuleArgs args, CustomResourceOptions? opts = null)
public SecurityGroupIngressRule(String name, SecurityGroupIngressRuleArgs args)
public SecurityGroupIngressRule(String name, SecurityGroupIngressRuleArgs args, CustomResourceOptions options)
type: aws:vpc:SecurityGroupIngressRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SecurityGroupIngressRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SecurityGroupIngressRuleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SecurityGroupIngressRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SecurityGroupIngressRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SecurityGroupIngressRuleArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var securityGroupIngressRuleResource = new Aws.Vpc.SecurityGroupIngressRule("securityGroupIngressRuleResource", new()
{
    IpProtocol = "string",
    SecurityGroupId = "string",
    CidrIpv4 = "string",
    CidrIpv6 = "string",
    Description = "string",
    FromPort = 0,
    PrefixListId = "string",
    ReferencedSecurityGroupId = "string",
    Tags = 
    {
        { "string", "string" },
    },
    ToPort = 0,
});
Copy
example, err := vpc.NewSecurityGroupIngressRule(ctx, "securityGroupIngressRuleResource", &vpc.SecurityGroupIngressRuleArgs{
	IpProtocol:                pulumi.String("string"),
	SecurityGroupId:           pulumi.String("string"),
	CidrIpv4:                  pulumi.String("string"),
	CidrIpv6:                  pulumi.String("string"),
	Description:               pulumi.String("string"),
	FromPort:                  pulumi.Int(0),
	PrefixListId:              pulumi.String("string"),
	ReferencedSecurityGroupId: pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	ToPort: pulumi.Int(0),
})
Copy
var securityGroupIngressRuleResource = new SecurityGroupIngressRule("securityGroupIngressRuleResource", SecurityGroupIngressRuleArgs.builder()
    .ipProtocol("string")
    .securityGroupId("string")
    .cidrIpv4("string")
    .cidrIpv6("string")
    .description("string")
    .fromPort(0)
    .prefixListId("string")
    .referencedSecurityGroupId("string")
    .tags(Map.of("string", "string"))
    .toPort(0)
    .build());
Copy
security_group_ingress_rule_resource = aws.vpc.SecurityGroupIngressRule("securityGroupIngressRuleResource",
    ip_protocol="string",
    security_group_id="string",
    cidr_ipv4="string",
    cidr_ipv6="string",
    description="string",
    from_port=0,
    prefix_list_id="string",
    referenced_security_group_id="string",
    tags={
        "string": "string",
    },
    to_port=0)
Copy
const securityGroupIngressRuleResource = new aws.vpc.SecurityGroupIngressRule("securityGroupIngressRuleResource", {
    ipProtocol: "string",
    securityGroupId: "string",
    cidrIpv4: "string",
    cidrIpv6: "string",
    description: "string",
    fromPort: 0,
    prefixListId: "string",
    referencedSecurityGroupId: "string",
    tags: {
        string: "string",
    },
    toPort: 0,
});
Copy
type: aws:vpc:SecurityGroupIngressRule
properties:
    cidrIpv4: string
    cidrIpv6: string
    description: string
    fromPort: 0
    ipProtocol: string
    prefixListId: string
    referencedSecurityGroupId: string
    securityGroupId: string
    tags:
        string: string
    toPort: 0
Copy

SecurityGroupIngressRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The SecurityGroupIngressRule resource accepts the following input properties:

IpProtocol This property is required. string
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
SecurityGroupId This property is required. string
The ID of the security group.
CidrIpv4 string
The source IPv4 CIDR range.
CidrIpv6 string
The source IPv6 CIDR range.
Description string
The security group rule description.
FromPort int
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
PrefixListId string
The ID of the source prefix list.
ReferencedSecurityGroupId string
The source security group that is referenced in the rule.
Tags Dictionary<string, string>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
ToPort int
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
IpProtocol This property is required. string
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
SecurityGroupId This property is required. string
The ID of the security group.
CidrIpv4 string
The source IPv4 CIDR range.
CidrIpv6 string
The source IPv6 CIDR range.
Description string
The security group rule description.
FromPort int
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
PrefixListId string
The ID of the source prefix list.
ReferencedSecurityGroupId string
The source security group that is referenced in the rule.
Tags map[string]string
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
ToPort int
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
ipProtocol This property is required. String
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
securityGroupId This property is required. String
The ID of the security group.
cidrIpv4 String
The source IPv4 CIDR range.
cidrIpv6 String
The source IPv6 CIDR range.
description String
The security group rule description.
fromPort Integer
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
prefixListId String
The ID of the source prefix list.
referencedSecurityGroupId String
The source security group that is referenced in the rule.
tags Map<String,String>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
toPort Integer
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
ipProtocol This property is required. string
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
securityGroupId This property is required. string
The ID of the security group.
cidrIpv4 string
The source IPv4 CIDR range.
cidrIpv6 string
The source IPv6 CIDR range.
description string
The security group rule description.
fromPort number
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
prefixListId string
The ID of the source prefix list.
referencedSecurityGroupId string
The source security group that is referenced in the rule.
tags {[key: string]: string}
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
toPort number
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
ip_protocol This property is required. str
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
security_group_id This property is required. str
The ID of the security group.
cidr_ipv4 str
The source IPv4 CIDR range.
cidr_ipv6 str
The source IPv6 CIDR range.
description str
The security group rule description.
from_port int
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
prefix_list_id str
The ID of the source prefix list.
referenced_security_group_id str
The source security group that is referenced in the rule.
tags Mapping[str, str]
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
to_port int
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
ipProtocol This property is required. String
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
securityGroupId This property is required. String
The ID of the security group.
cidrIpv4 String
The source IPv4 CIDR range.
cidrIpv6 String
The source IPv6 CIDR range.
description String
The security group rule description.
fromPort Number
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
prefixListId String
The ID of the source prefix list.
referencedSecurityGroupId String
The source security group that is referenced in the rule.
tags Map<String>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
toPort Number
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.

Outputs

All input properties are implicitly available as output properties. Additionally, the SecurityGroupIngressRule resource produces the following output properties:

Arn string
The Amazon Resource Name (ARN) of the security group rule.
Id string
The provider-assigned unique ID for this managed resource.
SecurityGroupRuleId string
The ID of the security group rule.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
The Amazon Resource Name (ARN) of the security group rule.
Id string
The provider-assigned unique ID for this managed resource.
SecurityGroupRuleId string
The ID of the security group rule.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The Amazon Resource Name (ARN) of the security group rule.
id String
The provider-assigned unique ID for this managed resource.
securityGroupRuleId String
The ID of the security group rule.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
The Amazon Resource Name (ARN) of the security group rule.
id string
The provider-assigned unique ID for this managed resource.
securityGroupRuleId string
The ID of the security group rule.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
The Amazon Resource Name (ARN) of the security group rule.
id str
The provider-assigned unique ID for this managed resource.
security_group_rule_id str
The ID of the security group rule.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The Amazon Resource Name (ARN) of the security group rule.
id String
The provider-assigned unique ID for this managed resource.
securityGroupRuleId String
The ID of the security group rule.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Look up Existing SecurityGroupIngressRule Resource

Get an existing SecurityGroupIngressRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SecurityGroupIngressRuleState, opts?: CustomResourceOptions): SecurityGroupIngressRule
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        cidr_ipv4: Optional[str] = None,
        cidr_ipv6: Optional[str] = None,
        description: Optional[str] = None,
        from_port: Optional[int] = None,
        ip_protocol: Optional[str] = None,
        prefix_list_id: Optional[str] = None,
        referenced_security_group_id: Optional[str] = None,
        security_group_id: Optional[str] = None,
        security_group_rule_id: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        to_port: Optional[int] = None) -> SecurityGroupIngressRule
func GetSecurityGroupIngressRule(ctx *Context, name string, id IDInput, state *SecurityGroupIngressRuleState, opts ...ResourceOption) (*SecurityGroupIngressRule, error)
public static SecurityGroupIngressRule Get(string name, Input<string> id, SecurityGroupIngressRuleState? state, CustomResourceOptions? opts = null)
public static SecurityGroupIngressRule get(String name, Output<String> id, SecurityGroupIngressRuleState state, CustomResourceOptions options)
resources:  _:    type: aws:vpc:SecurityGroupIngressRule    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
The Amazon Resource Name (ARN) of the security group rule.
CidrIpv4 string
The source IPv4 CIDR range.
CidrIpv6 string
The source IPv6 CIDR range.
Description string
The security group rule description.
FromPort int
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
IpProtocol string
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
PrefixListId string
The ID of the source prefix list.
ReferencedSecurityGroupId string
The source security group that is referenced in the rule.
SecurityGroupId string
The ID of the security group.
SecurityGroupRuleId string
The ID of the security group rule.
Tags Dictionary<string, string>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

ToPort int
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
Arn string
The Amazon Resource Name (ARN) of the security group rule.
CidrIpv4 string
The source IPv4 CIDR range.
CidrIpv6 string
The source IPv6 CIDR range.
Description string
The security group rule description.
FromPort int
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
IpProtocol string
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
PrefixListId string
The ID of the source prefix list.
ReferencedSecurityGroupId string
The source security group that is referenced in the rule.
SecurityGroupId string
The ID of the security group.
SecurityGroupRuleId string
The ID of the security group rule.
Tags map[string]string
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

ToPort int
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
arn String
The Amazon Resource Name (ARN) of the security group rule.
cidrIpv4 String
The source IPv4 CIDR range.
cidrIpv6 String
The source IPv6 CIDR range.
description String
The security group rule description.
fromPort Integer
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
ipProtocol String
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
prefixListId String
The ID of the source prefix list.
referencedSecurityGroupId String
The source security group that is referenced in the rule.
securityGroupId String
The ID of the security group.
securityGroupRuleId String
The ID of the security group rule.
tags Map<String,String>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

toPort Integer
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
arn string
The Amazon Resource Name (ARN) of the security group rule.
cidrIpv4 string
The source IPv4 CIDR range.
cidrIpv6 string
The source IPv6 CIDR range.
description string
The security group rule description.
fromPort number
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
ipProtocol string
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
prefixListId string
The ID of the source prefix list.
referencedSecurityGroupId string
The source security group that is referenced in the rule.
securityGroupId string
The ID of the security group.
securityGroupRuleId string
The ID of the security group rule.
tags {[key: string]: string}
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

toPort number
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
arn str
The Amazon Resource Name (ARN) of the security group rule.
cidr_ipv4 str
The source IPv4 CIDR range.
cidr_ipv6 str
The source IPv6 CIDR range.
description str
The security group rule description.
from_port int
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
ip_protocol str
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
prefix_list_id str
The ID of the source prefix list.
referenced_security_group_id str
The source security group that is referenced in the rule.
security_group_id str
The ID of the security group.
security_group_rule_id str
The ID of the security group rule.
tags Mapping[str, str]
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

to_port int
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
arn String
The Amazon Resource Name (ARN) of the security group rule.
cidrIpv4 String
The source IPv4 CIDR range.
cidrIpv6 String
The source IPv6 CIDR range.
description String
The security group rule description.
fromPort Number
The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
ipProtocol String
The IP protocol name or number. Use -1 to specify all protocols. Note that if ip_protocol is set to -1, it translates to all protocols, all port ranges, and from_port and to_port values should not be defined.
prefixListId String
The ID of the source prefix list.
referencedSecurityGroupId String
The source security group that is referenced in the rule.
securityGroupId String
The ID of the security group.
securityGroupRuleId String
The ID of the security group rule.
tags Map<String>
A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

toPort Number
The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.

Import

Using pulumi import, import security group ingress rules using the security_group_rule_id. For example:

$ pulumi import aws:vpc/securityGroupIngressRule:SecurityGroupIngressRule example sgr-02108b27edd666983
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.