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): CloudFormation-init support #9065

Merged
merged 8 commits into from
Aug 13, 2020
Merged

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Jul 14, 2020

NOTE: This is a reduced version of #8788, which is the full
CloudFormation-init support. This has been reduced down to only support
instances (not ASGs), and to only support the InitCommand and InitService init
elements, rather than the full set. This is to reduce the PR size and encourage
a more thorough review. A follow-up review will add the remainder of the
elements and auto-scaling group support.

Add CloudFormation-init support.

The CloudFormation-init metadata is encapsulated in a CloudFormationInit object,
and using it automatically renders the UserData to apply it and send a signal to
the appropriate CloudFormation resource and adds the permissions required to use
cfn-init, cfn-signal and any S3 files/assets to the instance role.

On an Instance, using CloudFormation-init automatically adds a ResourceSignal
with a default timeout to the instance.

Note this currently also includes the same changes as #9063, as this relies on it. #9063 can be independently shipped.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

njlynch added 2 commits July 14, 2020 18:17
This is a prerequisite of #8788, where it will be used to add CfnInit metadata.
> NOTE: This is a reduced version of #8788, which is the full
CloudFormation-init support. This has been reduced down to only support
instances (not ASGs), and to only support the InitCommand and InitService init
elements, rather than the full set. This is to reduce the PR size and encourage
a more thorough review. A follow-up review will add the remainder of the
elements and auto-scaling group support.

Add CloudFormation-init support.

The CloudFormation-init metadata is encapsulated in a CloudFormationInit object,
and using it automatically renders the UserData to apply it and send a signal to
the appropriate CloudFormation resource and adds the permissions required to use
cfn-init, cfn-signal and any S3 files/assets to the instance role.

On an Instance, using CloudFormation-init automatically adds a ResourceSignal
with a default timeout to the instance.
@njlynch njlynch added the pr/do-not-merge This PR should not be merged at this time. label Jul 14, 2020
@njlynch njlynch self-assigned this Jul 14, 2020
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jul 14, 2020
@njlynch njlynch requested a review from a team July 14, 2020 17:25
@njlynch
Copy link
Contributor Author

njlynch commented Jul 14, 2020

@nija-at / @iliapolo - Please take a look at this reduced Cfn-init PR. Hopefully you'll find it more approachable than #8788 .

Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Reviewed cfn-init-template.ts so far.... 😅

packages/@aws-cdk/aws-ec2/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
@njlynch njlynch changed the title feat(ec2): CloudFormation-init support (minimal) feat(ec2): CloudFormation-init support Jul 16, 2020
- Moving all bind-related methods and elements to be internal and not exported in
the module.
- Support for a "forever" wait duration.
- Various documentation updates.
Copy link
Contributor

@iliapolo iliapolo left a comment

Choose a reason for hiding this comment

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

Slowly but surely...

packages/@aws-cdk/aws-ec2/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
@njlynch njlynch requested review from iliapolo and nija-at July 16, 2020 16:28
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/instance.ts Show resolved Hide resolved
@njlynch njlynch requested review from a team and nija-at July 22, 2020 08:49
packages/@aws-cdk/aws-ec2/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-ec2/lib/instance.ts Show resolved Hide resolved
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Also the comments above.

packages/@aws-cdk/aws-ec2/lib/instance.ts Outdated Show resolved Hide resolved
@njlynch njlynch requested review from rix0rrr and nija-at August 10, 2020 11:35
Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

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

Ship this thingamabob!

@njlynch njlynch dismissed nija-at’s stale review August 13, 2020 08:57

Changes addressed (prepare() calls removed).

@njlynch njlynch removed the pr/do-not-merge This PR should not be merged at this time. label Aug 13, 2020
@mergify
Copy link
Contributor

mergify bot commented Aug 13, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: adf4138
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Aug 13, 2020

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 014c13a into master Aug 13, 2020
@mergify mergify bot deleted the njlynch/cfn-init-minimal branch August 13, 2020 09:36
njlynch added a commit that referenced this pull request Aug 13, 2020
…nd groups

Cloudformation Init (cfn-init) support was introduced in #9065 with a minimal
set of support for various init element types. This PR is a continuation of
that support (based on the original #8788), and adds the remaining init element
types: files, packages, sources, users, and groups.

With this PR, CloudFormation init support for EC2 instances is complete. A final
PR will be submitted to extend this support to auto-scaling groups (again, based
on the original work done in #8788).
njlynch added a commit that referenced this pull request Aug 13, 2020
Introduces CloudFormation init (cfn-init) support for autoscaling groups.
This builds on the previous work (#9065) and (#9664) that introduced init
support for instances.

This change also reworks the existing signaling functionality, as this becomes
even more important with cfn-init.

A final change was to adjust the (internal) interface of the `_attach` method to
accept an `ec2.OperatingSystemType` instead of the internal-only
`ec2.InitPlatform` type which wasn't exported and unavailable within the asg
module. This change is also in the #9664 diff, as both are pending.

Credit for 90% of this goes to @rix0rrr; all cfn-init support was pair-
programmed, but the ASG stuff was much more heavily done by him.
mergify bot pushed a commit that referenced this pull request Aug 17, 2020
… groups (#9664)

Cloudformation Init (cfn-init) support was introduced in #9065 with a minimal
set of support for various init element types. This PR is a continuation of
that support (based on the original #8788), and adds the remaining init element
types: files, packages, sources, users, and groups.

With this PR, CloudFormation init support for EC2 instances is complete. A final
PR will be submitted to extend this support to auto-scaling groups (again, based
on the original work done in #8788).

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mergify bot pushed a commit that referenced this pull request Oct 28, 2020
Introduces CloudFormation init (cfn-init) support for autoscaling groups.
This builds on the previous work (#9065) and (#9664) that introduced init
support for instances.

This change also reworks the existing signaling functionality, as this becomes
even more important with cfn-init.

A final change is to export the `CloudFormationInit._attach` method and related
options.

Credit for 90% of this goes to @rix0rrr; all cfn-init support was pair-
programmed, but the ASG stuff was mostly him.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants