skillfed

aws-cdk.aws-ec2

The CDK Construct Library for AWS::EC2

aws-cdk-aws-ec2 v1.204.0 195.6K downloads/30d#9,812 on PyPI12,868
Permissive license Apache-2.0 Active released

What it is and what it does

aws-cdk.aws-ec2 is the EC2 construct library for AWS CDK v1, a framework for defining cloud infrastructure using Python code. It abstracts EC2 networking primitives—VPCs, subnets (public, private-with-NAT, and isolated), availability zones, security groups, and instances—into reusable constructs that generate CloudFormation templates. You define your infrastructure declaratively, and CDK synthesizes it into deployable AWS resources.

The package is part of the broader AWS CDK ecosystem and depends on core CDK modules (aws-cdk.core, aws-cdk.cx-api, constructs) plus related AWS service libraries (IAM, KMS, S3, CloudWatch, Logs, SSM). It is designed for developers building cloud applications who want to express infrastructure in Python rather than writing CloudFormation YAML or JSON directly.

Use it for:

  • Define a VPC with public and private subnets, then launch EC2 instances into them as part of a CDK stack.
  • Create VPC endpoints and configure subnet selection by availability zone and subnet type for high-availability deployments.
  • Provision security groups and network ACLs to control inbound and outbound traffic to EC2 resources.
  • Integrate EC2 networking with other AWS services by specifying VPC and subnet configuration in a single CDK app.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides AWS CDK constructs for defining EC2 networking and compute resources (VPCs, subnets, instances) as infrastructure-as-code in Python.

No, unless you are maintaining an existing CDK v1 codebase. AWS CDK v1 reached end-of-support on 2023-06-01 and is no longer being updated. New projects should use AWS CDK v2 instead. If you are already on v1, plan a migration to v2 rather than starting new work with this package.

Install

aws-cdk-aws-ec2 on PyPI

pip

pip install aws-cdk-aws-ec2

uv

uv add aws-cdk-aws-ec2

poetry

poetry add aws-cdk-aws-ec2

Installing aws-cdk.aws-ec2

Before you install

Low install friction with a pure-Python wheel. However, this is AWS CDK v1, which reached end-of-support on 2023-06-01 and is no longer being updated; users should migrate to AWS CDK v2.

License in practice

Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions.

Quickstart

pip install aws-cdk.aws-ec2

import aws_cdk.aws_ec2 as ec2

vpc = ec2.Vpc(self, "VPC")

Requires Python 3.7 or later; AWS CDK v1 reached end-of-support on 2023-06-01.

Verify before relying

  • Whether v1-to-v2 migration tooling or automated upgrade paths are available to ease the transition.
  • Current security posture and whether v1 receives any backported security patches post-EOL.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (~=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 15 — aws-cdk.aws-cloudwatch, aws-cdk.aws-iam, aws-cdk.aws-kms, aws-cdk.aws-logs, aws-cdk.aws-s3-assets, aws-cdk.aws-s3, aws-cdk.aws-ssm, aws-cdk.cloud-assembly-schema, aws-cdk.core, aws-cdk.cx-api, aws-cdk.region-info, constructs, jsii, publication, typeguard
Maintenance actively maintained — 1,152 days since the last release
Last repo commit
First released
Downloads 195,566/month — #9,812 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: aws_cdk.aws_ec2-1.204.0-py3-none-any.whl

Development Status :: 7 - InactiveFramework :: AWS CDKFramework :: AWS CDK :: 1Intended Audience :: DevelopersLicense :: OSI ApprovedOperating System :: OS IndependentProgramming Language :: JavaScriptProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Typing :: Typed

Tags

aws ec2 infrastructure as codevpc subnet construct libraryaws cdk networkingec2 instance provisioning cdkaws network infrastructure python
infrastructure-as-codeaws-cdk-v1-eol

More Build Tools packages

packaging

Provides reusable utilities for Python…

permissive · top 100 on PyPI

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

pip

pip is the standard installer for Python…

permissive · top 100 on PyPI

hatchling

Hatchling is a standards-compliant Python build…

permissive · top 100 on PyPI

grpcio-tools

Generates Python gRPC service stubs and message…

permissive · top 1,000 on PyPI

pre-commit

pre-commit is a framework for installing and…

permissive · top 1,000 on PyPI

aws-cdk.aws-batch

Defines AWS Batch infrastructure (compute…

permissive · top 15,000 on PyPI

aws-cdk.aws-ecs

Provides AWS CDK constructs for defining and…

permissive · top 15,000 on PyPI

aws-cdk.aws-efs

Provides CDK constructs to define Amazon EFS…

permissive · top 15,000 on PyPI

aws-cdk.aws-neptune-alpha

Provides AWS CDK constructs for defining and…

permissive · top 15,000 on PyPI

aws-cdk.aws-servicediscovery

Provides AWS CDK constructs for defining and…

permissive · top 15,000 on PyPI

cdk-aurora-globaldatabase

Provides AWS CDK constructs to deploy Amazon…

permissive · top 15,000 on PyPI

ec2-metadata

Queries the EC2 Instance Metadata Service v2 to…

permissive · top 5,000 on PyPI

aws-cdk.aws-fsx

Provides AWS CDK constructs for defining and…

permissive · top 15,000 on PyPI

aws-cdk.aws-route53

Provides Python constructs to define and manage…

permissive · top 15,000 on PyPI

aws-cdk.aws-redshift-alpha

Defines AWS Redshift clusters and database…

permissive · top 15,000 on PyPI