Class: AWSCDK::EC2::VPC
Overview
Define an AWS Virtual Private Cloud.
See the package-level documentation of this package for an overview of the various dimensions in which you can configure your VPC.
For example:
vpc = AWSCDK::EC2::VPC.new(self, "TheVPC", {
ip_addresses: AWSCDK::EC2::IPAddresses.cidr("10.0.0.0/16"),
})
# Iterate the private subnets
selection = vpc.select_subnets({
subnet_type: AWSCDK::EC2::SubnetType::PRIVATE_WITH_EGRESS,
})
selection[:subnets].each do |subnet|
end
Class Method Summary collapse
-
.DEFAULT_CIDR_RANGE ⇒ String
The default CIDR range used when creating VPCs.
-
.DEFAULT_SUBNETS ⇒ Array<AWSCDK::EC2::SubnetConfiguration>
The default subnet configuration.
-
.DEFAULT_SUBNETS_NO_NAT ⇒ Array<AWSCDK::EC2::SubnetConfiguration>
The default subnet configuration if natGateways specified to be 0.
-
.from_lookup(scope, id, options) ⇒ AWSCDK::EC2::IVPC
Import an existing VPC by querying the AWS environment this stack is deployed to.
-
.from_vpc_attributes(scope, id, attrs) ⇒ AWSCDK::EC2::IVPC
Import a VPC by supplying all attributes directly.
- .jsii_overridable_methods ⇒ Object
-
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
Instance Method Summary collapse
-
#add_client_vpn_endpoint(id, options) ⇒ AWSCDK::EC2::ClientVpnEndpoint
Adds a new client VPN endpoint to this VPC.
-
#add_flow_log(id, options = nil) ⇒ AWSCDK::EC2::FlowLog
Adds a new flow log to this VPC.
-
#add_gateway_endpoint(id, options) ⇒ AWSCDK::EC2::GatewayVPCEndpoint
Adds a new gateway endpoint to this VPC.
-
#add_interface_endpoint(id, options) ⇒ AWSCDK::EC2::InterfaceVPCEndpoint
Adds a new interface endpoint to this VPC.
-
#add_vpn_connection(id, options) ⇒ AWSCDK::EC2::VpnConnection
Adds a new VPN connection to this VPC.
-
#apply_cross_stack_reference_strength(strength) ⇒ void
Override the cross-stack reference strength for this resource.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#availability_zones ⇒ Array<String>
AZs for this VPC.
-
#dns_hostnames_enabled ⇒ Boolean
Indicates if instances launched in this VPC will have public DNS hostnames.
-
#dns_support_enabled ⇒ Boolean
Indicates if DNS support is enabled for this VPC.
-
#enable_vpn_gateway(options) ⇒ void
Adds a VPN Gateway to this VPC.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
- #generate_physical_name ⇒ String
-
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
bucket.bucketArn). -
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
bucket.bucketName). -
#incomplete_subnet_definition ⇒ Boolean
If this is set to true, don't error out on trying to select subnets.
- #incomplete_subnet_definition=(value) ⇒ Object
-
#initialize(scope, id, props = nil) ⇒ VPC
constructor
Vpc creates a VPC that spans a whole region.
-
#internet_connectivity_established ⇒ Constructs::IDependable
Dependencies for internet connectivity.
-
#internet_gateway_id ⇒ String?
Internet Gateway for the VPC.
-
#isolated_subnets ⇒ Array<AWSCDK::EC2::ISubnet>
List of isolated subnets in this VPC.
-
#node ⇒ Constructs::Node
The tree node.
-
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
-
#private_subnets ⇒ Array<AWSCDK::EC2::ISubnet>
List of private subnets in this VPC.
-
#public_subnets ⇒ Array<AWSCDK::EC2::ISubnet>
List of public subnets in this VPC.
-
#select_subnet_objects(selection = nil) ⇒ Array<AWSCDK::EC2::ISubnet>
Return the subnets appropriate for the placement strategy.
-
#select_subnets(selection = nil) ⇒ AWSCDK::EC2::SelectedSubnets
Returns IDs of selected subnets.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#vpc_arn ⇒ String
Arn of this VPC.
-
#vpc_cidr_block ⇒ String
CIDR range for this VPC.
- #vpc_cidr_block_associations ⇒ Array<String>
- #vpc_default_network_acl ⇒ String
- #vpc_default_security_group ⇒ String
-
#vpc_id ⇒ String
Identifier for this VPC.
- #vpc_ipv6_cidr_blocks ⇒ Array<String>
-
#vpc_ref ⇒ AWSCDK::Interfaces::AWSEC2::VPCReference
A reference to a VPC resource.
-
#vpn_gateway_id ⇒ String?
Returns the id of the VPN Gateway (if enabled).
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props = nil) ⇒ VPC
Vpc creates a VPC that spans a whole region.
It will automatically divide the provided VPC CIDR range, and create public and private subnets per Availability Zone. Network routing for the public subnets will be configured to allow outbound access directly via an Internet Gateway. Network routing for the private subnets will be configured to allow outbound access via a set of resilient NAT Gateways (one per AZ).
37 38 39 40 41 42 43 |
# File 'ec2/vpc.rb', line 37 def initialize(scope, id, props = nil) props = props.is_a?(Hash) ? ::AWSCDK::EC2::VPCProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlZwY1Byb3BzIn0=")), "props") unless props.nil? Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.DEFAULT_CIDR_RANGE ⇒ String
The default CIDR range used when creating VPCs.
This can be overridden using VpcProps when creating a VPCNetwork resource. e.g. new VpcResource(this, { cidr: '192.168.0.0./16' })
Note this is specific to the IPv4 CIDR.
188 189 190 |
# File 'ec2/vpc.rb', line 188 def self.DEFAULT_CIDR_RANGE() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.Vpc", "DEFAULT_CIDR_RANGE") end |
.DEFAULT_SUBNETS ⇒ Array<AWSCDK::EC2::SubnetConfiguration>
The default subnet configuration.
1 Public and 1 Private subnet per AZ evenly split
197 198 199 |
# File 'ec2/vpc.rb', line 197 def self.DEFAULT_SUBNETS() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.Vpc", "DEFAULT_SUBNETS") end |
.DEFAULT_SUBNETS_NO_NAT ⇒ Array<AWSCDK::EC2::SubnetConfiguration>
The default subnet configuration if natGateways specified to be 0.
1 Public and 1 Isolated Subnet per AZ evenly split
206 207 208 |
# File 'ec2/vpc.rb', line 206 def self.DEFAULT_SUBNETS_NO_NAT() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.Vpc", "DEFAULT_SUBNETS_NO_NAT") end |
.from_lookup(scope, id, options) ⇒ AWSCDK::EC2::IVPC
Import an existing VPC by querying the AWS environment this stack is deployed to.
This function only needs to be used to use VPCs not defined in your CDK
application. If you are looking to share a VPC between stacks, you can
pass the Vpc object between stacks and use it as normal.
Calling this method will lead to a lookup when the CDK CLI is executed. You can therefore not use any values that will only be available at CloudFormation execution time (i.e., Tokens).
The VPC information will be cached in cdk.context.json and the same VPC
will be used on future runs. To refresh the lookup, you will have to
evict the value from the cache using the cdk context command. See
https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.
106 107 108 109 110 111 112 |
# File 'ec2/vpc.rb', line 106 def self.from_lookup(scope, id, ) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EC2::VPCLookupOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlZwY0xvb2t1cE9wdGlvbnMifQ==")), "options") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.Vpc", "fromLookup", [scope, id, ]) end |
.from_vpc_attributes(scope, id, attrs) ⇒ AWSCDK::EC2::IVPC
Import a VPC by supplying all attributes directly.
NOTE: using from_vpc_attributes() with deploy-time parameters (like a Fn.importValue() or
CfnParameter to represent a list of subnet IDs) sometimes accidentally works. It happens
to work for constructs that need a list of subnets (like AutoScalingGroup and eks.Cluster)
but it does not work for constructs that need individual subnets (like
Instance). See https://github.com/aws/aws-cdk/issues/4118 for more
information.
Prefer to use Vpc.fromLookup() instead.
129 130 131 132 133 134 135 |
# File 'ec2/vpc.rb', line 129 def self.from_vpc_attributes(scope, id, attrs) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") attrs = attrs.is_a?(Hash) ? ::AWSCDK::EC2::VPCAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlZwY0F0dHJpYnV0ZXMifQ==")), "attrs") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.Vpc", "fromVpcAttributes", [scope, id, attrs]) end |
.jsii_overridable_methods ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'ec2/vpc.rb', line 45 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :physical_name => { kind: :property, name: "physicalName", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :availability_zones => { kind: :property, name: "availabilityZones", is_optional: false }, :dns_hostnames_enabled => { kind: :property, name: "dnsHostnamesEnabled", is_optional: false }, :dns_support_enabled => { kind: :property, name: "dnsSupportEnabled", is_optional: false }, :internet_connectivity_established => { kind: :property, name: "internetConnectivityEstablished", is_optional: false }, :isolated_subnets => { kind: :property, name: "isolatedSubnets", is_optional: false }, :private_subnets => { kind: :property, name: "privateSubnets", is_optional: false }, :public_subnets => { kind: :property, name: "publicSubnets", is_optional: false }, :vpc_arn => { kind: :property, name: "vpcArn", is_optional: false }, :vpc_cidr_block => { kind: :property, name: "vpcCidrBlock", is_optional: false }, :vpc_cidr_block_associations => { kind: :property, name: "vpcCidrBlockAssociations", is_optional: false }, :vpc_default_network_acl => { kind: :property, name: "vpcDefaultNetworkAcl", is_optional: false }, :vpc_default_security_group => { kind: :property, name: "vpcDefaultSecurityGroup", is_optional: false }, :vpc_id => { kind: :property, name: "vpcId", is_optional: false }, :vpc_ipv6_cidr_blocks => { kind: :property, name: "vpcIpv6CidrBlocks", is_optional: false }, :vpc_ref => { kind: :property, name: "vpcRef", is_optional: false }, :internet_gateway_id => { kind: :property, name: "internetGatewayId", is_optional: true }, :vpn_gateway_id => { kind: :property, name: "vpnGatewayId", is_optional: true }, :incomplete_subnet_definition => { kind: :property, name: "incompleteSubnetDefinition", is_optional: false }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false }, :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false }, :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false }, :add_client_vpn_endpoint => { kind: :method, name: "addClientVpnEndpoint", is_optional: false }, :add_flow_log => { kind: :method, name: "addFlowLog", is_optional: false }, :add_gateway_endpoint => { kind: :method, name: "addGatewayEndpoint", is_optional: false }, :add_interface_endpoint => { kind: :method, name: "addInterfaceEndpoint", is_optional: false }, :add_vpn_connection => { kind: :method, name: "addVpnConnection", is_optional: false }, :enable_vpn_gateway => { kind: :method, name: "enableVpnGateway", is_optional: false }, :select_subnet_objects => { kind: :method, name: "selectSubnetObjects", is_optional: false }, :select_subnets => { kind: :method, name: "selectSubnets", is_optional: false }, } end |
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
213 214 215 |
# File 'ec2/vpc.rb', line 213 def self.PROPERTY_INJECTION_ID() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.Vpc", "PROPERTY_INJECTION_ID") end |
Instance Method Details
#add_client_vpn_endpoint(id, options) ⇒ AWSCDK::EC2::ClientVpnEndpoint
Adds a new client VPN endpoint to this VPC.
438 439 440 441 442 443 |
# File 'ec2/vpc.rb', line 438 def add_client_vpn_endpoint(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EC2::ClientVpnEndpointOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNsaWVudFZwbkVuZHBvaW50T3B0aW9ucyJ9")), "options") jsii_call_method("addClientVpnEndpoint", [id, ]) end |
#add_flow_log(id, options = nil) ⇒ AWSCDK::EC2::FlowLog
Adds a new flow log to this VPC.
450 451 452 453 454 455 |
# File 'ec2/vpc.rb', line 450 def add_flow_log(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EC2::FlowLogOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkZsb3dMb2dPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("addFlowLog", [id, ]) end |
#add_gateway_endpoint(id, options) ⇒ AWSCDK::EC2::GatewayVPCEndpoint
Adds a new gateway endpoint to this VPC.
462 463 464 465 466 467 |
# File 'ec2/vpc.rb', line 462 def add_gateway_endpoint(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EC2::GatewayVPCEndpointOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkdhdGV3YXlWcGNFbmRwb2ludE9wdGlvbnMifQ==")), "options") jsii_call_method("addGatewayEndpoint", [id, ]) end |
#add_interface_endpoint(id, options) ⇒ AWSCDK::EC2::InterfaceVPCEndpoint
Adds a new interface endpoint to this VPC.
474 475 476 477 478 479 |
# File 'ec2/vpc.rb', line 474 def add_interface_endpoint(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EC2::InterfaceVPCEndpointOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkludGVyZmFjZVZwY0VuZHBvaW50T3B0aW9ucyJ9")), "options") jsii_call_method("addInterfaceEndpoint", [id, ]) end |
#add_vpn_connection(id, options) ⇒ AWSCDK::EC2::VpnConnection
Adds a new VPN connection to this VPC.
486 487 488 489 490 491 |
# File 'ec2/vpc.rb', line 486 def add_vpn_connection(id, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::EC2::VpnConnectionOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlZwbkNvbm5lY3Rpb25PcHRpb25zIn0=")), "options") jsii_call_method("addVpnConnection", [id, ]) end |
#apply_cross_stack_reference_strength(strength) ⇒ void
This method returns an undefined value.
Override the cross-stack reference strength for this resource.
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.
376 377 378 379 |
# File 'ec2/vpc.rb', line 376 def apply_cross_stack_reference_strength(strength) Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength") jsii_call_method("applyCrossStackReferenceStrength", [strength]) end |
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
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).
393 394 395 396 |
# File 'ec2/vpc.rb', line 393 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#availability_zones ⇒ Array<String>
AZs for this VPC.
220 221 222 |
# File 'ec2/vpc.rb', line 220 def availability_zones() jsii_get_property("availabilityZones") end |
#dns_hostnames_enabled ⇒ Boolean
Indicates if instances launched in this VPC will have public DNS hostnames.
227 228 229 |
# File 'ec2/vpc.rb', line 227 def dns_hostnames_enabled() jsii_get_property("dnsHostnamesEnabled") end |
#dns_support_enabled ⇒ Boolean
Indicates if DNS support is enabled for this VPC.
234 235 236 |
# File 'ec2/vpc.rb', line 234 def dns_support_enabled() jsii_get_property("dnsSupportEnabled") end |
#enable_vpn_gateway(options) ⇒ void
This method returns an undefined value.
Adds a VPN Gateway to this VPC.
497 498 499 500 501 |
# File 'ec2/vpc.rb', line 497 def enable_vpn_gateway() = .is_a?(Hash) ? ::AWSCDK::EC2::EnableVpnGatewayOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkVuYWJsZVZwbkdhdGV3YXlPcHRpb25zIn0=")), "options") jsii_call_method("enableVpnGateway", []) end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
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.
155 156 157 |
# File 'ec2/vpc.rb', line 155 def env() jsii_get_property("env") end |
#generate_physical_name ⇒ String
399 400 401 |
# File 'ec2/vpc.rb', line 399 def generate_physical_name() jsii_call_method("generatePhysicalName", []) end |
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).
Normally, this token will resolve to arn_attr, but if the resource is
referenced across environments, arn_components will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName in arn_components.
413 414 415 416 417 418 |
# File 'ec2/vpc.rb', line 413 def get_resource_arn_attribute(arn_attr, arn_components) Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr") arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents") jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components]) end |
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).
Normally, this token will resolve to name_attr, but if the resource is
referenced across environments, it will be resolved to this.physicalName,
which will be a concrete name.
428 429 430 431 |
# File 'ec2/vpc.rb', line 428 def get_resource_name_attribute(name_attr) Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr") jsii_call_method("getResourceNameAttribute", [name_attr]) end |
#incomplete_subnet_definition ⇒ Boolean
If this is set to true, don't error out on trying to select subnets.
334 335 336 |
# File 'ec2/vpc.rb', line 334 def incomplete_subnet_definition() jsii_get_property("incompleteSubnetDefinition") end |
#incomplete_subnet_definition=(value) ⇒ Object
338 339 340 341 |
# File 'ec2/vpc.rb', line 338 def incomplete_subnet_definition=(value) Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "incompleteSubnetDefinition") jsii_set_property("incompleteSubnetDefinition", value) end |
#internet_connectivity_established ⇒ Constructs::IDependable
Dependencies for internet connectivity.
241 242 243 |
# File 'ec2/vpc.rb', line 241 def internet_connectivity_established() jsii_get_property("internetConnectivityEstablished") end |
#internet_gateway_id ⇒ String?
Internet Gateway for the VPC.
Note that in case the VPC is configured only
with ISOLATED subnets, this attribute will be undefined.
320 321 322 |
# File 'ec2/vpc.rb', line 320 def internet_gateway_id() jsii_get_property("internetGatewayId") end |
#isolated_subnets ⇒ Array<AWSCDK::EC2::ISubnet>
List of isolated subnets in this VPC.
248 249 250 |
# File 'ec2/vpc.rb', line 248 def isolated_subnets() jsii_get_property("isolatedSubnets") end |
#node ⇒ Constructs::Node
The tree node.
140 141 142 |
# File 'ec2/vpc.rb', line 140 def node() jsii_get_property("node") end |
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
This value will resolve to one of the following:
- a concrete value (e.g.
"my-awesome-bucket") undefined, when a name should be generated by CloudFormation- a concrete name generated automatically during synthesis, in cross-environment scenarios.
169 170 171 |
# File 'ec2/vpc.rb', line 169 def physical_name() jsii_get_property("physicalName") end |
#private_subnets ⇒ Array<AWSCDK::EC2::ISubnet>
List of private subnets in this VPC.
255 256 257 |
# File 'ec2/vpc.rb', line 255 def private_subnets() jsii_get_property("privateSubnets") end |
#public_subnets ⇒ Array<AWSCDK::EC2::ISubnet>
List of public subnets in this VPC.
262 263 264 |
# File 'ec2/vpc.rb', line 262 def public_subnets() jsii_get_property("publicSubnets") end |
#select_subnet_objects(selection = nil) ⇒ Array<AWSCDK::EC2::ISubnet>
Return the subnets appropriate for the placement strategy.
507 508 509 510 511 |
# File 'ec2/vpc.rb', line 507 def select_subnet_objects(selection = nil) selection = selection.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**selection.transform_keys(&:to_sym)) : selection Jsii::Type.check_type(selection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "selection") unless selection.nil? jsii_call_method("selectSubnetObjects", [selection]) end |
#select_subnets(selection = nil) ⇒ AWSCDK::EC2::SelectedSubnets
Returns IDs of selected subnets.
517 518 519 520 521 |
# File 'ec2/vpc.rb', line 517 def select_subnets(selection = nil) selection = selection.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**selection.transform_keys(&:to_sym)) : selection Jsii::Type.check_type(selection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "selection") unless selection.nil? jsii_call_method("selectSubnets", [selection]) end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
176 177 178 |
# File 'ec2/vpc.rb', line 176 def stack() jsii_get_property("stack") end |
#to_string ⇒ String
Returns a string representation of this construct.
346 347 348 |
# File 'ec2/vpc.rb', line 346 def to_string() jsii_call_method("toString", []) end |
#vpc_arn ⇒ String
Arn of this VPC.
269 270 271 |
# File 'ec2/vpc.rb', line 269 def vpc_arn() jsii_get_property("vpcArn") end |
#vpc_cidr_block ⇒ String
CIDR range for this VPC.
276 277 278 |
# File 'ec2/vpc.rb', line 276 def vpc_cidr_block() jsii_get_property("vpcCidrBlock") end |
#vpc_cidr_block_associations ⇒ Array<String>
281 282 283 |
# File 'ec2/vpc.rb', line 281 def vpc_cidr_block_associations() jsii_get_property("vpcCidrBlockAssociations") end |
#vpc_default_network_acl ⇒ String
286 287 288 |
# File 'ec2/vpc.rb', line 286 def vpc_default_network_acl() jsii_get_property("vpcDefaultNetworkAcl") end |
#vpc_default_security_group ⇒ String
291 292 293 |
# File 'ec2/vpc.rb', line 291 def vpc_default_security_group() jsii_get_property("vpcDefaultSecurityGroup") end |
#vpc_id ⇒ String
Identifier for this VPC.
298 299 300 |
# File 'ec2/vpc.rb', line 298 def vpc_id() jsii_get_property("vpcId") end |
#vpc_ipv6_cidr_blocks ⇒ Array<String>
303 304 305 |
# File 'ec2/vpc.rb', line 303 def vpc_ipv6_cidr_blocks() jsii_get_property("vpcIpv6CidrBlocks") end |
#vpc_ref ⇒ AWSCDK::Interfaces::AWSEC2::VPCReference
A reference to a VPC resource.
310 311 312 |
# File 'ec2/vpc.rb', line 310 def vpc_ref() jsii_get_property("vpcRef") end |
#vpn_gateway_id ⇒ String?
Returns the id of the VPN Gateway (if enabled).
327 328 329 |
# File 'ec2/vpc.rb', line 327 def vpn_gateway_id() jsii_get_property("vpnGatewayId") end |
#with(*mixins) ⇒ Constructs::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.
359 360 361 362 363 364 |
# File 'ec2/vpc.rb', line 359 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |