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

aws.vpc.getSecurityGroupRule

Explore with Pulumi AI

aws.vpc.getSecurityGroupRule provides details about a specific security group rule.

Example Usage

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

const example = aws.vpc.getSecurityGroupRule({
    securityGroupRuleId: securityGroupRuleId,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.vpc.get_security_group_rule(security_group_rule_id=security_group_rule_id)
Copy
package main

import (
	"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 {
		_, err := vpc.GetSecurityGroupRule(ctx, &vpc.GetSecurityGroupRuleArgs{
			SecurityGroupRuleId: pulumi.StringRef(securityGroupRuleId),
		}, nil)
		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 = Aws.Vpc.GetSecurityGroupRule.Invoke(new()
    {
        SecurityGroupRuleId = securityGroupRuleId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.vpc.VpcFunctions;
import com.pulumi.aws.vpc.inputs.GetSecurityGroupRuleArgs;
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) {
        final var example = VpcFunctions.getSecurityGroupRule(GetSecurityGroupRuleArgs.builder()
            .securityGroupRuleId(securityGroupRuleId)
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:vpc:getSecurityGroupRule
      arguments:
        securityGroupRuleId: ${securityGroupRuleId}
Copy

Using getSecurityGroupRule

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getSecurityGroupRule(args: GetSecurityGroupRuleArgs, opts?: InvokeOptions): Promise<GetSecurityGroupRuleResult>
function getSecurityGroupRuleOutput(args: GetSecurityGroupRuleOutputArgs, opts?: InvokeOptions): Output<GetSecurityGroupRuleResult>
Copy
def get_security_group_rule(filters: Optional[Sequence[GetSecurityGroupRuleFilter]] = None,
                            security_group_rule_id: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetSecurityGroupRuleResult
def get_security_group_rule_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSecurityGroupRuleFilterArgs]]]] = None,
                            security_group_rule_id: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetSecurityGroupRuleResult]
Copy
func GetSecurityGroupRule(ctx *Context, args *GetSecurityGroupRuleArgs, opts ...InvokeOption) (*GetSecurityGroupRuleResult, error)
func GetSecurityGroupRuleOutput(ctx *Context, args *GetSecurityGroupRuleOutputArgs, opts ...InvokeOption) GetSecurityGroupRuleResultOutput
Copy

> Note: This function is named GetSecurityGroupRule in the Go SDK.

public static class GetSecurityGroupRule 
{
    public static Task<GetSecurityGroupRuleResult> InvokeAsync(GetSecurityGroupRuleArgs args, InvokeOptions? opts = null)
    public static Output<GetSecurityGroupRuleResult> Invoke(GetSecurityGroupRuleInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecurityGroupRuleResult> getSecurityGroupRule(GetSecurityGroupRuleArgs args, InvokeOptions options)
public static Output<GetSecurityGroupRuleResult> getSecurityGroupRule(GetSecurityGroupRuleArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:vpc/getSecurityGroupRule:getSecurityGroupRule
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetSecurityGroupRuleFilter>
Configuration block(s) for filtering. Detailed below.
SecurityGroupRuleId string
ID of the security group rule to select.
Filters []GetSecurityGroupRuleFilter
Configuration block(s) for filtering. Detailed below.
SecurityGroupRuleId string
ID of the security group rule to select.
filters List<GetSecurityGroupRuleFilter>
Configuration block(s) for filtering. Detailed below.
securityGroupRuleId String
ID of the security group rule to select.
filters GetSecurityGroupRuleFilter[]
Configuration block(s) for filtering. Detailed below.
securityGroupRuleId string
ID of the security group rule to select.
filters Sequence[GetSecurityGroupRuleFilter]
Configuration block(s) for filtering. Detailed below.
security_group_rule_id str
ID of the security group rule to select.
filters List<Property Map>
Configuration block(s) for filtering. Detailed below.
securityGroupRuleId String
ID of the security group rule to select.

getSecurityGroupRule Result

The following output properties are available:

Arn string
The Amazon Resource Name (ARN) of the security group rule.
CidrIpv4 string
The destination IPv4 CIDR range.
CidrIpv6 string
The destination 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.
Id string
IpProtocol string
The IP protocol name or number. Use -1 to specify all protocols.
IsEgress bool
Indicates whether the security group rule is an outbound rule.
PrefixListId string
The ID of the destination prefix list.
ReferencedSecurityGroupId string
The destination security group that is referenced in the rule.
SecurityGroupId string
The ID of the security group.
SecurityGroupRuleId string
Tags Dictionary<string, string>
A map of tags assigned to the resource.
ToPort int
(Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
Filters List<GetSecurityGroupRuleFilter>
Arn string
The Amazon Resource Name (ARN) of the security group rule.
CidrIpv4 string
The destination IPv4 CIDR range.
CidrIpv6 string
The destination 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.
Id string
IpProtocol string
The IP protocol name or number. Use -1 to specify all protocols.
IsEgress bool
Indicates whether the security group rule is an outbound rule.
PrefixListId string
The ID of the destination prefix list.
ReferencedSecurityGroupId string
The destination security group that is referenced in the rule.
SecurityGroupId string
The ID of the security group.
SecurityGroupRuleId string
Tags map[string]string
A map of tags assigned to the resource.
ToPort int
(Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
Filters []GetSecurityGroupRuleFilter
arn String
The Amazon Resource Name (ARN) of the security group rule.
cidrIpv4 String
The destination IPv4 CIDR range.
cidrIpv6 String
The destination 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.
id String
ipProtocol String
The IP protocol name or number. Use -1 to specify all protocols.
isEgress Boolean
Indicates whether the security group rule is an outbound rule.
prefixListId String
The ID of the destination prefix list.
referencedSecurityGroupId String
The destination security group that is referenced in the rule.
securityGroupId String
The ID of the security group.
securityGroupRuleId String
tags Map<String,String>
A map of tags assigned to the resource.
toPort Integer
(Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
filters List<GetSecurityGroupRuleFilter>
arn string
The Amazon Resource Name (ARN) of the security group rule.
cidrIpv4 string
The destination IPv4 CIDR range.
cidrIpv6 string
The destination 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.
id string
ipProtocol string
The IP protocol name or number. Use -1 to specify all protocols.
isEgress boolean
Indicates whether the security group rule is an outbound rule.
prefixListId string
The ID of the destination prefix list.
referencedSecurityGroupId string
The destination security group that is referenced in the rule.
securityGroupId string
The ID of the security group.
securityGroupRuleId string
tags {[key: string]: string}
A map of tags assigned to the resource.
toPort number
(Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
filters GetSecurityGroupRuleFilter[]
arn str
The Amazon Resource Name (ARN) of the security group rule.
cidr_ipv4 str
The destination IPv4 CIDR range.
cidr_ipv6 str
The destination 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.
id str
ip_protocol str
The IP protocol name or number. Use -1 to specify all protocols.
is_egress bool
Indicates whether the security group rule is an outbound rule.
prefix_list_id str
The ID of the destination prefix list.
referenced_security_group_id str
The destination security group that is referenced in the rule.
security_group_id str
The ID of the security group.
security_group_rule_id str
tags Mapping[str, str]
A map of tags assigned to the resource.
to_port int
(Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
filters Sequence[GetSecurityGroupRuleFilter]
arn String
The Amazon Resource Name (ARN) of the security group rule.
cidrIpv4 String
The destination IPv4 CIDR range.
cidrIpv6 String
The destination 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.
id String
ipProtocol String
The IP protocol name or number. Use -1 to specify all protocols.
isEgress Boolean
Indicates whether the security group rule is an outbound rule.
prefixListId String
The ID of the destination prefix list.
referencedSecurityGroupId String
The destination security group that is referenced in the rule.
securityGroupId String
The ID of the security group.
securityGroupRuleId String
tags Map<String>
A map of tags assigned to the resource.
toPort Number
(Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
filters List<Property Map>

Supporting Types

GetSecurityGroupRuleFilter

Name This property is required. string
Name of the filter field. Valid values can be found in the EC2 DescribeSecurityGroupRules API Reference.
Values This property is required. List<string>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
Name This property is required. string
Name of the filter field. Valid values can be found in the EC2 DescribeSecurityGroupRules API Reference.
Values This property is required. []string
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. String
Name of the filter field. Valid values can be found in the EC2 DescribeSecurityGroupRules API Reference.
values This property is required. List<String>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. string
Name of the filter field. Valid values can be found in the EC2 DescribeSecurityGroupRules API Reference.
values This property is required. string[]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. str
Name of the filter field. Valid values can be found in the EC2 DescribeSecurityGroupRules API Reference.
values This property is required. Sequence[str]
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
name This property is required. String
Name of the filter field. Valid values can be found in the EC2 DescribeSecurityGroupRules API Reference.
values This property is required. List<String>
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.

Package Details

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