class PrefixList (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.EC2.PrefixList |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#PrefixList |
Java | software.amazon.awscdk.services.ec2.PrefixList |
Python | aws_cdk.aws_ec2.PrefixList |
TypeScript (source) | aws-cdk-lib » aws_ec2 » PrefixList |
Implements
IConstruct, IDependable, IResource, IPrefix, IConnectable, IPeer, IPrefix
A managed prefix list.
Example
ec2.PrefixList.fromLookup(this, 'PrefixListFromName', {
prefixListName: 'com.amazonaws.global.cloudfront.origin-facing',
});
Initializer
new PrefixList(scope: Construct, id: string, props?: PrefixListProps)
Parameters
- scope
Construct - id
string - props
PrefixList Props
Construct Props
| Name | Type | Description |
|---|---|---|
| address | Address | The address family of the prefix list. |
| entries? | Entry[] | The list of entries for the prefix list. |
| max | number | The maximum number of entries for the prefix list. |
| prefix | string | The name of the prefix list. |
addressFamily?
Type:
Address
(optional, default: AddressFamily.IP_V4)
The address family of the prefix list.
entries?
Type:
Entry[]
(optional, default: [])
The list of entries for the prefix list.
maxEntries?
Type:
number
(optional, default: Automatically-calculated)
The maximum number of entries for the prefix list.
prefixListName?
Type:
string
(optional, default: None)
The name of the prefix list.
Properties
| Name | Type | Description |
|---|---|---|
| address | string | The address family of the prefix list. |
| can | boolean | Whether the rule can be inlined into a SecurityGroup or not. |
| connections | Connections | The network connections associated with this resource. |
| env | Resource | The environment this resource belongs to. |
| node | Node | The tree node. |
| owner | string | The owner ID of the prefix list. |
| prefix | string | The ARN of the prefix list. |
| prefix | string | The ID of the prefix list. |
| prefix | string | The name of the prefix list. |
| prefix | Prefix | A reference to a PrefixList resource. |
| stack | Stack | The stack in which this resource is defined. |
| unique | string | A unique identifier for this connection peer. |
| version | number | The version of the prefix list. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
addressFamily
Type:
string
The address family of the prefix list.
canInlineRule
Type:
boolean
Whether the rule can be inlined into a SecurityGroup or not.
connections
Type:
Connections
The network connections associated with this resource.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
ownerId
Type:
string
The owner ID of the prefix list.
prefixListArn
Type:
string
The ARN of the prefix list.
prefixListId
Type:
string
The ID of the prefix list.
prefixListName
Type:
string
The name of the prefix list.
prefixListRef
Type:
Prefix
A reference to a PrefixList resource.
stack
Type:
Stack
The stack in which this resource is defined.
uniqueId
Type:
string
A unique identifier for this connection peer.
version
Type:
number
The version of the prefix list.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| apply | Apply the given removal policy to this resource. |
| to | Produce the egress rule JSON for the given connection. |
| to | Produce the ingress rule JSON for the given connection. |
| to | Returns a string representation of this construct. |
| static from | Look up prefix list by name. |
| static from | Look up prefix list by id. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
toEgressRuleConfig()
public toEgressRuleConfig(): any
Returns
any
Produce the egress rule JSON for the given connection.
toIngressRuleConfig()
public toIngressRuleConfig(): any
Returns
any
Produce the ingress rule JSON for the given connection.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromLookup(scope, id, options)
public static fromLookup(scope: Construct, id: string, options: PrefixListLookupOptions): IPrefixList
Parameters
- scope
Construct - id
string - options
PrefixList Lookup Options
Returns
Look up prefix list by name.
static fromPrefixListId(scope, id, prefixListId)
public static fromPrefixListId(scope: Construct, id: string, prefixListId: string): IPrefixList
Parameters
- scope
Construct - id
string - prefixListId
string
Returns
Look up prefix list by id.

.NET
Go
Java
Python
TypeScript (