AWS v6.71.0 published on Friday, Mar 7, 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<GetSecurity Group Rule Filter> 
- Configuration block(s) for filtering. Detailed below.
- SecurityGroup stringRule Id 
- ID of the security group rule to select.
- Filters
[]GetSecurity Group Rule Filter 
- Configuration block(s) for filtering. Detailed below.
- SecurityGroup stringRule Id 
- ID of the security group rule to select.
- filters
List<GetSecurity Group Rule Filter> 
- Configuration block(s) for filtering. Detailed below.
- securityGroup StringRule Id 
- ID of the security group rule to select.
- filters
GetSecurity Group Rule Filter[] 
- Configuration block(s) for filtering. Detailed below.
- securityGroup stringRule Id 
- ID of the security group rule to select.
- filters
Sequence[GetSecurity 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.
- securityGroup 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.
- 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 -1to specify all protocols.
- IsEgress bool
- Indicates whether the security group rule is an outbound rule.
- PrefixList stringId 
- The ID of the destination prefix list.
- ReferencedSecurity stringGroup Id 
- The destination security group that is referenced in the rule.
- SecurityGroup stringId 
- The ID of the security group.
- SecurityGroup stringRule Id 
- 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<GetSecurity Group Rule Filter> 
- 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 -1to specify all protocols.
- IsEgress bool
- Indicates whether the security group rule is an outbound rule.
- PrefixList stringId 
- The ID of the destination prefix list.
- ReferencedSecurity stringGroup Id 
- The destination security group that is referenced in the rule.
- SecurityGroup stringId 
- The ID of the security group.
- SecurityGroup stringRule Id 
- 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
[]GetSecurity Group Rule Filter 
- 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 -1to specify all protocols.
- isEgress Boolean
- Indicates whether the security group rule is an outbound rule.
- prefixList StringId 
- The ID of the destination prefix list.
- referencedSecurity StringGroup Id 
- The destination security group that is referenced in the rule.
- securityGroup StringId 
- The ID of the security group.
- securityGroup StringRule Id 
- 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<GetSecurity Group Rule Filter> 
- 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 -1to specify all protocols.
- isEgress boolean
- Indicates whether the security group rule is an outbound rule.
- prefixList stringId 
- The ID of the destination prefix list.
- referencedSecurity stringGroup Id 
- The destination security group that is referenced in the rule.
- securityGroup stringId 
- The ID of the security group.
- securityGroup stringRule Id 
- {[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
GetSecurity 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[GetSecurity Group Rule Filter] 
- 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 -1to specify all protocols.
- isEgress Boolean
- Indicates whether the security group rule is an outbound rule.
- prefixList StringId 
- The ID of the destination prefix list.
- referencedSecurity StringGroup Id 
- The destination security group that is referenced in the rule.
- securityGroup StringId 
- The ID of the security group.
- securityGroup StringRule Id 
- 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 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.