Skip to content
v2.278.0

RuleScope Struct ​

The scope and id in which a given SecurityGroup rule should be defined.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';

declare const securityGroup: ec2.SecurityGroup;
const ruleScope: ec2.RuleScope = {
  id: 'id',
  scope: securityGroup,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

# security_group: ec2.SecurityGroup

rule_scope = ec2.RuleScope(
    id="id",
    scope=security_group
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

SecurityGroup securityGroup;

RuleScope ruleScope = RuleScope.builder()
        .id("id")
        .scope(securityGroup)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

SecurityGroup securityGroup;

var ruleScope = new RuleScope {
    Id = "id",
    Scope = securityGroup
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var securityGroup SecurityGroup

ruleScope := &RuleScope{
	Id: jsii.String("id"),
	Scope: securityGroup,
}

Properties ​

idstringidstridStringIdstringId*string required #
The construct ID to use for the rule.
The SecurityGroup in which a rule should be scoped.