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 3 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
12 changes: 12 additions & 0 deletions docs/pack-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Development script to build all docs packages and rsync them into $root/dist so that build-docs.sh can work.
set -euo pipefail
cd ..

dist=$(pwd)/dist
pacmak=$(pwd)/tools/cdk-build-tools/node_modules/.bin/jsii-pacmak
scopes=$(lerna ls 2>/dev/null | grep -v "(private)" | cut -d" " -f1 | xargs -n1 -I{} echo "--scope {}" | tr "\n" " ")

mkdir -p $dist
node_modules/.bin/lerna exec --no-bail ${scopes} -- $pacmak -t sphinx -o dist/sphinx || echo 'Swallowing error'
node_modules/.bin/lerna exec --no-bail ${scopes} -- rsync -av dist/ $dist/ || echo 'Swallowing error'
32 changes: 12 additions & 20 deletions packages/@aws-cdk/aws-autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,24 @@ 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 EC2 instance. The EC2
library contains constructs to select the AMI you want to use.

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)
[example of creating images](test/example.images.lit.ts)

You can select the latest Amazon Linux image like this:

new ec2.AmazonLinuxImage()

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:

machineImage: 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
28 changes: 28 additions & 0 deletions packages/@aws-cdk/aws-autoscaling/test/example.images.lit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import ec2 = require("@aws-cdk/aws-ec2");

/// !show
// Pick a Windows edition to use
const windows = new ec2.WindowsImage(ec2.WindowsVersion.WindowsServer2016EnglishNanoBase);

// 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,
});

// For other custom (Linux) images, instantiate a `GenericLinuxImage` with
// a map giving the AMI to in for each region:

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

Array.isArray(windows);
Array.isArray(amznLinux);
Array.isArray(linux);
Loading