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/asg): CloudFormation-init support #8788

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
42f2b68
feat(ec2/asg): CloudFormation-Init support
rix0rrr Jun 29, 2020
bda2e34
Starting to lay down parts of the API
rix0rrr Jun 30, 2020
9028fe8
Some more spitballin'
rix0rrr Jun 30, 2020
cd906a4
InitCommand v0.1
njlynch Jun 30, 2020
0a8d20e
End-of-day check-in. Slightly more structure; users, groups, and sources
njlynch Jun 30, 2020
bc1b710
Merge remote-tracking branch 'origin/master' into huijbers/cfn-init
rix0rrr Jul 1, 2020
61ef425
I changed things!
rix0rrr Jul 1, 2020
bed1c4d
Packages implemented and some cleanup
njlynch Jul 1, 2020
dc129d7
Add consumption of CfnInit object
rix0rrr Jul 1, 2020
6f6486e
InitFile v0.1 done
njlynch Jul 1, 2020
e8e8aaf
Services v0.1 implementation and making eslint happy
njlynch Jul 2, 2020
9ac3037
Refactor signal/update handling in AutoScalingGroup and add Cfn-Init
rix0rrr Jul 2, 2020
e6c643f
Merge branch 'huijbers/cfn-init' of github.com:awslabs/aws-cdk into h…
rix0rrr Jul 2, 2020
0feefb9
Update ASG README, add fingerprinting
rix0rrr Jul 2, 2020
1f4f1cf
Lots of tests, some minor fixes/updates
njlynch Jul 2, 2020
c9a8b3f
Make everything build
rix0rrr Jul 2, 2020
73cb600
Merge branch 'huijbers/cfn-init' of github.com:awslabs/aws-cdk into h…
rix0rrr Jul 2, 2020
2615fad
Remove accidental changes
rix0rrr Jul 2, 2020
b41c2ba
Add tests on ASG changes
rix0rrr Jul 2, 2020
09f5020
More tests
njlynch Jul 2, 2020
5a57332
Add restart handles
rix0rrr Jul 3, 2020
0bdc67c
Make it possible for commands to register themselves into more than 1…
rix0rrr Jul 3, 2020
44c919d
Add integral test on restart handles
rix0rrr Jul 3, 2020
d3e1d53
Add cfn-init test to Instance
rix0rrr Jul 3, 2020
6f7a2f3
Add integ test
rix0rrr Jul 3, 2020
33843f4
Add log printing and forced instance replacement
rix0rrr Jul 3, 2020
80d0caf
Add 'ignoreFailures' option
rix0rrr Jul 3, 2020
1d5ccc6
Init assets implementation and more linter fixes. Still some FIXMEs/T…
njlynch Jul 3, 2020
e4059bd
Add README, rename to 'serviceRestartHandle' everywhere
rix0rrr Jul 6, 2020
a739a38
Tmp commit. Almost there??
njlynch Jul 6, 2020
5689799
Important bug fix
njlynch Jul 6, 2020
5c30482
Combined render() and bind() into one call to satisfy auth requirements
njlynch Jul 6, 2020
95fa96f
Minor build fixes
njlynch Jul 6, 2020
84a48cd
Tweaks
rix0rrr Jul 7, 2020
13bc709
Merge branch 'huijbers/cfn-init' of github.com:awslabs/aws-cdk into h…
rix0rrr Jul 7, 2020
c217f3d
Also perform bucket.grantRead for fromS3Object()
rix0rrr Jul 7, 2020
c53f435
Simplify element implementations w.r.t. bind(),
rix0rrr Jul 7, 2020
eeaafc3
Initial list of tests to write
rix0rrr Jul 7, 2020
c913976
Two new proposed tests
rix0rrr Jul 7, 2020
d0c0b57
Add common test setup
rix0rrr Jul 7, 2020
78ce0bd
Moar tests
rix0rrr Jul 7, 2020
a8ee450
Add a bunch of tests
rix0rrr Jul 7, 2020
0b89be7
Windows-specific bug fixes
njlynch Jul 7, 2020
f512f80
Update ASG test
rix0rrr Jul 7, 2020
5178411
Merge branch 'huijbers/cfn-init' of github.com:awslabs/aws-cdk into h…
rix0rrr Jul 7, 2020
2680f7d
Fix linter errors
rix0rrr Jul 7, 2020
eba62d0
Merge remote-tracking branch 'origin/master' into huijbers/cfn-init
rix0rrr Jul 7, 2020
c151796
Windows test
rix0rrr Jul 7, 2020
efa358f
Rewrite nodeunit -> jest test
rix0rrr Jul 7, 2020
1edda87
Minor clean-up
njlynch Jul 7, 2020
110798c
Merge remote-tracking branch 'origin/master' into huijbers/cfn-init
rix0rrr Jul 10, 2020
3bb9ba4
Expected integ test update after merge
njlynch Jul 10, 2020
4966d40
Merge remote-tracking branch 'origin/master' into cfn-init
njlynch Jul 14, 2020
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
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/lib/assertions/have-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ export function isSuperObject(superObj: any, pattern: any, errors: string[] = []
errors.push(inspection.failureReason);
}
return ret;
}
}
37 changes: 34 additions & 3 deletions packages/@aws-cdk/aws-autoscaling/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Amazon EC2 Auto Scaling Construct Library

<!--BEGIN STABILITY BANNER-->
---

Expand All @@ -11,8 +12,6 @@

This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

### Fleet

### Auto Scaling Group

An `AutoScalingGroup` represents a number of instances on which you run your code. You
Expand Down Expand Up @@ -224,6 +223,39 @@ autoScalingGroup.scaleOnSchedule('AllowDownscalingAtNight', {
});
```

### Configuring Instances using CloudFormation Init

It is possible to use the CloudFormation Init mechanism to configure the
instances in the AutoScalingGroup. You can write files to it, run commands,
start services, etc. See the documentation of
[AWS::CloudFormation::Init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html)
and the documentation of CDK's `aws-ec2` library for more information.
Copy link
Contributor

Choose a reason for hiding this comment

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

A direct link to the appropriate section would be nice :)


When you specify a CloudFormation Init configuration for an AutoScalingGroup:

* you *must* also specify `signals` to configure how long CloudFormation
should wait for the instances to successfully configure themselves.
* you *should* also specify an `updatePolicy` to configure how instances
should be updated when the AutoScalingGroup is updated (for example,
when the AMI is updated).

Here's an example of using CloudFormation Init to write a file to the
instance hosts on startup:

```ts
new autoscaling.AutoScalingGroup(this, 'ASG', {
// ...

init: ec2.CloudFormationInit.fromElements(
ec2.InitFile.fromString('/etc/my_instance', 'This got written during instance startup'),
),
signals: autoscaling.Signals.waitForAll({
timeout: Duration.minutes(10),
}),
updatePolicy: autoscaling.UpdatePolicy.rollingUpdate(),
});
```

### Allowing Connections

See the documentation of the `@aws-cdk/aws-ec2` package for more information
Expand All @@ -241,7 +273,6 @@ To disable detailed instance monitoring, specify `instanceMonitoring` property
for the `AutoscalingGroup` resource as `Monitoring.BASIC`. Otherwise detailed monitoring
will be enabled.


### Future work

- [ ] CloudWatch Events (impossible to add currently as the AutoScalingGroup ARN is
Expand Down
Loading