Skip to content
v2.273.0

PrefixList L2 construct ​

A managed prefix list.

Example ​

ts
ec2.PrefixList.fromLookup(this, 'PrefixListFromName', {
  prefixListName: 'com.amazonaws.global.cloudfront.origin-facing',
});
python
ec2.PrefixList.from_lookup(self, "PrefixListFromName",
    prefix_list_name="com.amazonaws.global.cloudfront.origin-facing"
)
java
PrefixList.fromLookup(this, "PrefixListFromName", PrefixListLookupOptions.builder()
        .prefixListName("com.amazonaws.global.cloudfront.origin-facing")
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
PrefixList.FromLookup(this, "PrefixListFromName", new PrefixListLookupOptions {
    PrefixListName = "com.amazonaws.global.cloudfront.origin-facing"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
ec2.PrefixList_FromLookup(this, jsii.String("PrefixListFromName"), &PrefixListLookupOptions{
	PrefixListName: jsii.String("com.amazonaws.global.cloudfront.origin-facing"),
})

Initializer ​

ts
new PrefixList(scope: Construct, id: string, props?: PrefixListProps)
python
PrefixList(scope: Construct, id: str, props: typing.Optional[PrefixListProps] = None)
java
new PrefixList(Construct scope, String id, PrefixListProps props)
csharp
new PrefixList(Construct scope, string id, PrefixListProps? props = null)
go
NewPrefixList(Scope Construct, Id *string, Props PrefixListProps)

Construct Props ​

addressFamilyAddressFamilyaddress_familyAddressFamilyaddressFamilyAddressFamilyAddressFamilyAddressFamilyAddressFamilyAddressFamily= AddressFamily.IP_V4#
The address family of the prefix list.
entriesCfnPrefixList.EntryProperty[]entriestyping.List[EntryProperty]entriesList<EntryProperty>EntriesEntryProperty[]Entries*[]EntryProperty= []#
The list of entries for the prefix list.
maxEntriesnumbermax_entriesint | floatmaxEntriesNumberMaxEntriesdoubleMaxEntries*float64= Automatically-calculated#
The maximum number of entries for the prefix list.
prefixListNamestringprefix_list_namestrprefixListNameStringPrefixListNamestringPrefixListName*string= None#
The name of the prefix list.

Properties ​

addressFamilystringaddress_familystraddressFamilyStringAddressFamilystringAddressFamily*stringrequired#
The address family of the prefix list.
canInlineRulebooleancan_inline_ruleboolcanInlineRuleBooleanCanInlineRuleboolCanInlineRule*boolrequired#
Whether the rule can be inlined into a SecurityGroup or not.
connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#
The network connections associated with this resource.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
ownerIdstringowner_idstrownerIdStringOwnerIdstringOwnerId*stringrequired#
The owner ID of the prefix list.
prefixListArnstringprefix_list_arnstrprefixListArnStringPrefixListArnstringPrefixListArn*stringrequired#
The ARN of the prefix list.
prefixListIdstringprefix_list_idstrprefixListIdStringPrefixListIdstringPrefixListId*stringrequired#
The ID of the prefix list.
prefixListNamestringprefix_list_namestrprefixListNameStringPrefixListNamestringPrefixListName*stringrequired#
The name of the prefix list.
prefixListRefPrefixListReferenceprefix_list_refPrefixListReferenceprefixListRefPrefixListReferencePrefixListRefPrefixListReferencePrefixListRefPrefixListReferencerequired#
A reference to a PrefixList resource.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
uniqueIdstringunique_idstruniqueIdStringUniqueIdstringUniqueId*stringrequired#
A unique identifier for this connection peer.
versionnumberversionint | floatversionNumberVersiondoubleVersion*float64required#
The version of the prefix list.

Methods ​

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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).

fromLookup(scope: Construct, id: string, options: PrefixListLookupOptions): IPrefixList@staticmethod def from_lookup(scope: Construct, id: str, options: PrefixListLookupOptions) -> IPrefixListpublic static IPrefixList fromLookup(Construct scope, String id, PrefixListLookupOptions options)public static IPrefixList FromLookup(Construct scope, string id, PrefixListLookupOptions options)func FromLookup(Scope Construct, Id *string, Options PrefixListLookupOptions) IPrefixListstatic#
Look up prefix list by name.
fromPrefixListId(scope: Construct, id: string, prefixListId: string): IPrefixList@staticmethod def from_prefix_list_id(scope: Construct, id: str, prefix_list_id: str) -> IPrefixListpublic static IPrefixList fromPrefixListId(Construct scope, String id, String prefixListId)public static IPrefixList FromPrefixListId(Construct scope, string id, string prefixListId)func FromPrefixListId(Scope Construct, Id *string, PrefixListId *string) IPrefixListstatic#
Look up prefix list by id.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
toEgressRuleConfig(): EgressRuleConfigdef to_egress_rule_config(self, ) -> EgressRuleConfigpublic EgressRuleConfig toEgressRuleConfig()public EgressRuleConfig ToEgressRuleConfig()func ToEgressRuleConfig() EgressRuleConfig#
Produce the egress rule JSON for the given connection.
toIngressRuleConfig(): IngressRuleConfigdef to_ingress_rule_config(self, ) -> IngressRuleConfigpublic IngressRuleConfig toIngressRuleConfig()public IngressRuleConfig ToIngressRuleConfig()func ToIngressRuleConfig() IngressRuleConfig#
Produce the ingress rule JSON for the given connection.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.