AWS v6.77.1 published on Friday, Apr 18, 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,
});
import pulumi
import pulumi_aws as aws
example = aws.vpc.get_security_group_rule(security_group_rule_id=security_group_rule_id)
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
	})
}
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,
    });
});
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());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:vpc:getSecurityGroupRule
      arguments:
        securityGroupRuleId: ${securityGroupRuleId}
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>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]func GetSecurityGroupRule(ctx *Context, args *GetSecurityGroupRuleArgs, opts ...InvokeOption) (*GetSecurityGroupRuleResult, error)
func GetSecurityGroupRuleOutput(ctx *Context, args *GetSecurityGroupRuleOutputArgs, opts ...InvokeOption) GetSecurityGroupRuleResultOutput> 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)
}public static CompletableFuture<GetSecurityGroupRuleResult> getSecurityGroupRule(GetSecurityGroupRuleArgs args, InvokeOptions options)
public static Output<GetSecurityGroupRuleResult> getSecurityGroupRule(GetSecurityGroupRuleArgs args, InvokeOptions options)
fn::invoke:
  function: aws:vpc/getSecurityGroupRule:getSecurityGroupRule
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<Get
Security Group Rule Filter>  - Configuration block(s) for filtering. Detailed below.
 - Security
Group stringRule Id  - ID of the security group rule to select.
 
- Filters
[]Get
Security Group Rule Filter  - Configuration block(s) for filtering. Detailed below.
 - Security
Group stringRule Id  - ID of the security group rule to select.
 
- filters
List<Get
Security Group Rule Filter>  - Configuration block(s) for filtering. Detailed below.
 - security
Group StringRule Id  - ID of the security group rule to select.
 
- filters
Get
Security Group Rule Filter[]  - Configuration block(s) for filtering. Detailed below.
 - security
Group stringRule Id  - ID of the security group rule to select.
 
- filters
Sequence[Get
Security Group Rule Filter]  - Configuration block(s) for filtering. Detailed below.
 - security_
group_ strrule_ id  - ID of the security group rule to select.
 
- filters List<Property Map>
 - Configuration block(s) for filtering. Detailed below.
 - security
Group StringRule Id  - 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.
 - Cidr
Ipv4 string - The destination IPv4 CIDR range.
 - Cidr
Ipv6 string - The destination IPv6 CIDR range.
 - Description string
 - 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 string
 - Ip
Protocol string - The IP protocol name or number. Use 
-1to specify all protocols. - Is
Egress bool - Indicates whether the security group rule is an outbound rule.
 - Prefix
List stringId  - The ID of the destination prefix list.
 - Referenced
Security stringGroup Id  - The destination security group that is referenced in the rule.
 - Security
Group stringId  - The ID of the security group.
 - Security
Group stringRule Id  - Dictionary<string, string>
 - 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
List<Get
Security Group Rule Filter>  
- Arn string
 - The Amazon Resource Name (ARN) of the security group rule.
 - Cidr
Ipv4 string - The destination IPv4 CIDR range.
 - Cidr
Ipv6 string - The destination IPv6 CIDR range.
 - Description string
 - 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 string
 - Ip
Protocol string - The IP protocol name or number. Use 
-1to specify all protocols. - Is
Egress bool - Indicates whether the security group rule is an outbound rule.
 - Prefix
List stringId  - The ID of the destination prefix list.
 - Referenced
Security stringGroup Id  - The destination security group that is referenced in the rule.
 - Security
Group stringId  - The ID of the security group.
 - Security
Group stringRule Id  - map[string]string
 - 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
[]Get
Security Group Rule Filter  
- arn String
 - The Amazon Resource Name (ARN) of the security group rule.
 - cidr
Ipv4 String - The destination IPv4 CIDR range.
 - cidr
Ipv6 String - The destination IPv6 CIDR range.
 - description String
 - The security group rule description.
 - from
Port Integer - The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
 - id String
 - ip
Protocol String - The IP protocol name or number. Use 
-1to specify all protocols. - is
Egress Boolean - Indicates whether the security group rule is an outbound rule.
 - prefix
List StringId  - The ID of the destination prefix list.
 - referenced
Security StringGroup Id  - The destination security group that is referenced in the rule.
 - security
Group StringId  - The ID of the security group.
 - security
Group StringRule Id  - Map<String,String>
 - A map of tags assigned to the resource.
 - to
Port Integer - (Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
 - filters
List<Get
Security Group Rule Filter>  
- arn string
 - The Amazon Resource Name (ARN) of the security group rule.
 - cidr
Ipv4 string - The destination IPv4 CIDR range.
 - cidr
Ipv6 string - The destination IPv6 CIDR range.
 - description string
 - The security group rule description.
 - from
Port number - The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
 - id string
 - ip
Protocol string - The IP protocol name or number. Use 
-1to specify all protocols. - is
Egress boolean - Indicates whether the security group rule is an outbound rule.
 - prefix
List stringId  - The ID of the destination prefix list.
 - referenced
Security stringGroup Id  - The destination security group that is referenced in the rule.
 - security
Group stringId  - The ID of the security group.
 - security
Group stringRule Id  - {[key: string]: string}
 - A map of tags assigned to the resource.
 - to
Port number - (Optional) The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
 - filters
Get
Security Group Rule Filter[]  
- 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 
-1to specify all protocols. - is_
egress bool - Indicates whether the security group rule is an outbound rule.
 - prefix_
list_ strid  - The ID of the destination prefix list.
 - referenced_
security_ strgroup_ id  - The destination security group that is referenced in the rule.
 - security_
group_ strid  - The ID of the security group.
 - security_
group_ strrule_ id  - 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[Get
Security Group Rule Filter]  
- arn String
 - The Amazon Resource Name (ARN) of the security group rule.
 - cidr
Ipv4 String - The destination IPv4 CIDR range.
 - cidr
Ipv6 String - The destination IPv6 CIDR range.
 - description String
 - The security group rule description.
 - from
Port Number - The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
 - id String
 - ip
Protocol String - The IP protocol name or number. Use 
-1to specify all protocols. - is
Egress Boolean - Indicates whether the security group rule is an outbound rule.
 - prefix
List StringId  - The ID of the destination prefix list.
 - referenced
Security StringGroup Id  - The destination security group that is referenced in the rule.
 - security
Group StringId  - The ID of the security group.
 - security
Group StringRule Id  - Map<String>
 - A map of tags assigned to the resource.
 - to
Port 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 string
 - Name of the filter field. Valid values can be found in the EC2 
DescribeSecurityGroupRulesAPI Reference. - Values List<string>
 - Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
 
- Name string
 - Name of the filter field. Valid values can be found in the EC2 
DescribeSecurityGroupRulesAPI Reference. - Values []string
 - Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
 
- name String
 - Name of the filter field. Valid values can be found in the EC2 
DescribeSecurityGroupRulesAPI Reference. - values List<String>
 - Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
 
- name string
 - Name of the filter field. Valid values can be found in the EC2 
DescribeSecurityGroupRulesAPI Reference. - values string[]
 - Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
 
- name str
 - Name of the filter field. Valid values can be found in the EC2 
DescribeSecurityGroupRulesAPI Reference. - values Sequence[str]
 - Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
 
- name String
 - Name of the filter field. Valid values can be found in the EC2 
DescribeSecurityGroupRulesAPI Reference. - values 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 
awsTerraform Provider.