137 CDK constructs available in aws-cdk-lib/aws-ec2
import * as ec2 from 'aws-cdk-lib/aws-ec2';Higher-level abstractions with sensible defaults and convenience methods.
This creates a linux bastion host you can use to connect to other instances or services in your VPC. The recommended way to connect to the bastion host is by using AWS Systems Manager Session Manager. The operating system is Amazon Linux 2 with the latest SSM agent installed You can also configure this bastion host to allow connections via SSH
A client VPN authorization rule.
A client VPN connection.
A client VPN route.
A VPC flow log.
A gateway VPC endpoint.
This represents a single EC2 instance.
A interface VPC endpoint.
An EC2 Key Pair.
This represents an EC2 LaunchTemplate.
Define a new custom network ACL. By default, will deny all inbound and outbound traffic unless entries are added explicitly allowing it.
Define an entry in a Network ACL table.
Defines a placement group. Placement groups give you fine-grained control over where your instances are provisioned.
A managed prefix list.
Represents a private VPC subnet resource.
Represents a public VPC subnet resource.
Creates an Amazon EC2 security group within a VPC. Security Groups act like a firewall with a set of rules, and are associated with any AWS resource that has or creates Elastic Network Interfaces (ENIs). A typical example of a resource that has a security group is an Instance (or Auto Scaling Group of instances) If you are defining new infrastructure in CDK, there is a good chance you won't have to interact with this class at all. Like IAM Roles, Security Groups need to exist to control access between AWS resources, but CDK will automatically generate and populate them with least-privilege permissions for you so you can concentrate on your business logic. All Constructs that require Security Groups will create one for you if you don't specify one at construction. After construction, you can selectively allow connections to and between constructs via--for example-- the `instance.connections` object. Think of it as "allowing connections to your instance", rather than "adding ingress rules a security group". See the [Allowing Connections](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-cdk-lib.aws_ec2-readme.html#allowing-connections) section in the library documentation for examples. Direct manipulation of the Security Group through `addIngressRule` and `addEgressRule` is possible, but mutation through the `.connections` object is recommended. If you peer two constructs with security groups this way, appropriate rules will be created in both. If you have an existing security group you want to use in your CDK application, you would import it like this: ```ts const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'SG', 'sg-12345', { mutable: false }); ```
Represents a new VPC subnet resource.
Creates a new EBS Volume in AWS EC2.
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: ```ts const vpc = new ec2.Vpc(this, 'TheVPC', { ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'), }) // Iterate the private subnets const selection = vpc.selectSubnets({ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }); for (const subnet of selection.subnets) { // ... } ```
A VPC endpoint service.
Define a VPN Connection.
The VPN Gateway that shall be added to the VPC.
Direct CloudFormation resource mappings. One-to-one with CloudFormation resource types.
AWS::EC2::CapacityManagerDataExportAWS::EC2::CapacityReservationAWS::EC2::CapacityReservationFleetAWS::EC2::CarrierGatewayAWS::EC2::ClientVpnAuthorizationRuleAWS::EC2::ClientVpnEndpointAWS::EC2::ClientVpnRouteAWS::EC2::ClientVpnTargetNetworkAssociationAWS::EC2::CustomerGatewayAWS::EC2::DHCPOptionsAWS::EC2::EC2FleetAWS::EC2::EgressOnlyInternetGatewayAWS::EC2::EIPAWS::EC2::EIPAssociationAWS::EC2::EnclaveCertificateIamRoleAssociationAWS::EC2::FlowLogAWS::EC2::GatewayRouteTableAssociationAWS::EC2::HostAWS::EC2::InstanceAWS::EC2::InstanceConnectEndpointAWS::EC2::InternetGatewayAWS::EC2::IPAMAWS::EC2::IPAMAllocationAWS::EC2::IPAMPoolAWS::EC2::IPAMPoolCidrAWS::EC2::IPAMPrefixListResolverAWS::EC2::IPAMPrefixListResolverTargetAWS::EC2::IPAMResourceDiscoveryAWS::EC2::IPAMResourceDiscoveryAssociationAWS::EC2::IPAMScopeAWS::EC2::IpPoolRouteTableAssociationAWS::EC2::KeyPairAWS::EC2::LaunchTemplateAWS::EC2::LocalGatewayRouteAWS::EC2::LocalGatewayRouteTableAWS::EC2::LocalGatewayRouteTableVirtualInterfaceGroupAssociationAWS::EC2::LocalGatewayRouteTableVPCAssociationAWS::EC2::LocalGatewayVirtualInterfaceAWS::EC2::LocalGatewayVirtualInterfaceGroupAWS::EC2::NatGatewayAWS::EC2::NetworkAclAWS::EC2::NetworkAclEntryAWS::EC2::NetworkInsightsAccessScopeAWS::EC2::NetworkInsightsAccessScopeAnalysisAWS::EC2::NetworkInsightsAnalysisAWS::EC2::NetworkInsightsPathAWS::EC2::NetworkInterfaceAWS::EC2::NetworkInterfaceAttachmentAWS::EC2::NetworkInterfacePermissionAWS::EC2::NetworkPerformanceMetricSubscriptionAWS::EC2::PlacementGroupAWS::EC2::PrefixListAWS::EC2::RouteAWS::EC2::RouteServerAWS::EC2::RouteServerAssociationAWS::EC2::RouteServerEndpointAWS::EC2::RouteServerPeerAWS::EC2::RouteServerPropagationAWS::EC2::RouteTableAWS::EC2::SecurityGroupAWS::EC2::SecurityGroupEgressAWS::EC2::SecurityGroupIngressAWS::EC2::SecurityGroupVpcAssociationAWS::EC2::SnapshotBlockPublicAccessAWS::EC2::SpotFleetAWS::EC2::SqlHaStandbyDetectedInstanceAWS::EC2::SubnetAWS::EC2::SubnetCidrBlockAWS::EC2::SubnetNetworkAclAssociationAWS::EC2::SubnetRouteTableAssociationAWS::EC2::TrafficMirrorFilterAWS::EC2::TrafficMirrorFilterRuleAWS::EC2::TrafficMirrorSessionAWS::EC2::TrafficMirrorTargetAWS::EC2::TransitGatewayAWS::EC2::TransitGatewayAttachmentAWS::EC2::TransitGatewayConnectAWS::EC2::TransitGatewayConnectPeerAWS::EC2::TransitGatewayMeteringPolicyAWS::EC2::TransitGatewayMeteringPolicyEntryAWS::EC2::TransitGatewayMulticastDomainAWS::EC2::TransitGatewayMulticastDomainAssociationAWS::EC2::TransitGatewayMulticastGroupMemberAWS::EC2::TransitGatewayMulticastGroupSourceAWS::EC2::TransitGatewayPeeringAttachmentAWS::EC2::TransitGatewayRouteAWS::EC2::TransitGatewayRouteTableAWS::EC2::TransitGatewayRouteTableAssociationAWS::EC2::TransitGatewayRouteTablePropagationAWS::EC2::TransitGatewayVpcAttachmentAWS::EC2::VerifiedAccessEndpointAWS::EC2::VerifiedAccessGroupAWS::EC2::VerifiedAccessInstanceAWS::EC2::VerifiedAccessTrustProviderAWS::EC2::VolumeAWS::EC2::VolumeAttachmentAWS::EC2::VPCAWS::EC2::VPCBlockPublicAccessExclusionAWS::EC2::VPCBlockPublicAccessOptionsAWS::EC2::VPCCidrBlockAWS::EC2::VPCDHCPOptionsAssociationAWS::EC2::VPCEncryptionControlAWS::EC2::VPCEndpointAWS::EC2::VPCEndpointConnectionNotificationAWS::EC2::VPCEndpointServiceAWS::EC2::VPCEndpointServicePermissionsAWS::EC2::VPCGatewayAttachmentAWS::EC2::VPCPeeringConnectionAWS::EC2::VPNConcentratorAWS::EC2::VPNConnectionAWS::EC2::VPNConnectionRouteAWS::EC2::VPNGatewayAWS::EC2::VPNGatewayRoutePropagationEverything you need to know about Amazon EC2 on one page. HD quality, print-friendly.
Download Free Infographicaws-cdk-lib/aws-ec2