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(aws-ec2): AmazonLinuxImage supports AL2 #1081

Merged
merged 4 commits into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
51 changes: 33 additions & 18 deletions packages/@aws-cdk/aws-autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,47 @@ new autoscaling.AutoScalingGroup(stack, 'ASG', {
> internet) which is set to `true` by default. Be sure to set this to `false` if you don't want
> your instances to be able to start arbitrary connections.

### AMIs
### Machine Images (AMIs)

AMIs control the OS that gets launched when you start your instance.
AMIs control the OS that gets launched when you start your instances. The constructs
for selecting AMIS are in the `@aws-cdk/aws-ec2` package.

Depending on the type of AMI, you select it a different way.

The latest version of Windows images are regionally published under labels,
so you can select Windows images like this:
The latest version of Amazon Linux and Microsoft Windows images are
selectable by instantiating one of these classes:

new ec2.WindowsImage(WindowsVersion.WindowsServer2016EnglishNanoBase)

You can select the latest Amazon Linux image like this:

new ec2.AmazonLinuxImage()
```ts
// Pick a Windows edition to use
const windows = new ec2.WindowsImage(WindowsVersion.WindowsServer2016EnglishNanoBase);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be sweet if this was a .lit.ts instead? Same applies to further code excerpts. I'm becoming wary of not realizing when we break those examples... literate examples allow us to make sure they at the very least build.


// Pick the right Amazon Linux edition. All arguments shown are optional
// and will default to these values when omitted.
const amznLinux = new ec2.AmazonLinuxImage({
generation: ec2.AmazonLinuxGeneration.AmazonLinux,
edition: ec2.AmazonLinuxEdition.Standard,
virtualization: ec2.AmazonLinuxVirt.HVM,
storage: ec2.AmazonLinuxStorage.GeneralPurpose,
});
```

Other Linux images are unfortunately not currently published this way, so you have
to supply a region-to-AMI map when creating a Linux image:
For other custom (Linux) images, instantiate a `GenericLinuxImage` with
a map giving the AMI to in for each region:

machineImage: new ec2.GenericLinuxImage({
'us-east-1': 'ami-97785bed',
'eu-west-1': 'ami-12345678',
// ...
})
```ts
const linux = new ec2.GenericLinuxImage({
'us-east-1': 'ami-97785bed',
'eu-west-1': 'ami-12345678',
// ...
});
```

> NOTE: Selecting Linux images will change when the information is published in an automatically
> consumable way.
> NOTE: The Amazon Linux images selected will be cached in your `cdk.json`, so that your
> AutoScalingGroups don't automatically change out from under you when you're making unrelated
> changes. To update to the latest version of Amazon Linux, remove the cache entry from the `context`
> section of your `cdk.json`.
>
> We will add command-line options to make this step easier in the future.

### Allowing Connections

Expand Down
Loading