Registry /
aws / aws-cdk-aws-autoscaling
Install & Compatibility
Where this runs
tested against v1.204.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 64.9MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 12.7s · import 0.000s · 65MB
68MB installed
● package 68MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AutoScalingGroup
✓ from aws_cdk.aws_autoscaling import AutoScalingGroup
✗ from aws_cdk import aws_autoscaling
This package (`aws-cdk-aws-autoscaling`) is for AWS CDK v1.x. The v2 import style (`from aws_cdk import aws_autoscaling`) is used with `aws-cdk-lib`.
CfnAutoScalingGroup
✓ from aws_cdk.aws_autoscaling import CfnAutoScalingGroup
CDK v1 L1 (CloudFormation) construct import.
This quickstart demonstrates how to define a basic AWS Auto Scaling Group using AWS CDK v1 constructs. It creates a new VPC, an Auto Scaling Group with a specified instance type and Amazon Linux 2 AMI, and sets min/max capacity. To deploy, run `cdk bootstrap` (if not already done) and then `cdk deploy`.
import os
from aws_cdk import (
core as cdk,
aws_ec2 as ec2,
aws_autoscaling as autoscaling,
)
class MyAutoScalingStack(cdk.Stack):
def __init__(self, scope: cdk.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
# Create a VPC for the Auto Scaling Group
vpc = ec2.Vpc(self, "MyVpc", max_azs=2)
# Define an Auto Scaling Group
asg = autoscaling.AutoScalingGroup(
self, "ASG",
vpc=vpc,
instance_type=ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
machine_image=ec2.AmazonLinuxImage(generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2),
min_capacity=1,
max_capacity=1,
group_metrics=[autoscaling.GroupMetrics.all()], # Example for monitoring
health_check=autoscaling.HealthCheck.ec2()
)
app = cdk.App()
MyAutoScalingStack(app, "MyAutoScalingStack",
env=cdk.Environment(account=os.environ.get('CDK_DEFAULT_ACCOUNT', ''),
region=os.environ.get('CDK_DEFAULT_REGION', ''))
)
app.synth()
Debug
Known issues
breakingAWS CDK v2 consolidates all constructs into a single `aws-cdk-lib` package. This `aws-cdk-aws-autoscaling` package is specifically for CDK v1. If you are using CDK v2, you should install `aws-cdk-lib` and use the v2 import paths.fixFor CDK v2, install `aws-cdk-lib` (`pip install aws-cdk-lib`) and update your import statements from `from aws_cdk.aws_autoscaling import ...` to `from aws_cdk import aws_autoscaling` and access constructs via `aws_autoscaling.AutoScalingGroup`.
affects: All versions of aws-cdk-aws-autoscaling (v1.x) when migrating to CDK v2.
gotchaCDK v1 requires installing individual construct libraries (e.g., `aws-cdk.core`, `aws-cdk.aws-ec2`, `aws-cdk-aws-autoscaling`) separately. Missing a dependency will lead to `ModuleNotFoundError`.fixEnsure all required individual construct libraries for your CDK v1 project are installed via `pip install <package-name>`. For most projects, `aws-cdk.core` and relevant `aws-cdk.aws-*` packages are needed.
affects: All v1.x versions.
gotchaPython version compatibility for CDK v1.x packages is typically limited to `~=3.7`. Newer Python versions might cause issues or not be supported by older CDK v1 dependencies.fixEnsure your Python environment is compatible with the installed CDK v1 packages, ideally Python 3.7. Consider migrating to AWS CDK v2 for broader Python version support and ongoing updates.
affects: All v1.x versions with Python 3.8+.
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
No dependency data recorded yet.