Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ec2): instance type properties #29507

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/aws-cdk-lib/aws-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,26 @@ new ec2.Instance(this, 'Instance5', {
});
```

### Instance type instances and properties

**TODO**

```ts
declare const vpc: ec2.Vpc;

const instanceType = ec2.NamedInstanceType.BURSTABLE2_MICRO;

assert(instanceType.instanceProperties?.freeTierEligible);

new ec2.Instance(this, 'Instance', {
vpc,
instanceType,
machineImage: ec2.MachineImage.latestAmazonLinux2023({
cpuType: ec2.AmazonLinuxCpuType.ARM_64,
}),
});
```

### Latest Amazon Linux Images

Rather than specifying a specific AMI ID to use, it is possible to specify a SSM
Expand Down
13 changes: 13 additions & 0 deletions packages/aws-cdk-lib/aws-ec2/data/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -euo pipefail
regions="us-east-1 us-east-2"

for region in $regions; do
aws ec2 describe-instance-types | \
jq '.InstanceTypes | { InstanceTypes: map({key: .InstanceType, value: del(.InstanceType)}) | sort_by(.key) | from_entries } | .InstanceTypes' > \
instance-properties-$region.json
done

jq -s 'reduce .[] as $item ({}; . * $item)' instance-properties-*.json > instance-properties.json
rm instance-properties-*.json
Loading
Loading