diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..6bdaa999
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,6 @@
+*Issue #, if available:*
+
+*Description of changes:*
+
+
+By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index c6d8587a..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,32 +0,0 @@
-# Editor backup files
-*~
-*.bak
-*.lock
-
-# System files
-.attach*
-.DS_Store
-
-# Build directories
-build/
-
-# IDE files
-.idea/
-.vscode/
-.amazonq/
-
-# Generated documentation
-*.html
-*.pdf
-*.docx
-*.xlsx
-*.rtf
-*.mobi
-
-# Archives
-*.7z
-*.rar
-*.tar
-
-# Other
-*.running.properties.txt
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 5dccd4cf..00000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,4 +0,0 @@
-## Code of Conduct
-This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
-For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
-opensource-codeofconduct@amazon.com with any additional questions or comments.
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 50a0d080..00000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# Guidelines for contributing
-
-Thank you for your interest in contributing to AWS documentation! We greatly value feedback and contributions from our community.
-
-Please read through this document before you submit any pull requests or issues. It will help us work together more effectively.
-
-## What to expect when you contribute
-
-When you submit a pull request, our team is notified and will respond as quickly as we can. We'll do our best to work with you to ensure that your pull request adheres to our style and standards. If we merge your pull request, we might make additional edits later for style or clarity.
-
-The AWS documentation source files on GitHub aren't published directly to the official documentation website. If we merge your pull request, we'll publish your changes to the documentation website as soon as we can, but they won't appear immediately or automatically.
-
-We look forward to receiving your pull requests for:
-
-* New content you'd like to contribute (such as new code samples or tutorials)
-* Inaccuracies in the content
-* Information gaps in the content that need more detail to be complete
-* Typos or grammatical errors
-* Suggested rewrites that improve clarity and reduce confusion
-
-**Note:** We all write differently, and you might not like how we've written or organized something currently. We want that feedback. But please be sure that your request for a rewrite is supported by the previous criteria. If it isn't, we might decline to merge it.
-
-## How to contribute
-
-To contribute, send us a pull request. For small changes, such as fixing a typo or adding a link, you can use the [GitHub Edit Button](https://blog.github.com/2011-04-26-forking-with-the-edit-button/). For larger changes:
-
-1. [Fork the repository](https://help.github.com/articles/fork-a-repo/).
-2. In your fork, make your change in a branch that's based on this repo's **main** branch.
-3. Commit the change to your fork, using a clear and descriptive commit message.
-4. [Create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/), answering any questions in the pull request form.
-
-Before you send us a pull request, please be sure that:
-
-1. You're working from the latest source on the **main** branch.
-2. You check [existing open](https://github.com/awsdocs/aws-cdk-guide/pulls), and [recently closed](https://github.com/awsdocs/aws-cdk-guide/pulls?q=is:pr+is:closed), pull requests to be sure that someone else hasn't already addressed the problem.
-3. You [create an issue](https://github.com/awsdocs/aws-cdk-guide/issues/new) before working on a contribution that will take a significant amount of your time.
-
-For contributions that will take a significant amount of time, [open a new issue](https://github.com/awsdocs/aws-cdk-guide/issues/new) to pitch your idea before you get started. Explain the problem and describe the content you want to see added to the documentation. Let us know if you'll write it yourself or if you'd like us to help. We'll discuss your proposal with you and let you know whether we're likely to accept it. We don't want you to spend a lot of time on a contribution that might be outside the scope of the documentation or that's already in the works.
-
-## Finding contributions to work on
-
-If you'd like to contribute, but don't have a project in mind, look at the [open issues](https://github.com/awsdocs/aws-cdk-guide/issues) in this repository for some ideas.
-
-In addition to written content, we really appreciate new examples and code samples for our documentation, such as examples for different platforms or environments, and code samples in additional languages.
-
-## Code of conduct
-
-This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information, see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact [opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com) with any additional questions or comments.
-
-## Security issue notifications
-
-If you discover a potential security issue, please notify AWS Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public issue on GitHub.
-
-## Licensing
-
-See the [LICENSE](https://github.com/awsdocs/aws-cdk-guide/blob/main/LICENSE) file for this project's licensing. We will ask you to confirm the licensing of your contribution. We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
\ No newline at end of file
diff --git a/Config b/Config
deleted file mode 100755
index 2e9c79bf..00000000
--- a/Config
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*-perl-*-
-
-package.AWSCDKDocs = {
- flavors = {
- map = single;
- generation = 1;
- };
-
- interfaces = (3.0);
- deploy = {
- generic = true;
- };
- scope = webservices;
-
- build-system = zonbooktrails;
- build-environment = {
- chroot = basic;
- network-access = blocked;
- };
-
- build-tools = {
- 3.0 = {
- ZonBookTrails = 1.0;
-
- ZonBook = 5.0;
- AWSDocsSdkExamplesPublic = 1.0;
- AWSDocsChecklistCDK = 2.0;
- };
- };
-};
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..7785b904
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,152 @@
+Creative Commons Attribution-ShareAlike 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
+
+Section 1 – Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
+
+ b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
+
+ c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
+
+ d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
+
+ e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
+
+ f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
+
+ g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
+
+ h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
+
+ i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
+
+ j. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
+
+ k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
+
+ l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
+
+ m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
+
+Section 2 – Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
+
+ A. reproduce and Share the Licensed Material, in whole or in part; and
+
+ B. produce, reproduce, and Share Adapted Material.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section 6(a).
+
+ 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
+
+ B. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
+
+ C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this Public License.
+
+ 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
+
+Section 3 – License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material (including in modified form), You must:
+
+ A. retain the following if it is supplied by the Licensor with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
+
+ B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
+
+ C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
+
+ 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
+
+ b. ShareAlike.In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
+
+ 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
+
+ 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
+
+ 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
+
+Section 4 – Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
+
+ b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
+
+ c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
+For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
+
+Section 5 – Disclaimer of Warranties and Limitation of Liability.
+
+ a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
+
+ b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
+
+ c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
+
+Section 6 – Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
+
+ d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
+
+ e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
+
+Section 7 – Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
+
+Section 8 – Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
+
+ c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
diff --git a/LICENSE-SAMPLECODE b/LICENSE-SAMPLECODE
new file mode 100644
index 00000000..14aabc34
--- /dev/null
+++ b/LICENSE-SAMPLECODE
@@ -0,0 +1,14 @@
+Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this
+software and associated documentation files (the "Software"), to deal in the Software
+without restriction, including without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/LICENSE-SUMMARY b/LICENSE-SUMMARY
new file mode 100644
index 00000000..56888df1
--- /dev/null
+++ b/LICENSE-SUMMARY
@@ -0,0 +1,5 @@
+Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+
+The documentation is made available under the Creative Commons Attribution-ShareAlike 4.0 International License. See the LICENSE file.
+
+The sample code within this documentation is made available under a modified MIT license. See the LICENSE-SAMPLECODE file.
diff --git a/README.md b/README.md
index 0634f8fd..bfb56a0b 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,4 @@
-# Welcome to the AWS CDK Developer Guide
+# Default branch
-This is the GitHub repository for the [AWS CDK Developer Guide](https://docs.aws.amazon.com/cdk/latest/guide/home.html).
-You're welcome to [report issues](https://github.com/awsdocs/aws-cdk-guide/issues/new) with the documentation here or, if you have a moment, to submit a Pull Request with your suggested changes. PRs should target the main branch, not master, which has been deprecated.
-
-* `v2` - contains the Markdown files for the CDK v2 Developer Guide
-
-Feel free to make a Pull Request against only one of these content sets (we'll make sure it gets into both).
-
-Issues reported through the Feedback link at the bottom of the individual pages of the AWS CDK Developer Guide go to an internal Amazon issue tracker and may not appear here. However, we try to track most substantive AWS CDK Developer Guide work on GitHub
-so the community can see, comment, and contribute.
-
-## Other Documentation Issues
-
-* Issues with the [API Reference](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-construct-library.html) should be [filed](https://github.com/aws/aws-cdk/issues/new/choose) against the [AWS CDK repo](https://github.com/aws/aws-cdk/).
-* Issues with the [CDK Workshop](https://cdkworkshop.com/) should be [filed](https://github.com/aws-samples/aws-cdk-intro-workshop/issues/new/choose) against the [CDK Workshop repo](https://github.com/aws-samples/aws-cdk-intro-workshop).
-
-## Contributor Grant of License
-
-By submitting a Pull Request against this repo, you grant Amazon the right to use use, modify, copy, and redistribute your contribution under any license we choose.
\ No newline at end of file
+The default branch for this repo has changed to "main." If you have cloned the previous default branch,
+please update your local repo to use the "main" branch.
diff --git a/build b/build
deleted file mode 120000
index d386ee6d..00000000
--- a/build
+++ /dev/null
@@ -1 +0,0 @@
-/workplace/pgasca/AWSCDKDocs_1/build/AWSCDKDocs/AWSCDKDocs-3.0/AL2_x86_64/DEV.STD.PTHREAD/build
\ No newline at end of file
diff --git a/build-info.xml b/build-info.xml
deleted file mode 100755
index 55b11604..00000000
--- a/build-info.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
- cdk
- AWS Cloud Development Kit
- 0
- CDK
-
- 0
-
-
-
-
-
- guide
- awscdk
- Developer Guide
- CDK
- v2
- v2
- v2/guide
- en_us
-
-
-
-
- Developer Guide Updates
- awscdkv2
-
-
-
- 1
-
-
-
-
-
- awsdocs
- aws-cdk-guide
- main
- v2/guide
-
-
-
-
-
-
-
-
diff --git a/build.xml b/build.xml
deleted file mode 100755
index e8ba5d4f..00000000
--- a/build.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- This is the entry point for happy trails builds (package builder and eclipse).
-
-
-
-
\ No newline at end of file
diff --git a/doc-source b/doc-source
new file mode 100644
index 00000000..bfb56a0b
--- /dev/null
+++ b/doc-source
@@ -0,0 +1,4 @@
+# Default branch
+
+The default branch for this repo has changed to "main." If you have cloned the previous default branch,
+please update your local repo to use the "main" branch.
diff --git a/snippets/test-1.txt b/snippets/test-1.txt
new file mode 100644
index 00000000..ae6fc483
--- /dev/null
+++ b/snippets/test-1.txt
@@ -0,0 +1 @@
+// this is a test code snippet
diff --git a/snippets/test-2.txt b/snippets/test-2.txt
new file mode 100644
index 00000000..ae6fc483
--- /dev/null
+++ b/snippets/test-2.txt
@@ -0,0 +1 @@
+// this is a test code snippet
diff --git a/v2/guide/CDK_Project.xpr b/v2/guide/CDK_Project.xpr
deleted file mode 100644
index 129faa06..00000000
--- a/v2/guide/CDK_Project.xpr
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
- editor.detect.indent.on.open
- false
-
-
- editor.hard.line.wrap
- true
-
-
- editor.indent.size.v9.2
- 2
-
-
- editor.line.width
- 160
-
-
- key.editor.format.option.pane.group
- true
-
-
- validation.scenarios
-
-
-
-
-
-
-
-
-
-
diff --git a/v2/guide/apps.adoc b/v2/guide/apps.adoc
deleted file mode 100644
index 8486ec83..00000000
--- a/v2/guide/apps.adoc
+++ /dev/null
@@ -1,128 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Apps
-:keywords: {aws} CDK, {aws} CDK app
-
-[#apps]
-= {aws} CDK apps
-
-[abstract]
---
-The {aws} Cloud Development Kit ({aws} CDK) application or _app_ is a collection of one or more CDK xref:stacks[stacks]. Stacks are a collection of one or more xref:constructs[constructs], which define {aws} resources and properties. Therefore, the overall grouping of your stacks and constructs are known as your CDK app.
---
-
-// Content start
-
-The {aws} Cloud Development Kit ({aws} CDK) application or _app_ is a collection of one or more CDK xref:stacks[stacks]. Stacks are a collection of one or more xref:constructs[constructs], which define {aws} resources and properties. Therefore, the overall grouping of your stacks and constructs are known as your CDK app.
-
-[#apps-define]
-== How to create a CDK app
-
-You create an app by defining an app instance in the application file of your xref:projects[project]. To do this, you import and use the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.App.html[App] construct from the {aws} Construct Library. The `App` construct doesn't require any initialization arguments. It is the only construct that can be used as the root.
-
-The `https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.App.html[App]` and `https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html[Stack]` classes from the {aws} Construct Library are unique constructs. Compared to other constructs, they don't configure {aws} resources on their own. Instead, they are used to provide context for your other constructs. All constructs that represent {aws} resources must be defined, directly or indirectly, within the scope of a `Stack` construct. `Stack` constructs are defined within the scope of an `App` construct.
-
-Apps are then synthesized to create {aws} CloudFormation templates for your stacks. The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const app = new App();
-new MyFirstStack(app, 'hello-cdk');
-app.synth();
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const app = new App();
-new MyFirstStack(app, 'hello-cdk');
-app.synth();
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-app = App()
-MyFirstStack(app, "hello-cdk")
-app.synth()
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-App app = new App();
-new MyFirstStack(app, "hello-cdk");
-app.synth();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var app = new App();
-new MyFirstStack(app, "hello-cdk");
-app.Synth();
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-app := awscdk.NewApp(nil)
-
-MyFirstStack(app, "MyFirstStack", &MyFirstStackProps{
- awscdk.StackProps{
- Env: env(),
- },
-})
-
-app.Synth(nil)
-----
-====
-
-Stacks within a single app can easily refer to each other's resources and properties. The {aws} CDK infers dependencies between stacks so that they can be deployed in the correct order. You can deploy any or all of the stacks within an app with a single `cdk deploy` command.
-
-[#apps-tree]
-== The construct tree
-
-Constructs are defined inside of other constructs using the `scope` argument that is passed to every construct, with the `App` class as the root. In this way, an {aws} CDK app defines a hierarchy of constructs known as the _construct tree_.
-
-The root of this tree is your app, which is an instance of the `App` class. Within the app, you instantiate one or more stacks. Within stacks, you instantiate constructs, which may themselves instantiate resources or other constructs, and so on down the tree.
-
-Constructs are _always_ explicitly defined within the scope of another construct, which creates relationships between constructs. Almost always, you should pass `this` (in Python, `self`) as the scope, indicating that the new construct is a child of the current construct. The intended pattern is that you derive your construct from https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html[`Construct`], then instantiate the constructs it uses in its constructor.
-
-Passing the scope explicitly allows each construct to add itself to the tree, with this behavior entirely contained within the https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html[`Construct` base class]. It works the same way in every language supported by the {aws} CDK and does not require additional customization.
-
-[IMPORTANT]
-====
-
-Technically, it's possible to pass some scope other than `this` when instantiating a construct. You can add constructs anywhere in the tree, or even in another stack in the same app. For example, you could write a mixin-style function that adds constructs to a scope passed in as an argument. The practical difficulty here is that you can't easily ensure that the IDs you choose for your constructs are unique within someone else's scope. The practice also makes your code more difficult to understand, maintain, and reuse. Therefore, we recommend that you use the general structure of the construct tree.
-
-====
-
-The {aws} CDK uses the IDs of all constructs in the path from the tree's root to each child construct to generate the unique IDs required by {aws} CloudFormation. This approach means that construct IDs only need to be unique within their scope, rather than within the entire stack as in native {aws} CloudFormation. However, if you move a construct to a different scope, its generated stack-unique ID changes, and {aws} CloudFormation won't consider it the same resource.
-
-The construct tree is separate from the constructs that you define in your {aws} CDK code. However, it's accessible through any construct's `node` attribute, which is a reference to the node that represents that construct in the tree. Each node is a https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html[`Node`] instance, the attributes of which provide access to the tree's root and to the node's parent scopes and children.
-
-. `node.children` – The direct children of the construct.
-. `node.id` – The identifier of the construct within its scope.
-. `node.path` – The full path of the construct including the IDs of all of its parents.
-. `node.root` – The root of the construct tree (the app).
-. `node.scope` – The scope (parent) of the construct, or undefined if the node is the root.
-. `node.scopes` – All parents of the construct, up to the root.
-. `node.uniqueId` – The unique alphanumeric identifier for this construct within the tree (by default, generated from `node.path` and a hash).
-
-The construct tree defines an implicit order in which constructs are synthesized to resources in the final {aws} CloudFormation template. Where one resource must be created before another, {aws} CloudFormation or the {aws} Construct Library generally infers the dependency. They then make sure that the resources are created in the right order.
-
-You can also add an explicit dependency between two nodes by using `node.addDependency()`. For more information, see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib-readme.html#dependencies[Dependencies] in the _{aws} CDK API Reference_.
-
-The {aws} CDK provides a simple way to visit every node in the construct tree and perform an operation on each one. For more information, see xref:aspects[Aspects and the {aws} CDK].
\ No newline at end of file
diff --git a/v2/guide/aspects.adoc b/v2/guide/aspects.adoc
deleted file mode 100644
index d7b5bcf0..00000000
--- a/v2/guide/aspects.adoc
+++ /dev/null
@@ -1,252 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#aspects]
-= Aspects and the {aws} CDK
-:info_titleabbrev: Aspects
-:keywords: {aws} CDK, aspects
-
-[abstract]
---
-Aspects are a way to apply an operation to all constructs in a given scope. The aspect could modify the constructs, such as by adding tags. Or it could verify something about the state of the constructs, such as making sure that all buckets are encrypted.
---
-
-// Content start
-
-Aspects are a way to apply an operation to all constructs in a given scope. The aspect could modify the constructs, such as by adding tags. Or it could verify something about the state of the constructs, such as making sure that all buckets are encrypted.
-
-To apply an aspect to a construct and all constructs in the same scope, call `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Aspects.html#static-ofscope[Aspects].of().add()` with a new aspect, as shown in the following example.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-Aspects.of(myConstruct).add(new SomeAspect(...));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-Aspects.of(myConstruct).add(new SomeAspect(...));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-Aspects.of(my_construct).add(SomeAspect(...))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-Aspects.of(myConstruct).add(new SomeAspect(...));
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-Aspects.Of(myConstruct).add(new SomeAspect(...));
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-awscdk.Aspects_Of(stack).Add(awscdk.NewTag(...))
-----
-====
-
-The {aws} CDK uses aspects to xref:tagging[tag resources], but the framework can also be used for other purposes. For example, you can use it to validate or change the {aws} CloudFormation resources that are defined for you by higher-level constructs.
-
-[#aspects-detail]
-== Aspects in detail
-
-Aspects employ the link:https://en.wikipedia.org/wiki/Visitor_pattern[visitor pattern]. An aspect is a class that implements the following interface.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-interface IAspect {
- visit(node: IConstruct): void;}
-----
-
-JavaScript::
-JavaScript doesn't have interfaces as a language feature. Therefore, an aspect is simply an instance of a class having a `visit` method that accepts the node to be operated on.
-
-Python::
-Python doesn't have interfaces as a language feature. Therefore, an aspect is simply an instance of a class having a `visit` method that accepts the node to be operated on.
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public interface IAspect {
- public void visit(Construct node);
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-public interface IAspect
-{
- void Visit(IConstruct node);
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-type IAspect interface {
- Visit(node constructs.IConstruct)
-}
-----
-====
-
-When you call `Aspects.of().add(...)`, the construct adds the aspect to an internal list of aspects. You can obtain the list with `Aspects.of()`.
-
-During the xref:deploy-how-synth-app[prepare phase], the {aws} CDK calls the `visit` method of the object for the construct and each of its children in top-down order.
-
-The `visit` method is free to change anything in the construct. In strongly typed languages, cast the received construct to a more specific type before accessing construct-specific properties or methods.
-
-Aspects don't propagate across `Stage` construct boundaries, because `Stages` are self-contained and immutable after definition. Apply aspects on the `Stage` construct itself (or lower) if you want them to visit constructs inside the ``Stage``.
-
-[#aspects-example]
-== Example
-
-The following example validates that all buckets created in the stack have versioning enabled. The aspect adds an error annotation to the constructs that fail the validation. This results in the `synth` operation failing and prevents deploying the resulting cloud assembly.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-class BucketVersioningChecker implements IAspect {
- public visit(node: IConstruct): void {
- // See that we're dealing with a CfnBucket
- if (node instanceof s3.CfnBucket) {
-
- // Check for versioning property, exclude the case where the property
- // can be a token (IResolvable).
- if (!node.versioningConfiguration
- || (!Tokenization.isResolvable(node.versioningConfiguration)
- && node.versioningConfiguration.status !== 'Enabled')) {
- Annotations.of(node).addError('Bucket versioning is not enabled');
- }
- }
- }
-}
-
-// Later, apply to the stack
-Aspects.of(stack).add(new BucketVersioningChecker());
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-class BucketVersioningChecker {
- visit(node) {
- // See that we're dealing with a CfnBucket
- if ( node instanceof s3.CfnBucket) {
-
- // Check for versioning property, exclude the case where the property
- // can be a token (IResolvable).
- if (!node.versioningConfiguration
- || !Tokenization.isResolvable(node.versioningConfiguration)
- && node.versioningConfiguration.status !== 'Enabled')) {
- Annotations.of(node).addError('Bucket versioning is not enabled');
- }
- }
- }
-}
-
-// Later, apply to the stack
-Aspects.of(stack).add(new BucketVersioningChecker());
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-@jsii.implements(cdk.IAspect)
-class BucketVersioningChecker:
-
- def visit(self, node):
- # See that we're dealing with a CfnBucket
- if isinstance(node, s3.CfnBucket):
-
- # Check for versioning property, exclude the case where the property
- # can be a token (IResolvable).
- if (not node.versioning_configuration or
- not Tokenization.is_resolvable(node.versioning_configuration)
- and node.versioning_configuration.status != "Enabled"):
- Annotations.of(node).add_error('Bucket versioning is not enabled')
-
-# Later, apply to the stack
-Aspects.of(stack).add(BucketVersioningChecker())
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class BucketVersioningChecker implements IAspect
-{
- @Override
- public void visit(Construct node)
- {
- // See that we're dealing with a CfnBucket
- if (node instanceof CfnBucket)
- {
- CfnBucket bucket = (CfnBucket)node;
- Object versioningConfiguration = bucket.getVersioningConfiguration();
- if (versioningConfiguration == null ||
- !Tokenization.isResolvable(versioningConfiguration.toString()) &&
- !versioningConfiguration.toString().contains("Enabled"))
- Annotations.of(bucket.getNode()).addError("Bucket versioning is not enabled");
- }
- }
-}
-
-// Later, apply to the stack
-Aspects.of(stack).add(new BucketVersioningChecker());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-class BucketVersioningChecker : Amazon.Jsii.Runtime.Deputy.DeputyBase, IAspect
-{
- public void Visit(IConstruct node)
- {
- // See that we're dealing with a CfnBucket
- if (node is CfnBucket)
- {
- var bucket = (CfnBucket)node;
- if (bucket.VersioningConfiguration is null ||
- !Tokenization.IsResolvable(bucket.VersioningConfiguration) &&
- !bucket.VersioningConfiguration.ToString().Contains("Enabled"))
- Annotations.Of(bucket.Node).AddError("Bucket versioning is not enabled");
- }
- }
-}
-
-// Later, apply to the stack
-Aspects.Of(stack).add(new BucketVersioningChecker());
-----
-====
\ No newline at end of file
diff --git a/v2/guide/assets.adoc b/v2/guide/assets.adoc
deleted file mode 100644
index 51003074..00000000
--- a/v2/guide/assets.adoc
+++ /dev/null
@@ -1,1182 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Assets
-:keywords: {aws} CDK, Assets, Amazon S3, Amazon ECR
-
-[#assets]
-= Assets and the {aws} CDK
-
-[abstract]
---
-Assets are local files, directories, or Docker images.
---
-
-// Content start
-
-Assets are local files, directories, or Docker images that can be bundled into {aws} CDK libraries and apps. For example, an asset might be a directory that contains the handler code for an {aws} Lambda function. Assets can represent any artifact that the app needs to operate.
-
-The following tutorial video provides a comprehensive overview of CDK assets, and explains how you can use them in your infrastructure as code (IaC).
-
-video::jHNtXQmkKfw[youtube,align = center,height = 390,fileref = https://www.youtube.com/embed/jHNtXQmkKfw,width = 480]
-
-You add assets through APIs that are exposed by specific {aws} constructs. For example, when you define a https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html[`lambda.Function`] construct, the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html#code[`code`] property lets you pass an https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Code.html#static-fromwbrassetpath-options[`asset`] (directory). `Function` uses assets to bundle the contents of the directory and use it for the function's code. Similarly, https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ContainerImage.html#static-fromwbrassetdirectory-props[`ecs.ContainerImage.fromAsset`] uses a Docker image built from a local directory when defining an Amazon ECS task definition.
-
-[#assets-details]
-== Assets in detail
-
-When you refer to an asset in your app, the xref:deploy-how-synth-assemblies[cloud assembly] that's synthesized from your application includes metadata information with instructions for the {aws} CDK CLI. The instructions include where to find the asset on the local disk and what type of bundling to perform based on the asset type, such as a directory to compress (zip) or a Docker image to build.
-
-The {aws} CDK generates a source hash for assets. This can be used at construction time to determine whether the contents of an asset have changed.
-
-By default, the {aws} CDK creates a copy of the asset in the cloud assembly directory, which defaults to `cdk.out`, under the source hash. This way, the cloud assembly is self-contained, so if it moved over to a different host for deployment, it can still be deployed. See xref:deploy-how-synth-assemblies[Cloud assemblies] for details.
-
-When the {aws} CDK deploys an app that references assets (either directly by the app code or through a library), the {aws} CDK CLI first prepares and publishes the assets to an Amazon S3 bucket or Amazon ECR repository. (The S3 bucket or repository is created during bootstrapping.) Only then are the resources defined in the stack deployed.
-
-This section describes the low-level APIs available in the framework.
-
-[#assets-types]
-== Asset types
-
-The {aws} CDK supports the following types of assets:
-
-Amazon S3 assets::
-+
-These are local files and directories that the {aws} CDK uploads to Amazon S3.
-
-Docker Image::
-+
-These are Docker images that the {aws} CDK uploads to Amazon ECR.
-
-These asset types are explained in the following sections.
-
-[#assets-types-s3]
-== Amazon S3 assets
-
-You can define local files and directories as assets, and the {aws} CDK packages and uploads them to Amazon S3 through the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets-readme.html[`aws-s3-assets`] module.
-
-The following example defines a local directory asset and a file asset.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { Asset } from 'aws-cdk-lib/aws-s3-assets';
-
-// Archived and uploaded to Amazon S3 as a .zip file
-const directoryAsset = new Asset(this, "SampleZippedDirAsset", {
- path: path.join(__dirname, "sample-asset-directory")
-});
-
-// Uploaded to Amazon S3 as-is
-const fileAsset = new Asset(this, 'SampleSingleFileAsset', {
- path: path.join(__dirname, 'file-asset.txt')
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Asset } = require('aws-cdk-lib/aws-s3-assets');
-
-// Archived and uploaded to Amazon S3 as a .zip file
-const directoryAsset = new Asset(this, "SampleZippedDirAsset", {
- path: path.join(__dirname, "sample-asset-directory")
-});
-
-// Uploaded to Amazon S3 as-is
-const fileAsset = new Asset(this, 'SampleSingleFileAsset', {
- path: path.join(__dirname, 'file-asset.txt')
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import os.path
-dirname = os.path.dirname(__file__)
-
-from aws_cdk.aws_s3_assets import Asset
-
-# Archived and uploaded to Amazon S3 as a .zip file
-directory_asset = Asset(self, "SampleZippedDirAsset",
- path=os.path.join(dirname, "sample-asset-directory")
-)
-
-# Uploaded to Amazon S3 as-is
-file_asset = Asset(self, 'SampleSingleFileAsset',
- path=os.path.join(dirname, 'file-asset.txt')
-)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import java.io.File;
-
-import software.amazon.awscdk.services.s3.assets.Asset;
-
-// Directory where app was started
-File startDir = new File(System.getProperty("user.dir"));
-
-// Archived and uploaded to Amazon S3 as a .zip file
-Asset directoryAsset = Asset.Builder.create(this, "SampleZippedDirAsset")
- .path(new File(startDir, "sample-asset-directory").toString()).build();
-
-// Uploaded to Amazon S3 as-is
-Asset fileAsset = Asset.Builder.create(this, "SampleSingleFileAsset")
- .path(new File(startDir, "file-asset.txt").toString()).build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using System.IO;
-using Amazon.CDK.{aws}.S3.Assets;
-
-// Archived and uploaded to Amazon S3 as a .zip file
-var directoryAsset = new Asset(this, "SampleZippedDirAsset", new AssetProps
-{
- Path = Path.Combine(Directory.GetCurrentDirectory(), "sample-asset-directory")
-});
-
-// Uploaded to Amazon S3 as-is
-var fileAsset = new Asset(this, "SampleSingleFileAsset", new AssetProps
-{
- Path = Path.Combine(Directory.GetCurrentDirectory(), "file-asset.txt")
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-dirName, err := os.Getwd()
-if err != nil {
- panic(err)
-}
-
-awss3assets.NewAsset(stack, jsii.String("SampleZippedDirAsset"), &awss3assets.AssetProps{
- Path: jsii.String(path.Join(dirName, "sample-asset-directory")),
-})
-
-awss3assets.NewAsset(stack, jsii.String("SampleSingleFileAsset"), &awss3assets.AssetProps{
- Path: jsii.String(path.Join(dirName, "file-asset.txt")),
-})
-----
-====
-
-In most cases, you don't need to directly use the APIs in the `aws-s3-assets` module. Modules that support assets, such as `aws-lambda`, have convenience methods so that you can use assets. For Lambda functions, the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Code.html#static-fromwbrassetpath-options[`fromAsset()`] static method enables you to specify a directory or a .zip file in the local file system.
-
-[#assets-types-s3-lambda]
-=== Lambda function example
-
-A common use case is creating Lambda functions with the handler code as an Amazon S3 asset.
-
-The following example uses an Amazon S3 asset to define a Python handler in the local directory `handler`. It also creates a Lambda function with the local directory asset as the `code` property. Following is the Python code for the handler.
-
-[source,python,subs="verbatim,attributes"]
-----
-def lambda_handler(event, context):
- message = 'Hello World!'
- return {
- 'message': message
- }
-----
-
-The code for the main {aws} CDK app should look like the following.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Constructs } from 'constructs';
-import * as lambda from 'aws-cdk-lib/aws-lambda';
-import * as path from 'path';
-
-export class HelloAssetStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- new lambda.Function(this, 'myLambdaFunction', {
- code: lambda.Code.fromAsset(path.join(__dirname, 'handler')),
- runtime: lambda.Runtime.PYTHON_3_6,
- handler: 'index.lambda_handler'
- });
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const lambda = require('aws-cdk-lib/aws-lambda');
-const path = require('path');
-
-class HelloAssetStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- new lambda.Function(this, 'myLambdaFunction', {
- code: lambda.Code.fromAsset(path.join(__dirname, 'handler')),
- runtime: lambda.Runtime.PYTHON_3_6,
- handler: 'index.lambda_handler'
- });
- }
-}
-
-module.exports = { HelloAssetStack }
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import Stack
-from constructs import Construct
-from aws_cdk import aws_lambda as lambda_
-
-import os.path
-dirname = os.path.dirname(__file__)
-
-class HelloAssetStack(Stack):
- def __init__(self, scope: Construct, id: str, **kwargs):
- super().__init__(scope, id, **kwargs)
-
- lambda_.Function(self, 'myLambdaFunction',
- code=lambda_.Code.from_asset(os.path.join(dirname, 'handler')),
- runtime=lambda_.Runtime.PYTHON_3_6,
- handler="index.lambda_handler")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import java.io.File;
-
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.amazon.awscdk.services.lambda.Function;
-import software.amazon.awscdk.services.lambda.Runtime;
-
-public class HelloAssetStack extends Stack {
-
- public HelloAssetStack(final App scope, final String id) {
- this(scope, id, null);
- }
-
- public HelloAssetStack(final App scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- File startDir = new File(System.getProperty("user.dir"));
-
- Function.Builder.create(this, "myLambdaFunction")
- .code(Code.fromAsset(new File(startDir, "handler").toString()))
- .runtime(Runtime.PYTHON_3_6)
- .handler("index.lambda_handler").build();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.{aws}.Lambda;
-using System.IO;
-
-public class HelloAssetStack : Stack
-{
- public HelloAssetStack(Construct scope, string id, StackProps props) : base(scope, id, props)
- {
- new Function(this, "myLambdaFunction", new FunctionProps
- {
- Code = Code.FromAsset(Path.Combine(Directory.GetCurrentDirectory(), "handler")),
- Runtime = Runtime.PYTHON_3_6,
- Handler = "index.lambda_handler"
- });
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import (
- "os"
- "path"
-
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
- "github.com/aws/aws-cdk-go/awscdk/v2/awss3assets"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-func HelloAssetStack(scope constructs.Construct, id string, props *HelloAssetStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- dirName, err := os.Getwd()
- if err != nil {
- panic(err)
- }
-
- awslambda.NewFunction(stack, jsii.String("myLambdaFunction"), &awslambda.FunctionProps{
- Code: awslambda.AssetCode_FromAsset(jsii.String(path.Join(dirName, "handler")), &awss3assets.AssetOptions{}),
- Runtime: awslambda.Runtime_PYTHON_3_6(),
- Handler: jsii.String("index.lambda_handler"),
- })
-
- return stack
-}
-----
-====
-
-The `Function` method uses assets to bundle the contents of the directory and use it for the function's code.
-
-[TIP]
-====
-
-Java `.jar` files are ZIP files with a different extension. These are uploaded as-is to Amazon S3, but when deployed as a Lambda function, the files they contain are extracted, which you might not want. To avoid this, place the `.jar` file in a directory and specify that directory as the asset.
-
-====
-
-[#assets-types-s3-deploy]
-=== Deploy-time attributes example
-
-Amazon S3 asset types also expose xref:resources-attributes[deploy-time attributes] that can be referenced in {aws} CDK libraries and apps. The {aws} CDK CLI command `cdk synth` displays asset properties as {aws} CloudFormation parameters.
-
-The following example uses deploy-time attributes to pass the location of an image asset into a Lambda function as environment variables. (The kind of file doesn't matter; the PNG image used here is only an example.)
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { Asset } from 'aws-cdk-lib/aws-s3-assets';
-import * as path from 'path';
-
-const imageAsset = new Asset(this, "SampleAsset", {
- path: path.join(__dirname, "images/my-image.png")
-});
-
-new lambda.Function(this, "myLambdaFunction", {
- code: lambda.Code.asset(path.join(__dirname, "handler")),
- runtime: lambda.Runtime.PYTHON_3_6,
- handler: "index.lambda_handler",
- environment: {
- 'S3_BUCKET_NAME': imageAsset.s3BucketName,
- 'S3_OBJECT_KEY': imageAsset.s3ObjectKey,
- 'S3_OBJECT_URL': imageAsset.s3ObjectUrl
- }
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Asset } = require('aws-cdk-lib/aws-s3-assets');
-const path = require('path');
-
-const imageAsset = new Asset(this, "SampleAsset", {
- path: path.join(__dirname, "images/my-image.png")
-});
-
-new lambda.Function(this, "myLambdaFunction", {
- code: lambda.Code.asset(path.join(__dirname, "handler")),
- runtime: lambda.Runtime.PYTHON_3_6,
- handler: "index.lambda_handler",
- environment: {
- 'S3_BUCKET_NAME': imageAsset.s3BucketName,
- 'S3_OBJECT_KEY': imageAsset.s3ObjectKey,
- 'S3_OBJECT_URL': imageAsset.s3ObjectUrl
- }
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import os.path
-
-import aws_cdk.aws_lambda as lambda_
-from aws_cdk.aws_s3_assets import Asset
-
-dirname = os.path.dirname(__file__)
-
-image_asset = Asset(self, "SampleAsset",
- path=os.path.join(dirname, "images/my-image.png"))
-
-lambda_.Function(self, "myLambdaFunction",
- code=lambda_.Code.asset(os.path.join(dirname, "handler")),
- runtime=lambda_.Runtime.PYTHON_3_6,
- handler="index.lambda_handler",
- environment=dict(
- S3_BUCKET_NAME=image_asset.s3_bucket_name,
- S3_OBJECT_KEY=image_asset.s3_object_key,
- S3_OBJECT_URL=image_asset.s3_object_url))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import java.io.File;
-
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.amazon.awscdk.services.lambda.Function;
-import software.amazon.awscdk.services.lambda.Runtime;
-import software.amazon.awscdk.services.s3.assets.Asset;
-
-public class FunctionStack extends Stack {
- public FunctionStack(final App scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- File startDir = new File(System.getProperty("user.dir"));
-
- Asset imageAsset = Asset.Builder.create(this, "SampleAsset")
- .path(new File(startDir, "images/my-image.png").toString()).build())
-
- Function.Builder.create(this, "myLambdaFunction")
- .code(Code.fromAsset(new File(startDir, "handler").toString()))
- .runtime(Runtime.PYTHON_3_6)
- .handler("index.lambda_handler")
- .environment(java.util.Map.of( // Java 9 or later
- "S3_BUCKET_NAME", imageAsset.getS3BucketName(),
- "S3_OBJECT_KEY", imageAsset.getS3ObjectKey(),
- "S3_OBJECT_URL", imageAsset.getS3ObjectUrl()))
- .build();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.{aws}.Lambda;
-using Amazon.CDK.{aws}.S3.Assets;
-using System.IO;
-using System.Collections.Generic;
-
-var imageAsset = new Asset(this, "SampleAsset", new AssetProps
-{
- Path = Path.Combine(Directory.GetCurrentDirectory(), @"images\my-image.png")
-});
-
-new Function(this, "myLambdaFunction", new FunctionProps
-{
- Code = Code.FromAsset(Path.Combine(Directory.GetCurrentDirectory(), "handler")),
- Runtime = Runtime.PYTHON_3_6,
- Handler = "index.lambda_handler",
- Environment = new Dictionary
- {
- ["S3_BUCKET_NAME"] = imageAsset.S3BucketName,
- ["S3_OBJECT_KEY"] = imageAsset.S3ObjectKey,
- ["S3_OBJECT_URL"] = imageAsset.S3ObjectUrl
- }
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import (
- "os"
- "path"
-
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
- "github.com/aws/aws-cdk-go/awscdk/v2/awss3assets"
-)
-
-dirName, err := os.Getwd()
-if err != nil {
- panic(err)
-}
-
-imageAsset := awss3assets.NewAsset(stack, jsii.String("SampleAsset"), &awss3assets.AssetProps{
- Path: jsii.String(path.Join(dirName, "images/my-image.png")),
-})
-
-awslambda.NewFunction(stack, jsii.String("myLambdaFunction"), &awslambda.FunctionProps{
- Code: awslambda.AssetCode_FromAsset(jsii.String(path.Join(dirName, "handler"))),
- Runtime: awslambda.Runtime_PYTHON_3_6(),
- Handler: jsii.String("index.lambda_handler"),
- Environment: &map[string]*string{
- "S3_BUCKET_NAME": imageAsset.S3BucketName(),
- "S3_OBJECT_KEY": imageAsset.S3ObjectKey(),
- "S3_URL": imageAsset.S3ObjectUrl(),
- },
-})
-----
-====
-
-[#assets-types-s3-permissions]
-=== Permissions
-
-If you use Amazon S3 assets directly through the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets-readme.html[`aws-s3-assets`] module, IAM roles, users, or groups, and you need to read assets in runtime, then grant those assets IAM permissions through the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets.Asset.html#grantwbrreadgrantee[`asset.grantRead`] method.
-
-The following example grants an IAM group read permissions on a file asset.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { Asset } from 'aws-cdk-lib/aws-s3-assets';
-import * as path from 'path';
-
-const asset = new Asset(this, 'MyFile', {
- path: path.join(__dirname, 'my-image.png')
-});
-
-const group = new iam.Group(this, 'MyUserGroup');
-asset.grantRead(group);
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Asset } = require('aws-cdk-lib/aws-s3-assets');
-const path = require('path');
-
-const asset = new Asset(this, 'MyFile', {
- path: path.join(__dirname, 'my-image.png')
-});
-
-const group = new iam.Group(this, 'MyUserGroup');
-asset.grantRead(group);
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk.aws_s3_assets import Asset
-import aws_cdk.aws_iam as iam
-
-import os.path
-dirname = os.path.dirname(__file__)
-
- asset = Asset(self, "MyFile",
- path=os.path.join(dirname, "my-image.png"))
-
- group = iam.Group(self, "MyUserGroup")
- asset.grant_read(group)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import java.io.File;
-
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.amazon.awscdk.services.iam.Group;
-import software.amazon.awscdk.services.s3.assets.Asset;
-
-public class GrantStack extends Stack {
- public GrantStack(final App scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- File startDir = new File(System.getProperty("user.dir"));
-
- Asset asset = Asset.Builder.create(this, "SampleAsset")
- .path(new File(startDir, "images/my-image.png").toString()).build();
-
- Group group = new Group(this, "MyUserGroup");
- asset.grantRead(group); }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.{aws}.IAM;
-using Amazon.CDK.{aws}.S3.Assets;
-using System.IO;
-
-var asset = new Asset(this, "MyFile", new AssetProps {
- Path = Path.Combine(Path.Combine(Directory.GetCurrentDirectory(), @"images\my-image.png"))
-});
-
-var group = new Group(this, "MyUserGroup");
-asset.GrantRead(group);
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import (
- "os"
- "path"
-
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awsiam"
- "github.com/aws/aws-cdk-go/awscdk/v2/awss3assets"
-)
-
-dirName, err := os.Getwd()
-if err != nil {
- panic(err)
-}
-
-asset := awss3assets.NewAsset(stack, jsii.String("MyFile"), &awss3assets.AssetProps{
- Path: jsii.String(path.Join(dirName, "my-image.png")),
-})
-
-group := awsiam.NewGroup(stack, jsii.String("MyUserGroup"), &awsiam.GroupProps{})
-
-asset.GrantRead(group)
-----
-====
-
-[#assets-types-docker]
-== Docker image assets
-
-The {aws} CDK supports bundling local Docker images as assets through the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr_assets-readme.html[`aws-ecr-assets`] module.
-
-The following example defines a Docker image that is built locally and pushed to Amazon ECR. Images are built from a local Docker context directory (with a Dockerfile) and uploaded to Amazon ECR by the {aws} CDK CLI or your app's CI/CD pipeline. The images can be naturally referenced in your {aws} CDK app.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';
-
-const asset = new DockerImageAsset(this, 'MyBuildImage', {
- directory: path.join(__dirname, 'my-image')
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { DockerImageAsset } = require('aws-cdk-lib/aws-ecr-assets');
-
-const asset = new DockerImageAsset(this, 'MyBuildImage', {
- directory: path.join(__dirname, 'my-image')
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk.aws_ecr_assets import DockerImageAsset
-
-import os.path
-dirname = os.path.dirname(__file__)
-
-asset = DockerImageAsset(self, 'MyBuildImage',
- directory=os.path.join(dirname, 'my-image'))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.ecr.assets.DockerImageAsset;
-
-File startDir = new File(System.getProperty("user.dir"));
-
-DockerImageAsset asset = DockerImageAsset.Builder.create(this, "MyBuildImage")
- .directory(new File(startDir, "my-image").toString()).build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using System.IO;
-using Amazon.CDK.{aws}.ECR.Assets;
-
-var asset = new DockerImageAsset(this, "MyBuildImage", new DockerImageAssetProps
-{
- Directory = Path.Combine(Directory.GetCurrentDirectory(), "my-image")
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import (
- "os"
- "path"
-
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awsecrassets"
-)
-
-dirName, err := os.Getwd()
-if err != nil {
- panic(err)
-}
-
-asset := awsecrassets.NewDockerImageAsset(stack, jsii.String("MyBuildImage"), &awsecrassets.DockerImageAssetProps{
- Directory: jsii.String(path.Join(dirName, "my-image")),
-})
-----
-====
-
-The `my-image` directory must include a Dockerfile. The {aws} CDK CLI builds a Docker image from `my-image`, pushes it to an Amazon ECR repository, and specifies the name of the repository as an {aws} CloudFormation parameter to your stack. Docker image asset types expose xref:resources-attributes[deploy-time attributes] that can be referenced in {aws} CDK libraries and apps. The {aws} CDK CLI command `cdk synth` displays asset properties as {aws} CloudFormation parameters.
-
-[#assets-types-docker-ecs]
-=== Amazon ECS task definition example
-
-A common use case is to create an Amazon ECS https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.TaskDefinition.html[`TaskDefinition`] to run Docker containers. The following example specifies the location of a Docker image asset that the {aws} CDK builds locally and pushes to Amazon ECR.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as ecs from 'aws-cdk-lib/aws-ecs';
-import * as ecr_assets from 'aws-cdk-lib/aws-ecr-assets';
-import * as path from 'path';
-
-const taskDefinition = new ecs.FargateTaskDefinition(this, "TaskDef", {
- memoryLimitMiB: 1024,
- cpu: 512
-});
-
-const asset = new ecr_assets.DockerImageAsset(this, 'MyBuildImage', {
- directory: path.join(__dirname, 'my-image')
-});
-
-taskDefinition.addContainer("my-other-container", {
- image: ecs.ContainerImage.fromDockerImageAsset(asset)
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const ecs = require('aws-cdk-lib/aws-ecs');
-const ecr_assets = require('aws-cdk-lib/aws-ecr-assets');
-const path = require('path');
-
-const taskDefinition = new ecs.FargateTaskDefinition(this, "TaskDef", {
- memoryLimitMiB: 1024,
- cpu: 512
-});
-
-const asset = new ecr_assets.DockerImageAsset(this, 'MyBuildImage', {
- directory: path.join(__dirname, 'my-image')
-});
-
-taskDefinition.addContainer("my-other-container", {
- image: ecs.ContainerImage.fromDockerImageAsset(asset)
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_ecs as ecs
-import aws_cdk.aws_ecr_assets as ecr_assets
-
-import os.path
-dirname = os.path.dirname(__file__)
-
-task_definition = ecs.FargateTaskDefinition(self, "TaskDef",
- memory_limit_mib=1024,
- cpu=512)
-
-asset = ecr_assets.DockerImageAsset(self, 'MyBuildImage',
- directory=os.path.join(dirname, 'my-image'))
-
-task_definition.add_container("my-other-container",
- image=ecs.ContainerImage.from_docker_image_asset(asset))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import java.io.File;
-
-import software.amazon.awscdk.services.ecs.FargateTaskDefinition;
-import software.amazon.awscdk.services.ecs.ContainerDefinitionOptions;
-import software.amazon.awscdk.services.ecs.ContainerImage;
-
-import software.amazon.awscdk.services.ecr.assets.DockerImageAsset;
-
-File startDir = new File(System.getProperty("user.dir"));
-
-FargateTaskDefinition taskDefinition = FargateTaskDefinition.Builder.create(
- this, "TaskDef").memoryLimitMiB(1024).cpu(512).build();
-
-DockerImageAsset asset = DockerImageAsset.Builder.create(this, "MyBuildImage")
- .directory(new File(startDir, "my-image").toString()).build();
-
-taskDefinition.addContainer("my-other-container",
- ContainerDefinitionOptions.builder()
- .image(ContainerImage.fromDockerImageAsset(asset))
- .build();
-)
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using System.IO;
-using Amazon.CDK.{aws}.ECS;
-using Amazon.CDK.{aws}.Ecr.Assets;
-
-var taskDefinition = new FargateTaskDefinition(this, "TaskDef", new FargateTaskDefinitionProps
-{
- MemoryLimitMiB = 1024,
- Cpu = 512
-});
-
-var asset = new DockerImageAsset(this, "MyBuildImage", new DockerImageAssetProps
-{
- Directory = Path.Combine(Directory.GetCurrentDirectory(), "my-image")
-});
-
-taskDefinition.AddContainer("my-other-container", new ContainerDefinitionOptions
-{
- Image = ContainerImage.FromDockerImageAsset(asset)
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import (
- "os"
- "path"
-
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awsecrassets"
- "github.com/aws/aws-cdk-go/awscdk/v2/awsecs"
-)
-
-dirName, err := os.Getwd()
-if err != nil {
- panic(err)
-}
-
-taskDefinition := awsecs.NewTaskDefinition(stack, jsii.String("TaskDef"), &awsecs.TaskDefinitionProps{
- MemoryMiB: jsii.String("1024"),
- Cpu: jsii.String("512"),
-})
-
-asset := awsecrassets.NewDockerImageAsset(stack, jsii.String("MyBuildImage"), &awsecrassets.DockerImageAssetProps{
- Directory: jsii.String(path.Join(dirName, "my-image")),
-})
-
-taskDefinition.AddContainer(jsii.String("MyOtherContainer"), &awsecs.ContainerDefinitionOptions{
- Image: awsecs.ContainerImage_FromDockerImageAsset(asset),
-})
-----
-====
-
-
-[#assets-types-docker-deploy]
-=== Deploy-time attributes example
-
-The following example shows how to use the deploy-time attributes `repository` and `imageUri` to create an Amazon ECS task definition with the {aws} Fargate launch type. Note that the Amazon ECR repo lookup requires the image's tag, not its URI, so we snip it from the end of the asset's URI.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as ecs from 'aws-cdk-lib/aws-ecs';
-import * as path from 'path';
-import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets';
-
-const asset = new DockerImageAsset(this, 'my-image', {
- directory: path.join(__dirname, "..", "demo-image")
-});
-
-const taskDefinition = new ecs.FargateTaskDefinition(this, "TaskDef", {
- memoryLimitMiB: 1024,
- cpu: 512
-});
-
-taskDefinition.addContainer("my-other-container", {
- image: ecs.ContainerImage.fromEcrRepository(asset.repository, asset.imageUri.split(":").pop())
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const ecs = require('aws-cdk-lib/aws-ecs');
-const path = require('path');
-const { DockerImageAsset } = require('aws-cdk-lib/aws-ecr-assets');
-
-const asset = new DockerImageAsset(this, 'my-image', {
- directory: path.join(__dirname, "..", "demo-image")
-});
-
-const taskDefinition = new ecs.FargateTaskDefinition(this, "TaskDef", {
- memoryLimitMiB: 1024,
- cpu: 512
-});
-
-taskDefinition.addContainer("my-other-container", {
- image: ecs.ContainerImage.fromEcrRepository(asset.repository, asset.imageUri.split(":").pop())
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_ecs as ecs
-from aws_cdk.aws_ecr_assets import DockerImageAsset
-
-import os.path
-dirname = os.path.dirname(__file__)
-
-asset = DockerImageAsset(self, 'my-image',
- directory=os.path.join(dirname, "..", "demo-image"))
-
-task_definition = ecs.FargateTaskDefinition(self, "TaskDef",
- memory_limit_mib=1024, cpu=512)
-
-task_definition.add_container("my-other-container",
- image=ecs.ContainerImage.from_ecr_repository(
- asset.repository, asset.image_uri.rpartition(":")[-1]))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import java.io.File;
-
-import software.amazon.awscdk.services.ecr.assets.DockerImageAsset;
-
-import software.amazon.awscdk.services.ecs.FargateTaskDefinition;
-import software.amazon.awscdk.services.ecs.ContainerDefinitionOptions;
-import software.amazon.awscdk.services.ecs.ContainerImage;
-
-File startDir = new File(System.getProperty("user.dir"));
-
-DockerImageAsset asset = DockerImageAsset.Builder.create(this, "my-image")
- .directory(new File(startDir, "demo-image").toString()).build();
-
-FargateTaskDefinition taskDefinition = FargateTaskDefinition.Builder.create(
- this, "TaskDef").memoryLimitMiB(1024).cpu(512).build();
-
-// extract the tag from the asset's image URI for use in ECR repo lookup
-String imageUri = asset.getImageUri();
-String imageTag = imageUri.substring(imageUri.lastIndexOf(":") + 1);
-
-taskDefinition.addContainer("my-other-container",
- ContainerDefinitionOptions.builder().image(ContainerImage.fromEcrRepository(
- asset.getRepository(), imageTag)).build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using System.IO;
-using Amazon.CDK.{aws}.ECS;
-using Amazon.CDK.{aws}.ECR.Assets;
-
-var asset = new DockerImageAsset(this, "my-image", new DockerImageAssetProps {
- Directory = Path.Combine(Directory.GetCurrentDirectory(), "demo-image")
-});
-
-var taskDefinition = new FargateTaskDefinition(this, "TaskDef", new FargateTaskDefinitionProps
-{
- MemoryLimitMiB = 1024,
- Cpu = 512
-});
-
-taskDefinition.AddContainer("my-other-container", new ContainerDefinitionOptions
-{
- Image = ContainerImage.FromEcrRepository(asset.Repository, asset.ImageUri.Split(":").Last())
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import (
- "os"
- "path"
-
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awsecrassets"
- "github.com/aws/aws-cdk-go/awscdk/v2/awsecs"
-)
-
-dirName, err := os.Getwd()
-if err != nil {
- panic(err)
-}
-
-asset := awsecrassets.NewDockerImageAsset(stack, jsii.String("MyImage"), &awsecrassets.DockerImageAssetProps{
- Directory: jsii.String(path.Join(dirName, "demo-image")),
-})
-
-taskDefinition := awsecs.NewFargateTaskDefinition(stack, jsii.String("TaskDef"), &awsecs.FargateTaskDefinitionProps{
- MemoryLimitMiB: jsii.Number(1024),
- Cpu: jsii.Number(512),
-})
-
-taskDefinition.AddContainer(jsii.String("MyOtherContainer"), &awsecs.ContainerDefinitionOptions{
- Image: awsecs.ContainerImage_FromEcrRepository(asset.Repository(), asset.ImageTag()),
-})
-----
-====
-
-[#assets-types-docker-build]
-=== Build arguments example
-
-You can provide customized build arguments for the Docker build step through the `buildArgs` (Python: `build_args`) property option when the {aws} CDK CLI builds the image during deployment.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const asset = new DockerImageAsset(this, 'MyBuildImage', {
- directory: path.join(__dirname, 'my-image'),
- buildArgs: {
- HTTP_PROXY: 'http://10.20.30.2:1234'
- }
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const asset = new DockerImageAsset(this, 'MyBuildImage', {
- directory: path.join(__dirname, 'my-image'),
- buildArgs: {
- HTTP_PROXY: 'http://10.20.30.2:1234'
- }
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-asset = DockerImageAsset(self, "MyBuildImage",
- directory=os.path.join(dirname, "my-image"),
- build_args=dict(HTTP_PROXY="http://10.20.30.2:1234"))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-DockerImageAsset asset = DockerImageAsset.Builder.create(this, "my-image"),
- .directory(new File(startDir, "my-image").toString())
- .buildArgs(java.util.Map.of( // Java 9 or later
- "HTTP_PROXY", "http://10.20.30.2:1234"))
- .build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var asset = new DockerImageAsset(this, "MyBuildImage", new DockerImageAssetProps {
- Directory = Path.Combine(Directory.GetCurrentDirectory(), "my-image"),
- BuildArgs = new Dictionary
- {
- ["HTTP_PROXY"] = "http://10.20.30.2:1234"
- }
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-dirName, err := os.Getwd()
-if err != nil {
- panic(err)
-}
-
-asset := awsecrassets.NewDockerImageAsset(stack, jsii.String("MyBuildImage"), &awsecrassets.DockerImageAssetProps{
- Directory: jsii.String(path.Join(dirName, "my-image")),
- BuildArgs: &map[string]*string{
- "HTTP_PROXY": jsii.String("http://10.20.30.2:1234"),
- },
-})
-----
-====
-
-[#assets-types-docker-permissions]
-=== Permissions
-
-If you use a module that supports Docker image assets, such as https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs-readme.html[`aws-ecs`], the {aws} CDK manages permissions for you when you use assets directly or through https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ContainerImage.html#static-fromwbrecrwbrrepositoryrepository-tag[`ContainerImage.fromEcrRepository`] (Python: `from_ecr_repository`). If you use Docker image assets directly, make sure that the consuming principal has permissions to pull the image.
-
-In most cases, you should use https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr.Repository.html#grantwbrpullgrantee[`asset.repository.grantPull`] method (Python: `grant_pull`). This modifies the IAM policy of the principal to enable it to pull images from this repository. If the principal that is pulling the image is not in the same account, or if it's an {aws} service that doesn't assume a role in your account (such as {aws} CodeBuild), you must grant pull permissions on the resource policy and not on the principal's policy. Use the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr.Repository.html#addwbrtowbrresourcewbrpolicystatement[`asset.repository.addToResourcePolicy`] method (Python: `add_to_resource_policy`) to grant the appropriate principal permissions.
-
-[#assets-cfn]
-== {aws} CloudFormation resource metadata
-
-[NOTE]
-====
-
-This section is relevant only for construct authors. In certain situations, tools need to know that a certain CFN resource is using a local asset. For example, you can use the {aws} SAM CLI to invoke Lambda functions locally for debugging purposes. See xref:sam[{aws} SAM integration] for details.
-
-====
-
-To enable such use cases, external tools consult a set of metadata entries on {aws} CloudFormation resources:
-
-* `aws:asset:path` – Points to the local path of the asset.
-* `aws:asset:property` – The name of the resource property where the asset is used.
-
-Using these two metadata entries, tools can identify that assets are used by a certain resource, and enable advanced local experiences.
-
-To add these metadata entries to a resource, use the `asset.addResourceMetadata` (Python: `add_resource_metadata`) method.
\ No newline at end of file
diff --git a/v2/guide/attributes.txt b/v2/guide/attributes.txt
deleted file mode 100644
index 39276e28..00000000
--- a/v2/guide/attributes.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-// Entities that differ depending on the AWS Region build such as China
-:arn-aws: pass:q[[.shared]``region.arn``]
-:aws: pass:q[[.shared]``AWS``]
-:aws-management-console: pass:q[[.shared]``consolelong``]
diff --git a/v2/guide/best-practices-security.adoc b/v2/guide/best-practices-security.adoc
deleted file mode 100644
index a17049c5..00000000
--- a/v2/guide/best-practices-security.adoc
+++ /dev/null
@@ -1,133 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[[best-practices-security,best-practices-security.title]]
-= {aws} CDK security best practices
-:info_titleabbrev: Security
-:keywords: {aws} CDK, IAM, security, permissions, infrastructure, {aws} CloudFormation, {aws} CDK deployments
-
-[abstract]
---
-The {aws} Cloud Development Kit ({aws} CDK) is a powerful tool that developers can use to configure {aws} services and provision infrastructure on {aws}. With any tool that provides such control and capabilities, organizations will need to establish policies and practices to ensure that the tool is being used in safe and secure ways. For example, organizations may want to restrict developer access to specific services to ensure that they can't tamper with compliance or cost control measures that are configured in the account.
---
-
-// Content start
-
-The {aws} Cloud Development Kit ({aws} CDK) is a powerful tool that developers can use to configure {aws} services and provision infrastructure on {aws}. With any tool that provides such control and capabilities, organizations will need to establish policies and practices to ensure that the tool is being used in safe and secure ways. For example, organizations may want to restrict developer access to specific services to ensure that they can't tamper with compliance or cost control measures that are configured in the account.
-
-Often, there can be a tension between security and productivity, and each organization needs to establish the proper balance for themselves. This topic provides security best practices for the {aws} CDK that you can consider as you create and implement your own security policies. The following best practices are general guidelines and don`'t represent a complete security solution. Because these best practices might not be appropriate or sufficient for your environment, treat them as helpful considerations rather than prescriptions.
-
-[#best-practices-security-iam]
-== Follow IAM security best practices
-
-{aws} Identity and Access Management (IAM) is a web service that helps you securely control access to {aws} resources. Organizations, individuals, and the {aws} CDK use IAM to manage permissions that determine the actions that can be performed on {aws} resources. When using IAM, follow the IAM security best practices. For more information, see https://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPracticesAndUseCases.html[Security best practices and use cases in {aws} Identity and Access Management] in the _IAM User Guide_.
-
-[#best-practices-security-permissions]
-== Manage permissions for the {aws} CDK
-
-When you use the {aws} CDK across your organization to develop and manage your infrastructure, you'll want to consider the following scenarios where managing permissions will be important:
-
-* *Permissions for {aws} CDK deployments* – These permissions determine who can make changes to your {aws} resources and what changes they can make.
-* *Permissions between resources* – These are the permissions that allow interactions between the {aws} resources that you create and manage with the {aws} CDK.
-
-[#best-practices-security-permissions-deployments]
-=== Manage permissions for {aws} CDK deployments
-
-Developers use the {aws} CDK to define infrastructure locally on their development machines. This infrastructure is implemented in {aws} environments through deployments that typically involve using the {aws} CDK Command Line Interface ({aws} CDK CLI). With deployments, you may want to control what changes developers can make in your environments. For example, you might have an Amazon Virtual Private Cloud (Amazon VPC) resource that you don't want developers to modify.
-
-By default, the CDK CLI uses a combination of the actor's security credentials and IAM roles that are created during bootstrapping to receive permissions for deployments. The actor's security credentials are first used for authentication and IAM roles are then assumed to perform various actions during deployment, such as using the {aws} CloudFormation service to create resources. For more information on how CDK deployments work, including the IAM roles that are used, see xref:deploy[Deploy {aws} CDK applications].
-
-To restrict who can perform deployments and the actions that can be performed during deployment, consider the following:
-
-* The actor's security credentials are the first set of credentials used to authenticate to {aws}. From here, the permissions used to perform actions during deployment are granted to the IAM roles that are assumed during the deployment workflow. You can restrict who can perform deployments by limiting who can assume these roles. You can also restrict the actions that can be performed during deployment by replacing these IAM roles with your own.
-* Permissions for performing deployments are given to the `DeploymentActionRole`. You can control permissions for who can perform deployments by limiting who can assume this role. By using a role for deployments, you can perform cross-account deployments since the role can be assumed by {aws} identities in a different account. By default, all identities in the same {aws} account with the appropriate `AssumeRole` policy statement can assume this role.
-* Permissions for creating and modifying resources through {aws} CloudFormation are given to the `CloudFormationExecutionRole`. This role also requires permission to read from the bootstrap resources. You control the permissions that CDK deployments have by using a managed policy for the `CloudFormationExecutionRole` and optionally by configuring a permissions boundary. By default, this role has `AdministratorAccess` permissions with no permission boundary.
-* Permissions for interacting with bootstrap resources are given to the `FilePublishingRole` and `ImagePublishingRole`. The actor performing deployments must have permission to assume these roles. By default, all identities in the same {aws} account with the appropriate `AssumeRole` policy statement can assume this role.
-* Permissions for accessing bootstrap resources to perform lookups are given to the `LookupRole`. The actor performing deployments must have permission to assume this role. By default, this role has `readOnly` access to the bootstrap resources. By default, all identities in the same {aws} account with the appropriate `AssumeRole` policy statement can assume this role.
-
-To configure the IAM identities in your {aws} account with permission to assume these roles, add a policy with the following policy statement to the identities:
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "Version": "2012-10-17",
- "Statement": [{
- "Sid": "AssumeCDKRoles",
- "Effect": "Allow",
- "Action": "sts:AssumeRole",
- "Resource": "*",
- "Condition": {
- "StringEquals": {
- "iam:ResourceTag/aws-cdk:bootstrap-role": [
- "image-publishing",
- "file-publishing",
- "deploy",
- "lookup"
- ]
- }
- }
- }]
-}
-----
-
-[#best-practices-security-permissions-deployments-roles]
-==== Modify the permissions for the roles assumed during deployment
-
-By modifying permissions for the roles assumed during deployment, you can manage the actions that can be performed during deployment. To modify permissions, you create your own IAM roles and specify them when bootstrapping your environment. When you customize bootstrapping, you will have to customize synthesis. For general instructions, see xref:bootstrapping-customizing[Customize {aws} CDK bootstrapping].
-
-[#best-practices-security-permissions-deployments-creds]
-==== Modify the security credentials and roles used during deployment
-
-The roles and bootstrap resources that are used during deployments are determined by the CDK stack synthesizer that you use. To modify this behavior, you can customize synthesis. For more information, see xref:configure-synth[Configure and perform CDK stack synthesis].
-
-[#best-practices-security-permissions-deployments-least]
-==== Considerations for granting least privilege access
-
-Granting least privilege access is a security best practice that we recommend that you consider as you develop your security strategy. For more information, see link:https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_permissions_least_privileges.html[SEC03-BP02 Grant least privilege access] in the _{aws} Well-Architected Framework Guide_.
-
-Often, granting least privilege access involves restricting IAM policies to the minimum access necessary to perform a given task. Attempting to grant least privilege access through fine-grained permissions with the CDK using this approach can impact CDK deployments and cause you to have to create wider-scoped permissions than you`'d like. The following are a few things to consider when using this approach:
-
-* Determining an exhaustive list of permissions that allow developers to use the {aws} CDK to provision infrastructure through CloudFormation is difficult and complex.
-* If you want to be fine-grained, permissions may become too long to fit within the maximum length of IAM policy documents.
-* Providing an incomplete set of permissions can severely impact developer productivity and deployments.
-
-With the CDK, deployments are performed using CloudFormation. CloudFormation initiates a set of {aws} API calls in order using the permissions that are provided. The permissions necessary at any point in time depends on many factors:
-
-* The {aws} services that are being modified. Specifically, the resources and properties that are being used and changed.
-* The current state of the CloudFormation stack.
-* Issues that may occur during deployments and if rollbacks are needed, which will require `Delete` permissions in addition to `Create`.
-
-When the provided permissions are incomplete, manual intervention will be required. The following are a few examples:
-
-* If you discover incomplete permissions during roll forward, you'll need to pause deployment, and take time to discuss and provision new permissions before continuing.
-* If deployment rolls back and the permissions to apply the roll back are missing, it may leave your CloudFormation stack in a state that will require a lot of manual work to recover from.
-
-Since this approach can result in complications and severely limit developer productivity, we don't recommend it. Instead, we recommend implementing guardrails and preventing bypass.
-
-[#best-practices-security-permissions-deployments-guardrails]
-==== Implementing guardrails and preventing bypass
-
-You can implement guardrails, compliance rules, auditing, and monitoring by using services such as {aws} Control Tower, {aws} Config, {aws} CloudTrail, {aws} Security Hub, and others. With this approach, you grant developers permission to do everything, except tampering with the existing validation mechanisms. Developers have the freedom to implement changes quickly, as long as they stay within policy. This is the approach we recommend when using the {aws} CDK. For more information on guardrails, see https://docs.aws.amazon.com/wellarchitected/latest/management-and-governance-guide/controls.html[Controls] in the _Management and Governance Cloud Environment Guide_.
-
-We also recommend using _permissions boundaries_ or _service control policies (SCPs)_ as a way of implementing guardrails. For more information on implementing permissions boundaries with the {aws} CDK, see xref:customize-permissions-boundaries[Create and apply permissions boundaries for the {aws} CDK].
-
-If you are using any compliance control mechanisms, set them up during the bootstrapping phase. Make sure that the `CloudFormationExecutionRole` or developer-accessible identities have policies or permissions boundaries attached that prevent bypass of the mechanisms that you put in place. The appropriate policies depends on the specific mechanisms that you use.
-
-[#best-practices-security-permissions-resources]
-=== Manage permissions between resources provisioned by the {aws} CDK
-
-How you manage permissions between resources that are provisioned by the {aws} CDK depends on whether you allow the CDK to create roles and policies.
-
-When you use L2 constructs from the {aws} Construct Library to define your infrastructure, you can use the provided `grant` methods to provision permissions between resources. With `grant` methods, you specify the type of access you want between resources and the {aws} CDK provisions least privilege IAM roles to accomplish your intent. This approach meets security requirements for most organizations while being efficient for developers. For more information, see xref:define-iam-l2[Define permissions for L2 constructs with the {aws} CDK].
-
-If you want to work around this feature by replacing the automatically generated roles with manually created ones, consider the following:
-
-* Your IAM roles will need to be manually created, slowing down application development.
-* When IAM roles need to be manually created and managed, people will often combine multiple logical roles into a single role to make them easier to manage. This runs counter to the least privilege principle.
-* Since these roles will need to be created before deployment, the resources that need to be referenced will not yet exist. Therefore, you`'ll need to use wildcards, which runs counter to the least privilege principle.
-* A common workaround to using wildcards is to mandate that all resources be given a predictable name. However, this interferes with CloudFormation`'s ability to replace resources when necessary and may slow down or block development. Because of this, we recommend that you allow CloudFormation to create unique resource names for you.
-* It will be impossible to perform continuous delivery since manual actions must be performed prior to every deployment.
-
-When organizations want to prevent the CDK from creating roles, it is usually to prevent developers from being able to create IAM roles. The concern is that by giving developers permission to create IAM roles using the {aws} CDK, they could possibly elevate their own privileges. To mitigate against this, we recommend using _permission boundaries_ or _service control policies (SCPs)_. With permission boundaries, you can set limits for what developers and the CDK are allowed to do. For more information on using permission boundaries with the CDK, see xref:customize-permissions-boundaries[Create and apply permissions boundaries for the {aws} CDK].
\ No newline at end of file
diff --git a/v2/guide/best-practices.adoc b/v2/guide/best-practices.adoc
deleted file mode 100644
index 0e9d3d9b..00000000
--- a/v2/guide/best-practices.adoc
+++ /dev/null
@@ -1,241 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#best-practices]
-= Best practices for developing and deploying cloud infrastructure with the {aws} CDK
-:info_titleabbrev: Best practices
-
-// Content start
-
-With the {aws} CDK, developers or administrators can define their cloud infrastructure by using a supported programming language. CDK applications should be organized into logical units, such as API, database, and monitoring resources, and optionally have a pipeline for automated deployments. The logical units should be implemented as constructs including the following:
-
-* Infrastructure (such as Amazon S3 buckets, Amazon RDS databases, or an Amazon VPC network)
-* Runtime code (such as {aws} Lambda functions)
-* Configuration code
-
-Stacks define the deployment model of these logical units. For a more detailed introduction to the concepts behind the CDK, see xref:getting-started[Getting started with the {aws} CDK].
-
-The {aws} CDK reflects careful consideration of the needs of our customers and internal teams and of the failure patterns that often arise during the deployment and ongoing maintenance of complex cloud applications. We discovered that failures are often related to "out-of-band" changes to an application that aren't fully tested, such as configuration changes. Therefore, we developed the {aws} CDK around a model in which your entire application is defined in code, not only business logic but also infrastructure and configuration. That way, proposed changes can be carefully reviewed, comprehensively tested in environments resembling production to varying degrees, and fully rolled back if something goes wrong.
-
-image::./images/all-in-one.jpg["Software development lifecycle icons representing infrastructure, application, source code, configuration, and deployment.",scaledwidth=100%]
-
-At deployment time, the {aws} CDK synthesizes a cloud assembly that contains the following:
-
-* {aws} CloudFormation templates that describe your infrastructure in all target environments
-* File assets that contain your runtime code and their supporting files
-
-With the CDK, every commit in your application's main version control branch can represent a complete, consistent, deployable version of your application. Your application can then be deployed automatically whenever a change is made.
-
-The philosophy behind the {aws} CDK leads to our recommended best practices, which we have divided into four broad categories.
-
-* xref:best-practices-organization[Organization best practices]
-* xref:best-practices-code[Coding best practices]
-* xref:best-practices-constructs[Construct best practices]
-* xref:best-practices-apps[Application best practices]
-
-[TIP]
-====
-
-Also consider https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html[best practices for {aws} CloudFormation] and the individual {aws} services that you use, where applicable to CDK-defined infrastructure.
-
-====
-
-[#best-practices-organization]
-== Organization best practices
-
-In the beginning stages of {aws} CDK adoption, it's important to consider how to set up your organization for success. It's a best practice to have a team of experts responsible for training and guiding the rest of the company as they adopt the CDK. The size of this team might vary, from one or two people at a small company to a full-fledged Cloud Center of Excellence (CCoE) at a larger company. This team is responsible for setting standards and policies for cloud infrastructure at your company, and also for training and mentoring developers.
-
-The CCoE might provide guidance on what programming languages should be used for cloud infrastructure. Details will vary from one organization to the next, but a good policy helps make sure that developers can understand and maintain the company's cloud infrastructure.
-
-The CCoE also creates a "landing zone" that defines your organizational units within {aws}. A landing zone is a pre-configured, secure, scalable, multi-account {aws} environment based on best practice blueprints. To tie together the services that make up your landing zone, you can use https://aws.amazon.com/controltower/[{aws} Control Tower], which configures and manages your entire multi-account system from a single user interface.
-
-Development teams should be able to use their own accounts for testing and deploy new resources in these accounts as needed. Individual developers can treat these resources as extensions of their own development workstation. Using xref:cdk-pipeline[CDK Pipelines], the {aws} CDK applications can then be deployed via a CI/CD account to testing, integration, and production environments (each isolated in its own {aws} Region or account). This is done by merging the developers' code into your organization's canonical repository.
-
-image::./images/best-practice-deploy-to-multiple-accounts.png["Diagram showing deployment process from developer accounts to multiple target accounts via CI/CD pipeline.",scaledwidth=100%]
-
-[#best-practices-code]
-== Coding best practices
-
-This section presents best practices for organizing your {aws} CDK code. The following diagram shows the relationship between a team and that team's code repositories, packages, applications, and construct libraries.
-
-image::./images/code-organization.jpg["Diagram showing team's code organization: repository, package, CDK app or construct library.",scaledwidth=100%]
-
-[#best-practices-code-kiss]
-*Start simple and add complexity only when you need it*::
-+
-The guiding principle for most of our best practices is to keep things simple as possible--but no simpler. Add complexity only when your requirements dictate a more complicated solution. With the {aws} CDK, you can refactor your code as necessary to support new requirements. You don't have to architect for all possible scenarios upfront.
-
-[#best-practices-code-well-architected]
-*Align with the {aws} Well-Architected Framework*::
-+
-The https://aws.amazon.com/architecture/well-architected/[{aws} Well-Architected] Framework defines a _component_ as the code, configuration, and {aws} resources that together deliver against a requirement. A component is often the unit of technical ownership, and is decoupled from other components. The term _workload_ is used to identify a set of components that together deliver business value. A workload is usually the level of detail that business and technology leaders communicate about.
-+
-An {aws} CDK application maps to a component as defined by the {aws} Well-Architected Framework. {aws} CDK apps are a mechanism to codify and deliver Well-Architected cloud application best practices. You can also create and share components as reusable code libraries through artifact repositories, such as {aws} CodeArtifact.
-
-[#best-practices-code-package]
-*Every application starts with a single package in a single repository*::
-+
-A single package is the entry point of your {aws} CDK app. Here, you define how and where to deploy the different logical units of your application. You also define the CI/CD pipeline to deploy the application. The app's constructs define the logical units of your solution.
-+
-Use additional packages for constructs that you use in more than one application. (Shared constructs should also have their own lifecycle and testing strategy.) Dependencies between packages in the same repository are managed by your repo's build tooling.
-+
-Although it's possible, we don't recommend putting multiple applications in the same repository, especially when using automated deployment pipelines. Doing this increases the "blast radius" of changes during deployment. When there are multiple applications in a repository, changes to one application trigger deployment of the others (even if the others haven't changed). Furthermore, a break in one application prevents the other applications from being deployed.
-
-[#best-practices-code-repo]
-*Move code into repositories based on code lifecycle or team ownership*::
-+
-When packages begin to be used in multiple applications, move them to their own repository. This way, the packages can be referenced by application build systems that use them, and they can also be updated on cadences independent of the application lifecycles. However, at first it might make sense to put all shared constructs in one repository.
-+
-Also, move packages to their own repository when different teams are working on them. This helps enforce access control.
-+
-To consume packages across repository boundaries, you need a private package repository--similar to NPM, PyPi, or Maven Central, but internal to your organization. You also need a release process that builds, tests, and publishes the package to the private package repository. https://docs.aws.amazon.com/codeartifact/latest/ug/[CodeArtifact] can host packages for most popular programming languages.
-+
-Dependencies on packages in the package repository are managed by your language's package manager, such as NPM for TypeScript or JavaScript applications. Your package manager helps to make sure that builds are repeatable. It does this by recording the specific versions of every package that your application depends on. It also lets you upgrade those dependencies in a controlled manner.
-+
-Shared packages need a different testing strategy. For a single application, it might be good enough to deploy the application to a testing environment and confirm that it still works. But shared packages must be tested independently of the consuming application, as if they were being released to the public. (Your organization might choose to actually release some shared packages to the public.)
-+
-Keep in mind that a construct can be arbitrarily simple or complex. A `Bucket` is a construct, but `CameraShopWebsite` could be a construct, too.
-
-[#best-practices-code-all]
-*Infrastructure and runtime code live in the same package*::
-+
-In addition to generating {aws} CloudFormation templates for deploying infrastructure, the {aws} CDK also bundles runtime assets like Lambda functions and Docker images and deploys them alongside your infrastructure. This makes it possible to combine the code that defines your infrastructure and the code that implements your runtime logic into a single construct. It's a best practice to do this. These two kinds of code don't need to live in separate repositories or even in separate packages.
-+
-To evolve the two kinds of code together, you can use a self-contained construct that completely describes a piece of functionality, including its infrastructure and logic. With a self-contained construct, you can test the two kinds of code in isolation, share and reuse the code across projects, and version all the code in sync.
-
-[#best-practices-constructs]
-== Construct best practices
-
-This section contains best practices for developing constructs. Constructs are reusable, composable modules that encapsulate resources. They're the building blocks of {aws} CDK apps.
-
-[#best-practices-constructs-model]
-*Model with constructs, deploy with stacks*::
-+
-Stacks are the unit of deployment: everything in a stack is deployed together. So when building your application's higher-level logical units from multiple {aws} resources, represent each logical unit as a https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html[Construct], not as a https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html[Stack]. Use stacks only to describe how your constructs should be composed and connected for your various deployment scenarios.
-+
-For example, if one of your logical units is a website, the constructs that make it up (such as an Amazon S3 bucket, API Gateway, Lambda functions, or Amazon RDS tables) should be composed into a single high-level construct. Then that construct should be instantiated in one or more stacks for deployment.
-+
-By using constructs for building and stacks for deploying, you improve reuse potential of your infrastructure and give yourself more flexibility in how it's deployed.
-
-[#best-practices-constructs-config]
-*Configure with properties and methods, not environment variables*::
-+
-Environment variable lookups inside constructs and stacks are a common anti-pattern. Both constructs and stacks should accept a properties object to allow for full configurability completely in code. Doing otherwise introduces a dependency on the machine that the code will run on, which creates yet more configuration information that you have to track and manage.
-+
-In general, environment variable lookups should be limited to the top level of an {aws} CDK app. They should also be used to pass in information that's needed for running in a development environment. For more information, see xref:environments[Environments for the {aws} CDK].
-
-[#best-practices-constructs-test]
-*Unit test your infrastructure*::
-+
-To consistently run a full suite of unit tests at build time in all environments, avoid network lookups during synthesis and model all your production stages in code. (These best practices are covered later.) If any single commit always results in the same generated template, you can trust the unit tests that you write to confirm that the generated templates look the way you expect. For more information, see xref:testing[Test {aws} CDK applications].
-
-[#best-practices-constructs-logicalid]
-*Don't change the logical ID of stateful resources*::
-+
-Changing the logical ID of a resource results in the resource being replaced with a new one at the next deployment. For stateful resources like databases and S3 buckets, or persistent infrastructure like an Amazon VPC, this is seldom what you want. Be careful about any refactoring of your {aws} CDK code that could cause the ID to change. Write unit tests that assert that the logical IDs of your stateful resources remain static. The logical ID is derived from the `id` you specify when you instantiate the construct, and the construct's position in the construct tree. For more information, see xref:identifiers-logical-ids[Logical IDs].
-
-[#best-practices-constructs-compliance]
-*Constructs aren't enough for compliance*::
-+
-Many enterprise customers write their own wrappers for L2 constructs (the "curated" constructs that represent individual {aws} resources with built-in sane defaults and best practices). These wrappers enforce security best practices such as static encryption and specific IAM policies. For example, you might create a `MyCompanyBucket` that you then use in your applications in place of the usual Amazon S3 `Bucket` construct. This pattern is useful for surfacing security guidance early in the software development lifecycle, but don't rely on it as the sole means of enforcement.
-+
-Instead, use {aws} features such as link:https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html[service control policies] and link:https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html[permission boundaries] to enforce your security guardrails at the organization level. Use xref:aspects[Aspects and the {aws} CDK] or tools like https://github.com/aws-cloudformation/cloudformation-guard[CloudFormation Guard] to make assertions about the security properties of infrastructure elements before deployment. Use {aws} CDK for what it does best.
-+
-Finally, keep in mind that writing your own "L2+" constructs might prevent your developers from taking advantage of {aws} CDK packages such as https://docs.aws.amazon.com/solutions/latest/constructs/welcome.html[{aws} Solutions Constructs] or third-party constructs from Construct Hub. These packages are typically built on standard {aws} CDK constructs and won't be able to use your wrapper constructs.
-
-[#best-practices-apps]
-== Application best practices
-
-In this section we discuss how to write your {aws} CDK applications, combining constructs to define how your {aws} resources are connected.
-
-[#best-practices-apps-synth]
-*Make decisions at synthesis time*::
-+
-Although {aws} CloudFormation lets you make decisions at deployment time (using `Conditions`, `{ Fn::If }`, and `Parameters`), and the {aws} CDK gives you some access to these mechanisms, we recommend against using them. The types of values that you can use and the types of operations you can perform on them are limited compared to what's available in a general-purpose programming language.
-+
-Instead, try to make all decisions, such as which construct to instantiate, in your {aws} CDK application by using your programming language's `if` statements and other features. For example, a common CDK idiom, iterating over a list and instantiating a construct with values from each item in the list, simply isn't possible using {aws} CloudFormation expressions.
-+
-Treat {aws} CloudFormation as an implementation detail that the {aws} CDK uses for robust cloud deployments, not as a language target. You're not writing {aws} CloudFormation templates in TypeScript or Python, you're writing CDK code that happens to use CloudFormation for deployment.
-
-[#best-practices-apps-names]
-*Use generated resource names, not physical names*::
-+
-Names are a precious resource. Each name can only be used once. Therefore, if you hardcode a table name or bucket name into your infrastructure and application, you can't deploy that piece of infrastructure twice in the same account. (The name we're talking about here is the name specified by, for example, the `bucketName` property on an Amazon S3 bucket construct.)
-+
-What's worse, you can't make changes to the resource that require it to be replaced. If a property can only be set at resource creation, such as the `KeySchema` of an Amazon DynamoDB table, then that property is immutable. Changing this property requires a new resource. However, the new resource must have the same name in order to be a true replacement. But it can't have the same name while the existing resource is still using that name.
-+
-A better approach is to specify as few names as possible. If you omit resource names, the {aws} CDK will generate them for you in a way that won't cause problems. Suppose you have a table as a resource. You can then pass the generated table name as an environment variable into your {aws} Lambda function. In your {aws} CDK application, you can reference the table name as `table.tableName`. Alternatively, you can generate a configuration file on your Amazon EC2 instance on startup, or write the actual table name to the {aws} Systems Manager Parameter Store so your application can read it from there.
-+
-If the place you need it is another {aws} CDK stack, that's even more straightforward. Supposing that one stack defines the resource and another stack needs to use it, the following applies:
-+
-* If the two stacks are in the same {aws} CDK app, pass a reference between the two stacks. For example, save a reference to the resource's construct as an attribute of the defining stack (`this.stack.uploadBucket = amzn-s3-demo-bucket`). Then, pass that attribute to the constructor of the stack that needs the resource.
-* When the two stacks are in different {aws} CDK apps, use a static `from` method to use an externally defined resource based on its ARN, name, or other attributes. (For example, use `Table.fromArn()` for a DynamoDB table). Use the `CfnOutput` construct to print the ARN or other required value in the output of `cdk deploy`, or look in the {aws} Management Console. Alternatively, the second app can read the CloudFormation template generated by the first app and retrieve that value from the `Outputs` section.
-
-[#best-practices-apps-removal-logs]
-*Define removal policies and log retention*::
-+
-The {aws} CDK attempts to keep you from losing data by defaulting to policies that retain everything you create. For example, the default removal policy on resources that contain data (such as Amazon S3 buckets and database tables) is not to delete the resource when it is removed from the stack. Instead, the resource is orphaned from the stack. Similarly, the CDK's default is to retain all logs forever. In production environments, these defaults can quickly result in the storage of large amounts of data that you don't actually need, and a corresponding {aws} bill.
-+
-Consider carefully what you want these policies to be for each production resource and specify them accordingly. Use xref:aspects[Aspects and the {aws} CDK] to validate the removal and logging policies in your stack.
-
-[#best-practices-apps-separate]
-*Separate your application into multiple stacks as dictated by deployment requirements*::
-+
-There is no hard and fast rule to how many stacks your application needs. You'll usually end up basing the decision on your deployment patterns. Keep in mind the following guidelines:
-+
-* It's typically more straightforward to keep as many resources in the same stack as possible, so keep them together unless you know you want them separated.
-* Consider keeping stateful resources (like databases) in a separate stack from stateless resources. You can then turn on termination protection on the stateful stack. This way, you can freely destroy or create multiple copies of the stateless stack without risk of data loss.
-* Stateful resources are more sensitive to construct renaming--renaming leads to resource replacement. Therefore, don't nest stateful resources inside constructs that are likely to be moved around or renamed (unless the state can be rebuilt if lost, like a cache). This is another good reason to put stateful resources in their own stack.
-
-[#best-practices-apps-context]
-*Commit `cdk.context.json` to avoid non-deterministic behavior*::
-+
-Determinism is key to successful {aws} CDK deployments. An {aws} CDK app should have essentially the same result whenever it is deployed to a given environment.
-+
-Since your {aws} CDK app is written in a general-purpose programming language, it can execute arbitrary code, use arbitrary libraries, and make arbitrary network calls. For example, you could use an {aws} SDK to retrieve some information from your {aws} account while synthesizing your app. Recognize that doing so will result in additional credential setup requirements, increased latency, and a chance, however small, of failure every time you run `cdk synth`.
-+
-Never modify your {aws} account or resources during synthesis. Synthesizing an app should not have side effects. Changes to your infrastructure should happen only in the deployment phase, after the {aws} CloudFormation template has been generated. This way, if there's a problem, {aws} CloudFormation can automatically roll back the change. To make changes that can't be easily made within the {aws} CDK framework, use link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.custom_resources-readme.html[custom resources] to execute arbitrary code at deployment time.
-+
-Even strictly read-only calls are not necessarily safe. Consider what happens if the value returned by a network call changes. What part of your infrastructure will that impact? What will happen to already-deployed resources? Following are two example situations in which a sudden change in values might cause a problem.
-+
---
-* If you provision an Amazon VPC to all available Availability Zones in a specified Region, and the number of AZs is two on deployment day, then your IP space gets split in half. If {aws} launches a new Availability Zone the next day, the next deployment after that tries to split your IP space into thirds, requiring all subnets to be recreated. This probably won't be possible because your Amazon EC2 instances are still running, and you'll have to clean this up manually.
-* If you query for the latest Amazon Linux machine image and deploy an Amazon EC2 instance, and the next day a new image is released, a subsequent deployment picks up the new AMI and replaces all your instances. This might not be what you expected to happen.
---
-+
-These situations can be pernicious because the {aws}-side change might occur after months or years of successful deployments. Suddenly your deployments are failing "for no reason" and you long ago forgot what you did and why.
-+
-Fortunately, the {aws} CDK includes a mechanism called _context providers_ to record a snapshot of non-deterministic values. This allows future synthesis operations to produce exactly the same template as they did when first deployed. The only changes in the new template are the changes that _you_ made in your code. When you use a construct's `.fromLookup()` method, the result of the call is cached in `cdk.context.json`. You should commit this to version control along with the rest of your code to make sure that future executions of your CDK app use the same value. The CDK Toolkit includes commands to manage the context cache, so you can refresh specific entries when you need to. For more information, see xref:context[Context values and the {aws} CDK].
-+
-If you need some value (from {aws} or elsewhere) for which there is no native CDK context provider, we recommend writing a separate script. The script should retrieve the value and write it to a file, then read that file in your CDK app. Run the script only when you want to refresh the stored value, not as part of your regular build process.
-
-[#best-practices-apps-roles]
-*Let the {aws} CDK manage roles and security groups*::
-+
-With the {aws} CDK construct library's `grant()` convenience methods, you can create {aws} Identity and Access Management roles that grant access to one resource by another using minimally scoped permissions. For example, consider a line like the following:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-amzn-s3-demo-bucket.grantRead(myLambda)
-----
-+
-This single line adds a policy to the Lambda function's role (which is also created for you). That role and its policies are more than a dozen lines of CloudFormation that you don't have to write. The {aws} CDK grants only the minimal permissions required for the function to read from the bucket.
-+
-If you require developers to always use predefined roles that were created by a security team, {aws} CDK coding becomes much more complicated. Your teams could lose a lot of flexibility in how they design their applications. A better alternative is to use link:https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html[service control policies] and link:https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html[permission boundaries] to make sure that developers stay within the guardrails.
-
-[#best-practices-apps-stages]
-*Model all production stages in code*::
-+
-In traditional {aws} CloudFormation scenarios, your goal is to produce a single artifact that is parameterized so that it can be deployed to various target environments after applying configuration values specific to those environments. In the CDK, you can, and should, build that configuration into your source code. Create a stack for your production environment, and create a separate stack for each of your other stages. Then, put the configuration values for each stack in the code. Use services like https://aws.amazon.com/secrets-manager/[Secrets Manager] and https://aws.amazon.com/systems-manager/[Systems Manager] Parameter Store for sensitive values that you don't want to check in to source control, using the names or ARNs of those resources.
-+
-When you synthesize your application, the cloud assembly created in the `cdk.out` folder contains a separate template for each environment. Your entire build is deterministic. There are no out-of-band changes to your application, and any given commit always yields the exact same {aws} CloudFormation template and accompanying assets. This makes unit testing much more reliable.
-
-[#best-practices-apps-measure]
-*Measure everything*::
-+
-Achieving the goal of full continuous deployment, with no human intervention, requires a high level of automation. That automation is only possible with extensive amounts of monitoring. To measure all aspects of your deployed resources, create metrics, alarms, and dashboards. Don't stop at measuring things like CPU usage and disk space. Also record your business metrics, and use those measurements to automate deployment decisions like rollbacks. Most of the L2 constructs in {aws} CDK have convenience methods to help you create metrics, such as the `metricUserErrors()` method on the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html[`dynamodb.Table`] class.
-
-
-include::best-practices-security.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/book.adoc b/v2/guide/book.adoc
deleted file mode 100644
index 0ff49eb0..00000000
--- a/v2/guide/book.adoc
+++ /dev/null
@@ -1,76 +0,0 @@
-include::attributes.txt[]
-
-:doctype: book
-:toc: left
-:icons: font
-:experimental:
-:idprefix:
-:idseparator: -
-:info_subtitle: Developer Guide
-:info_edition: 2
-:info_corpauthor: {aws}
-:info_publisher: {aws}
-:keywords: CDK, {aws} CDK, {aws} Cloud Development Kit
-:info_copyright: 2025 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.
-:info_legalnotice: Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon.
-
-[[top]]
-= {aws} Cloud Development Kit ({aws} CDK) v2
-
-[abstract]
---
-Provides a conceptual overview and practical examples to help you understand the features provided by the {aws} CDK and how to use them.
---
-
-[.banner.info]
-This is the {aws} CDK v2 Developer Guide. The older CDK v1 entered maintenance on June 1, 2022 and ended support on June 1, 2023.
-
-include::home.adoc[leveloffset=+1]
-
-include::core-concepts.adoc[leveloffset=+1]
-
-include::prerequisites.adoc[leveloffset=+1]
-
-include::getting-started.adoc[leveloffset=+1]
-
-include::work-with-cdk.adoc[leveloffset=+1]
-
-include::best-practices.adoc[leveloffset=+1]
-
-include::work-with-cdk-v2.adoc[leveloffset=+1]
-
-include::migrate.adoc[leveloffset=+1]
-
-include::configure-access.adoc[leveloffset=+1]
-
-include::configure-env.adoc[leveloffset=+1]
-
-include::bootstrapping-env.adoc[leveloffset=+1]
-
-include::chapter-develop.adoc[leveloffset=+1]
-
-include::configure-synth.adoc[leveloffset=+1]
-
-include::chapter-deploy.adoc[leveloffset=+1]
-
-include::toolkit-library.adoc[leveloffset=+1]
-
-include::testing.adoc[leveloffset=+1]
-
-include::cli.adoc[leveloffset=+1]
-
-include::ref-cli-cmd.adoc[leveloffset=+1]
-
-include::reference.adoc[leveloffset=+1]
-
-include::how-tos.adoc[leveloffset=+1]
-
-include::tools.adoc[leveloffset=+1]
-
-include::security.adoc[leveloffset=+1]
-
-include::troubleshooting.adoc[leveloffset=+1]
-
-include::pgp-keys.adoc[leveloffset=+1]
-
-include::doc-history.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/bootstrapping-customizing.adoc b/v2/guide/bootstrapping-customizing.adoc
deleted file mode 100644
index c5c483b4..00000000
--- a/v2/guide/bootstrapping-customizing.adoc
+++ /dev/null
@@ -1,193 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#bootstrapping-customizing]
-= Customize {aws} CDK bootstrapping
-:info_titleabbrev: Customize bootstrapping
-:keywords: {aws} CDK, {aws} Cloud Development Kit ({aws} CDK), {aws} account, {aws} Region, Bootstrapping, Bootstrap, Environment, Customize
-
-[abstract]
---
-You can customize {aws} Cloud Development Kit ({aws} CDK) bootstrapping by using the {aws} CDK Command Line Interface ({aws} CDK CLI) or by modifying and deploying the {aws} CloudFormation bootstrap template.
---
-
-// Content start
-
-You can customize {aws} Cloud Development Kit ({aws} CDK) bootstrapping by using the {aws} CDK Command Line Interface ({aws} CDK CLI) or by modifying and deploying the {aws} CloudFormation bootstrap template.
-
-For an introduction to bootstrapping, see xref:bootstrapping[{aws} CDK bootstrapping].
-
-[#bootstrapping-customizing-cli]
-== Use the CDK CLI to customize bootstrapping
-
-The following are a few examples of how you can customize bootstrapping by using the CDK CLI. For a list of all `cdk bootstrap` options, see xref:ref-cli-cmd-bootstrap[cdk bootstrap].
-
-[#bootstrapping-customizing-cli-s3-name]
-*Override the name of the Amazon S3 bucket*::
-Use the `--bootstrap-bucket-name` option to override the default Amazon S3 bucket name. This may require that you modify template synthesis. For more information, see xref:bootstrapping-custom-synth[Customize CDK stack synthesis].
-
-[#bootstrapping-customizing-keys]
-*Modify server-side encryption keys for the Amazon S3 bucket*::
-By default, the Amazon S3 bucket in the bootstrap stack is configure to use {aws} managed keys for server-side encryption. To use an existing customer managed key, use the `--bootstrap-kms-key-id` option and provide a value for the {aws} Key Management Service ({aws} KMS) key to use. If you want more control over the encryption key, provide `--bootstrap-customer-key` to use a customer managed key.
-
-[#bootstrapping-customizing-cli-deploy-role]
-*Attach managed policies to the deployment role assumed by {aws} CloudFormation*::
-By default, stacks are deployed with full administrator permissions using the `AdministratorAccess` policy. To use your own managed policies, use the `--cloudformation-execution-policies` option and provide the ARNs of the managed policies to attach to the deployment role.
-+
-To provide multiple policies, pass them a single string, separated by commas:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --cloudformation-execution-policies "arn:aws:iam::aws:policy/AWSLambda_FullAccess,arn:aws:iam::aws:policy/AWSCodeDeployFullAccess"
-----
-+
-To avoid deployment failures, be sure that the policies you specify are sufficient for any deployments that you will perform into the environment being bootstrapped.
-+
-[#bootstrapping-customizing-cli-qualifier]
-*Change the qualifier that is added to the names of resources in your bootstrap stack*::
-By default, the `hnb659fds` qualifier is added to the physical ID of resources in your bootstrap stack. To change this value, use the `--qualifier` option.
-+
-This modification is useful when provisioning multiple bootstrap stacks in the same environment to avoid name clashes.
-+
-Changing the qualifier is intended for name isolation between automated tests of the CDK itself. Unless you can very precisely scope down the IAM permissions given to the CloudFormation execution role, there are no permission isolation benefits to having two different bootstrap stacks in a single account. Therefore, there's usually no need to change this value.
-+
-When you change the qualifier, your CDK app must pass the changed value to the stack synthesizer. For more information, see xref:bootstrapping-custom-synth[Customize CDK stack synthesis].
-+
-[#bootstrapping-customizing-cli-tags]
-*Add tags to the bootstrap stack*::
-Use the `--tags` option in the format of `KEY=VALUE` to add CloudFormation tags to your bootstrap stack.
-+
-[#bootstrapping-customizing-cli-accounts-deploy]
-*Specify additional {aws} accounts that can deploy into the environment being bootstrapped*::
-Use the `--trust` option to provide additional {aws} accounts that are allowed to deploy into the environment being bootstrapped. By default, the account performing the bootstrapping will always be trusted.
-+
-This option is useful when you are bootstrapping an environment that a CDK [.noloc]`Pipeline` from another environment will deploy into.
-+
-When you use this option, you must also provide `--cloudformation-execution-policies`.
-+
-To add trusted accounts to an existing bootstrap stack, you must specify all of the accounts to trust, including those that you may have previously provided. If you only provide new accounts to trust, the previously trusted accounts will be removed.
-+
-The following is an example that trusts two accounts:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap aws://123456789012/us-west-2 --trust 234567890123 --trust 987654321098 --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess
- ⏳ Bootstrapping environment aws://123456789012/us-west-2...
-Trusted accounts for deployment: 234567890123, 987654321098
-Trusted accounts for lookup: (none)
-Execution policies: arn:aws:iam::aws:policy/AdministratorAccess
-CDKToolkit: creating CloudFormation changeset...
- ✅ Environment aws://123456789012/us-west-2 bootstrapped.
-----
-
-[#bootstrapping-customizing-cli-accounts-lookup]
-*Specify additional {aws} accounts that can look up information in the environment being bootstrapped*::
-+
-Use the `--trust-for-lookup` option to specify {aws} accounts that are allowed to look up context information from the environment being bootstrapped. This option is useful to give accounts permission to synthesize stacks that will be deployed into the environment, without actually giving them permission to deploy those stacks directly.
-
-[#bootstrapping-customizing-cli-protection]
-*Enable termination protection for the bootstrap stack*::
-If a bootstrap stack is deleted, the {aws} resources that were originally provisioned in the environment will also be deleted. After your environment is bootstrapped, we recommend that you don't delete and recreate the environment's bootstrap stack, unless you are intentionally doing so. Instead, try to update the bootstrap stack to a new version by running the `cdk bootstrap` command again.
-+
-Use the `--termination-protection` option to manage termination protection settings for the bootstrap stack. By enabling termination protection, you prevent the bootstrap stack and its resources from being accidentally deleted. This is especially important if you use CDK [.noloc]`Pipelines` since there is no general recovery option if you accidentally delete the bootstrap stack.
-+
-After enabling termination protection, you can use the {aws} CLI or {aws} CloudFormation console to verify.
-+
-*To enable termination protection*:::
-+
-. Run the following command to enable termination protection on a new or existing bootstrap stack:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --termination-protection
-----
-+
-. Use the {aws} CLI or CloudFormation console to verify. The following is an example, using the {aws} CLI. If you modified your bootstrap stack name, replace `CDKToolkit` with your stack name:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ aws cloudformation describe-stacks --stack-name --query "Stacks[0].EnableTerminationProtection"
-true
-----
-
-[#bootstrapping-customizing-template]
-== Modify the default bootstrap template
-
-When you need more customization than the CDK CLI can provide, you can modify the bootstrap template as needed. Then, deploy the template to bootstrap your environment.
-
-*To modify and deploy the default bootstrap template*::
-+
-. Obtain the default bootstrap template using the `--show-template` option. By default, the CDK CLI will output the template in your terminal window. You can modify the CDK CLI command to save the template to your local machine. The following is an example:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --show-template >
-----
-. Modify the bootstrap template as needed. Any changes that you make should adhere to the bootstrapping template contract. For more information on the bootstrapping template contract, see xref:bootstrapping-contract[Follow the bootstrap contract].
-+
-To ensure that your customizations are not accidentally overwritten later by someone running `cdk bootstrap` using the default template, change the default value of the `BootstrapVariant` template parameter. The CDK CLI will only allow overwriting the bootstrap stack with templates that have the same `BootstrapVariant` and an equal or higher version than the template that is currently deployed.
-+
-. Deploy your modified template using your preferred {aws} CloudFormation deployment method. The following is an example that uses the CDK CLI:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --template
-----
-
-[#bootstrapping-contract]
-== Follow the bootstrap contract
-
-For your CDK apps to properly deploy, the CloudFormation templates produced during synthesis must correctly specify the resources created during bootstrapping. These resources are commonly referred to as _bootstrap resources_. Bootstrapping creates resources in your {aws} environment that are used by the {aws} CDK to perform deployments and manage application assets. Synthesis produces CloudFormation templates from each CDK stack in your application. These templates don't just define the {aws} resources that will be provisioned from your application. They also specify the bootstrap resources to use during deployment.
-
-During synthesis, the CDK CLI doesn't know specifically how your {aws} environment has been bootstrapped. Instead, the CDK CLI produces CloudFormation templates based on the synthesizer that you configure. Therefore, when you customize bootstrapping, you may need to customize synthesis. For instructions on customizing synthesis, see xref:bootstrapping-custom-synth[Customize CDK stack synthesis]. The purpose is to ensure that your synthesized CloudFormation templates are compatible with your bootstrapped environment. This compatibility is referred to as the _bootstrap contract_.
-
-The simplest method to customize stack synthesis is by modifying the `DefaultStackSynthesizer` class in your `Stack` instance. If you require customization beyond what this class can offer, you can write your own synthesizer as a class that implements `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IStackSynthesizer.html[IStackSynthesizer]` (perhaps deriving from `DefaultStackSynthesizer`).
-
-When you customize bootstrapping, follow the bootstrap template contract to remain compatible with `DefaultStackSynthesizer`. If you modify bootstrapping beyond the bootstrap template contract, you will need to write your own synthesizer.
-
-[#bootstrapping-contract-versioning]
-=== Versioning
-
-The bootstrap template should contain a resource to create an Amazon EC2 Systems Manager (SSM) parameter with a well-known name and an output to reflect the template's version:
-
-[source,yaml,subs="verbatim,attributes"]
-----
-Resources:
- CdkBootstrapVersion:
- Type: {aws}::SSM::Parameter
- Properties:
- Type: String
- Name:
- Fn::Sub: '/cdk-bootstrap/${Qualifier}/version'
- Value: 4
-Outputs:
- BootstrapVersion:
- Value:
- Fn::GetAtt: [CdkBootstrapVersion, Value]
-----
-
-[#bootstrapping-contract-roles]
-=== Roles
-
-The `DefaultStackSynthesizer` requires five IAM roles for five different purposes. If you are not using the default roles, you must specify your IAM role ARNs within your `DefaultStackSynthesizer` object. The roles are as follows:
-
-* The _deployment role_ is assumed by the CDK CLI and by {aws} CodePipeline to deploy into an environment. Its `AssumeRolePolicy` controls who can deploy into the environment. In the template, you can see the permissions that this role needs.
-* The _lookup role_ is assumed by the CDK CLI to perform context lookups in an environment. Its `AssumeRolePolicy` controls who can deploy into the environment. The permissions this role needs can be seen in the template.
-* The _file publishing role_ and the _image publishing role_ are assumed by the CDK CLI and by {aws} CodeBuild projects to publish assets into an environment. They're used to write to the Amazon S3 bucket and the Amazon ECR repository, respectively. These roles require write access to these resources.
-* _The {aws} CloudFormation execution role_ is passed to {aws} CloudFormation to perform the actual deployment. Its permissions are the permissions that the deployment will execute under. The permissions are passed to the stack as a parameter that lists managed policy ARNs.
-
-[#bootstrapping-contract-outputs]
-=== Outputs
-
-The CDK CLI requires that the following CloudFormation outputs exist on the bootstrap stack:
-
-* `BucketName` – The name of the file asset bucket.
-* `BucketDomainName` – The file asset bucket in domain name format.
-* `BootstrapVersion` – The current version of the bootstrap stack.
-
-[#bootstrapping-contract-history]
-=== Template history
-
-The bootstrap template is versioned and evolves over time with the {aws} CDK itself. If you provide your own bootstrap template, keep it up to date with the canonical default template. You want to make sure that your template continues to work with all CDK features. For more information, see xref:bootstrap-template-history[Bootstrap template version history].
\ No newline at end of file
diff --git a/v2/guide/bootstrapping-env.adoc b/v2/guide/bootstrapping-env.adoc
deleted file mode 100644
index 7e4badb3..00000000
--- a/v2/guide/bootstrapping-env.adoc
+++ /dev/null
@@ -1,610 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#bootstrapping-env]
-= Bootstrap your environment for use with the {aws} CDK
-:info_titleabbrev: Bootstrap your environment
-:keywords: {aws} CDK, {aws} Cloud Development Kit ({aws} CDK), {aws} account, {aws} Region, Bootstrapping, Bootstrap, Environment
-
-[abstract]
---
-Bootstrap your {aws} environment before using the {aws} Cloud Development Kit ({aws} CDK) to deploy CDK stacks into your environment.
---
-
-// Content start
-
-Bootstrap your {aws} environment to prepare it for {aws} Cloud Development Kit ({aws} CDK) stack deployments.
-
-* For an introduction to environments, see xref:environments[Environments for the {aws} CDK].
-* For an introduction to bootstrapping, see xref:bootstrapping[{aws} CDK bootstrapping].
-
-[#bootstrapping-howto]
-== How to bootstrap your environment
-
-You can use the {aws} CDK Command Line Interface ({aws} CDK CLI) or your preferred {aws} CloudFormation deployment tool to bootstrap your environment.
-
-[#bootstrapping-howto-cli]
-*Use the CDK CLI*::
-+
-You can use the CDK CLI `cdk bootstrap` command to bootstrap your environment. This is the method that we recommend if you don't require significant modifications to bootstrapping.
-+
-*Bootstrap from any working directory*:::
-+
-To bootstrap from any working directory, provide the environment to bootstrap as a command line argument. The following is an example:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk bootstrap
-----
-+
-[TIP]
---
-If you don't have your {aws} account number, you can get it from the {aws} Management Console. You can also use the following {aws} CLI command to display your default account information, including your account number:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ aws sts get-caller-identity
-----
-
-If you have named profiles in your {aws} `config` and `credentials` files, use the `--profile` option to retrieve account information for a specific profile. The following is an example:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ aws sts get-caller-identity --profile
-----
-
-To display the default Region, use the `aws configure get` command:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ aws configure get region
-$ aws configure get region --profile
-----
---
-+
-
-When providing an argument, the `aws://` prefix is optional. The following is valid:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap <123456789012/us-east-1>
-----
-+
-To bootstrap multiple environments at the same time, provide multiple arguments:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap
-----
-
-*Bootstrap from the parent directory of a CDK project*:::
-+
-You can run `cdk bootstrap` from the parent directory of a CDK project containing a `cdk.json` file. If you don`'t provide an environment as an argument, the CDK CLI will obtain environment information from default sources, such as your `config` and `credentials` files or any environment information specified for your CDK stack.
-+
-When you bootstrap from the parent directory of a CDK project, environments provided from command line arguments take precedence over other sources.
-+
-To bootstrap an environment that is specified in your `config` and `credentials` files, use the `--profile` option:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --profile
-----
-+
-
-For more information on the `cdk bootstrap` command and supported options, see xref:ref-cli-cmd-bootstrap[cdk bootstrap].
-
-[#bootstrapping-howto-cfn]
-*Use any {aws} CloudFormation tool*::
-+
-You can copy the https://github.com/aws/aws-cdk-cli/blob/main/packages/aws-cdk/lib/api/bootstrap/bootstrap-template.yaml[bootstrap template] from the _aws-cdk-cli GitHub repository_ or obtain the template with the `cdk bootstrap --show-template` command. Then, use any {aws} CloudFormation tool to deploy the template into your environment.
-+
-With this method, you can use {aws} CloudFormation StackSets or {aws} Control Tower. You can also use the {aws} CloudFormation console or the {aws} Command Line Interface ({aws} CLI). You can make modifications to your template before you deploy it. This method may be more flexible and suitable for large-scale deployments.
-+
-The following is an example of using the `--show-template` option to retrieve and save the bootstrap template to your local machine:
-+
-====
-[role="tablist"]
-macOS/Linux::
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --show-template > bootstrap-template.yaml
-----
-
-Windows::
-On Windows, PowerShell must be used to preserve the encoding of the template.
-+
-[source,none,subs="verbatim,attributes"]
-----
-powershell "cdk bootstrap --show-template | Out-File -encoding utf8 bootstrap-template.yaml"
-----
-====
-+
-
-[NOTE]
-====
-
-If CDK notices are appearing in your {aws} CloudFormation template output, provide the `--no-notices` option with your command.
-
-====
-+
-To deploy this template using the CDK CLI, you can run the following:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --template
-----
-+
-The following is an example of using the {aws} CLI to deploy the template:
-+
-====
-[role="tablist"]
-macOS/Linux::
-+
-[source,none,subs="verbatim,attributes"]
-----
-aws cloudformation create-stack \
- --stack-name CDKToolkit \
- --template-body file:// bootstrap-template.yaml \
- --capabilities CAPABILITY_NAMED_IAM \
- --region
-----
-
-Windows::
-+
-[source,none,subs="verbatim,attributes"]
-----
-aws cloudformation create-stack ^
- --stack-name CDKToolkit ^
- --template-body file:// bootstrap-template.yaml ^
- --capabilities CAPABILITY_NAMED_IAM ^
- --region
-----
-====
-+
-
-For information on using CloudFormation StackSets to bootstrap multiple environments, see https://aws.amazon.com/blogs/mt/bootstrapping-multiple-aws-accounts-for-aws-cdk-using-cloudformation-stacksets/[Bootstrapping multiple {aws} accounts for {aws} CDK using CloudFormation StackSets] in the __{aws} Cloud Operations & Migrations Blog__.
-
-[#bootstrapping-env-when]
-== When to bootstrap your environment
-
-You must bootstrap each {aws} environment before you deploy into the environment. We recommend that you proactively bootstrap each environment that you plan to use. You can do this before you plan on actually deploying CDK apps into the environment. By proactively bootstrapping your environments, you prevent potential future issues such as Amazon S3 bucket name conflicts or deploying CDK apps into environments that haven't been bootstrapped.
-
-It's okay to bootstrap an environment more than once. If an environment has already been bootstrapped, the bootstrap stack will be upgraded if necessary. Otherwise, nothing will happen.
-
-If you attempt to deploy a CDK stack into an environment that hasn`'t been bootstrapped, you will see an error like the following:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy
-
-✨ Synthesis time: 2.02s
-
- ❌ Deployment failed: Error: BootstrapExampleStack: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
-----
-
-
-[#bootstrapping-env-when-update]
-*Update your bootstrap stack*::
-+
-Periodically, the CDK team will update the bootstrap template to a new version. When this happens, we recommend that you update your bootstrap stack. If you haven`'t customized the bootstrapping process, you can update your bootstrap stack by following the same steps that you took to originally bootstrap your environment. For more information, see xref:bootstrap-template-history[Bootstrap template version history].
-
-[#bootstrapping-env-default]
-== Default resources created during bootstrapping
-
-[#bootstrapping-env-roles]
-*IAM roles created during bootstrapping*::
-+
-By default, bootstrapping provisions the following {aws} Identity and Access Management (IAM) roles in your environment:
-+
---
-* `CloudFormationExecutionRole`
-* `DeploymentActionRole`
-* `FilePublishingRole`
-* `ImagePublishingRole`
-* `LookupRole`
---
-+
-[#bootstrapping-env-roles-cfn]
-`CloudFormationExecutionRole`:::
-+
-This IAM role is a CloudFormation service role that grants CloudFormation permission to perform stack deployments on your behalf. This role gives CloudFormation permission to perform {aws} API calls in your account, including deploying stacks.
-+
-By using a service role, the permissions provisioned for the service role determine what actions can be performed on your CloudFormation resources. Without this service role, the security credentials you provide with the CDK CLI would determine what CloudFormation is allowed to do.
-+
-[#bootstrapping-env-roles-deploy]
-`DeploymentActionRole`:::
-+
-This IAM role grants permission to perform deployments into your environment. It is assumed by the CDK CLI during deployments.
-+
-By using a role for deployments, you can perform cross-account deployments since the role can be assumed by {aws} identities in a different account.
-+
-[#bootstrapping-env-roles-s3]
-`FilePublishingRole`:::
-+
-This IAM role grants permission to perform actions against the bootstrapped Amazon Simple Storage Service (Amazon S3) bucket, including uploading and deleting assets. It is assumed by the CDK CLI during deployments.
-+
-[#bootstrapping-env-roles-ecr]
-`ImagePublishingRole`:::
-+
-This IAM role grants permission to perform actions against the bootstrapped Amazon Elastic Container Registry (Amazon ECR) repository. It is assumed by the CDK CLI during deployments.
-+
-[#bootstrapping-env-roles-lookup]
-`LookupRole`:::
-+
-This IAM role grants `readOnly` permission to look up xref:context[context values] from the {aws} environment. It is assumed by the CDK CLI when performing tasks such as template synthesis and deployments.
-
-[#bootstrapping-env-default-id]
-*Resource IDs created during bootstrapping*::
-+
-When you deploy the default bootstrap template, physical IDs for bootstrap resources are created using the following structure: `cdk----`.
-+
---
-* *Qualifier* – A nine character unique string value of `hnb659fds`. The actual value has no significance.
-* *Description* – A short description of the resource. For example, `container-assets`.
-* *Account ID* – The {aws} account ID of the environment.
-* *Region* – The {aws} Region of the environment.
---
-+
-The following is an example physical ID of the Amazon S3 staging bucket created during bootstrapping: `cdk-hnb659fds-assets-012345678910-us-west-1`.
-
-[#bootstrapping-env-permissions]
-== Permissions to use when bootstrapping your environment
-
-When bootstrapping an {aws} environment, the IAM identity performing the bootstrapping must have at least the following permissions:
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "Version": "2012-10-17",
- "Statement": [
- {
- "Effect": "Allow",
- "Action": [
- "cloudformation:*",
- "ecr:*",
- "ssm:*",
- "s3:*",
- "iam:*"
- ],
- "Resource": "*"
- }
- ]
-}
-----
-
-Over time, the bootstrap stack, including the resources that are created and permissions they require, may change. With future changes, you may need to modify the permissions required to bootstrap an environment.
-
-[#bootstrapping-env-customize]
-== Customize bootstrapping
-
-If the default bootstrap template doesn`'t suit your needs, you can customize the bootstrapping of resources into your environment in the following ways:
-
-* Use command line options with the `cdk bootstrap` command – This method is best for making small, specific changes that are supported through command line options.
-* Modify the default bootstrap template and deploy it – This method is best for making complex changes or if you want complete control over the configuration of resources provisioned during bootstrapping.
-
-For more information on customizing bootstrapping, see xref:bootstrapping-customizing[Customize {aws} CDK bootstrapping].
-
-[#bootstrapping-env-pipelines]
-== Bootstrapping with CDK Pipelines
-
-If you are using CDK Pipelines to deploy into another account's environment, and you receive a message like the following:
-
-[source,none,subs="verbatim,attributes"]
-----
-Policy contains a statement with one or more invalid principals
-----
-
-This error message means that the appropriate IAM roles do not exist in the other environment. The most likely cause is that the environment has not been bootstrapped. Bootstrap the environment and try again.
-
-[#bootstrapping-env-pipelines-protect]
-*Protecting your bootstrap stack from deletion*::
-+
-If a bootstrap stack is deleted, the {aws} resources that were originally provisioned in the environment to support CDK deployments will also be deleted. This will cause the pipeline to stop working. If this happens, there is no general solution for recovery.
-+
-After your environment is bootstrapped, do not delete and recreate the environment's bootstrap stack. Instead, try to update the bootstrap stack to a new version by running the `cdk bootstrap` command again.
-+
-To protect against accidental deletion of your bootstrap stack, we recommend that you provide the `--termination-protection` option with the `cdk bootstrap` command to enable termination protection. You can enable termination protection on new or existing bootstrap stacks. For instructions on enabling termination protection, see xref:bootstrapping-customizing-cli-protection[Enable termination protection for the bootstrap stack].
-
-[#bootstrap-template-history]
-== Bootstrap template version history
-
-The bootstrap template is versioned and evolves over time with the {aws} CDK itself. If you provide your own bootstrap template, keep it up to date with the canonical default template. You want to make sure that your template continues to work with all CDK features.
-
-[NOTE]
-====
-
-Earlier versions of the bootstrap template created an {aws} KMS key in each bootstrapped environment by default. To avoid charges for the KMS key, re-bootstrap these environments using `--no-bootstrap-customer-key`. The current default is no KMS key, which helps avoid these charges.
-
-====
-
-This section contains a list of the changes made in each version.
-
-[cols="1,1,1", options="header"]
-|===
-| Template version
-| {aws} CDK version
-| Changes
-
-|**1**
-|1.40.0
-|Initial version of template with Bucket, Key, Repository, and Roles.
-
-|**2**
-|1.45.0
-|Split asset publishing role into separate file and image publishing roles.
-
-|**3**
-|1.46.0
-|Add `FileAssetKeyArn` export to be able to add decrypt permissions to asset consumers.
-
-|**4**
-|1.61.0
-|{aws} KMS permissions are now implicit via Amazon S3 and no longer require `FileAssetKeyArn`. Add `CdkBootstrapVersion` SSM parameter so the bootstrap stack version can be verified without knowing the stack name.
-
-|**5**
-|1.87.0
-|Deployment role can read SSM parameter.
-
-|**6**
-|1.108.0
-|Add lookup role separate from deployment role.
-
-|**6**
-|1.109.0
-|Attach `aws-cdk:bootstrap-role` tag to deployment, file publishing, and image publishing roles.
-
-|**7**
-|1.110.0
-|Deployment role can no longer read Buckets in the target account directly. (However, this role is effectively an administrator, and could always use its {aws} CloudFormation permissions to make the bucket readable anyway).
-
-|**8**
-|1.114.0
-|The lookup role has full read-only permissions to the target environment, and has a `aws-cdk:bootstrap-role` tag as well.
-
-|**9**
-|2.1.0
-|Fixes Amazon S3 asset uploads from being rejected by commonly referenced encryption SCP.
-
-|**10**
-|2.4.0
-|Amazon ECR ScanOnPush is now enabled by default.
-
-|**11**
-|2.18.0
-|Adds policy allowing Lambda to pull from Amazon ECR repos so it survives re-bootstrapping.
-
-|**12**
-|2.20.0
-|Adds support for experimental `cdk import`.
-
-|**13**
-|2.25.0
-|Makes container images in bootstrap-created Amazon ECR repositories immutable.
-
-|**14**
-|2.34.0
-|Turns off Amazon ECR image scanning at the repository level by default to allow bootstrapping Regions that do not support image scanning.
-
-|**15**
-|2.60.0
-|KMS keys cannot be tagged.
-
-|**16**
-|2.69.0
-|Addresses Security Hub finding link:https://docs.aws.amazon.com/securityhub/latest/userguide/kms-controls.html#kms-2[KMS.2].
-
-|**17**
-|2.72.0
-|Addresses Security Hub finding link:https://docs.aws.amazon.com/securityhub/latest/userguide/ecr-controls.html#ecr-3[ECR.3].
-
-|**18**
-|2.80.0
-|Reverted changes made for version 16 as they don't work in all partitions and are are not recommended.
-
-|**19**
-|2.106.1
-|Reverted changes made to version 18 where AccessControl property was removed from the template. (https://github.com/aws/aws-cdk/issues/27964[#27964])
-
-|**20**
-|2.119.0
-|Add `ssm:GetParameters` action to the {aws} CloudFormation deploy IAM role. For more information, see link:https://github.com/aws/aws-cdk/pull/28336/files#diff-4fdac38426c4747aa17d515b01af4994d3d2f12c34f7b6655f24328259beb7bf[#28336].
-
-|**21**
-|2.149.0
-|Add condition to the file publishing role.
-
-|**22**
-|2.160.0
-|Add `sts:TagSession` permissions to the trust policy of bootstrap IAM roles.
-
-|**23**
-|2.161.0
-|Add `cloudformation:RollbackStack` and `cloudformation:ContinueUpdateRollback` permissions to the trust policy of the deploy IAM role. This provides permissions for the `cdk rollback` command.
-
-|**24**
-|2.165.0
-|Change the duration of days that noncurrent objects in the bootstrap bucket will be retained, from 365 to 30 days. Since the new `cdk gc` command introduces the ability to delete objects in the bootstrap bucket, this new behavior ensures that deleted objects remain in the bootstrap bucket for 30 days instead of 365 days. For more information on this change, see `aws-cdk` PR https://github.com/aws/aws-cdk/pull/31949[#31949].
-
-|**25**
-|2.165.0
-|Add support to the bootstrap bucket for the removal of incomplete multipart uploads. Incomplete multipart uploads will be deleted after 1 day. For more information on this change, see `aws-cdk` PR https://github.com/aws/aws-cdk/pull/31956[#31956].
-
-|**26**
-|2.1002.0
-|Add two deletion-related policies (`UpdateReplacePolicy` and `DeletionPolicy` to the `FileAssetsBucketEncryptionKey`) resource. These policies ensure that the old {aws} KMS key resource will be properly deleted when the bootstrap stack is updated or deleted. For more information on this change, see `aws-cdk-cli` PR https://github.com/aws/aws-cdk-cli/pull/100[#100].
-
-|**27**
-|2.1003.0
-|Add new Amazon ECR resource policy to grant Amazon EMR Serverless specific permissions for retrieving container images. For more information on this change, see `aws-cdk-cli` PR https://github.com/aws/aws-cdk-cli/pull/112[#112].
-|===
-
-[#bootstrapping-template]
-== Upgrade from legacy to modern bootstrap template
-
-The {aws} CDK v1 supported two bootstrapping templates, legacy and modern. CDK v2 supports only the modern template. For reference, here are the high-level differences between these two templates.
-
-[cols="1h,1,1", options="header"]
-|===
-| Feature
-| Legacy (v1 only)
-| Modern (v1 and v2)
-
-
-|Cross-account deployments
-|Not allowed
-|Allowed
-
-|{aws} CloudFormation Permissions
-|Deploys using current user's permissions (determined by {aws} profile, environment variables, etc.)
-|Deploys using the permissions specified when the bootstrap stack was provisioned (for example, by using `--trust`)
-
-|Versioning
-|Only one version of bootstrap stack is available
-|Bootstrap stack is versioned; new resources can be added in future versions, and {aws} CDK apps can require a minimum version
-
-|Resources*
-|Amazon S3 bucket
-a|
-
-* Amazon S3 bucket
-* {aws} KMS key
-* IAM roles
-* Amazon ECR repository
-* SSM parameter for versioning
-
-|{aws} KMS key
-|IAM roles
-|Amazon ECR repository
-
-//|SSM parameter for versioning
-
-|Resource naming
-|Automatically generated
-|Deterministic
-
-|Bucket encryption
-|Default key
-|{aws} managed key by default. You can customize to use a customer managed key.
-|===
-
-* _We will add additional resources to the bootstrap template as needed._
-
-An environment that was bootstrapped using the legacy template must be upgraded to use the modern template for CDK v2 by re-bootstrapping. Re-deploy all {aws} CDK applications in the environment at least once before deleting the legacy bucket.
-
-[#bootstrapping-securityhub]
-== Address Security Hub Findings
-
-If you are using {aws} Security Hub, you may see findings reported on some of the resources created by the {aws} CDK bootstrapping process. Security Hub findings help you find resource configurations you should double-check for accuracy and safety. We have reviewed these specific resource configurations with {aws} Security and are confident they do not constitute a security problem.
-
-[#bootstrapping-securityhub-kms2]
-*[KMS.2] IAM principals should not have IAM inline policies that allow decryption actions on all KMS keys*::
-+
-The _deploy role_ (`DeploymentActionRole`) grants permission to read encrypted data, which is necessary for cross-account deployments with CDK Pipelines. Policies in this role do not grant permission to all data. It only grants permission to read encrypted data from Amazon S3 and {aws} KMS, and only when those resources allow it through their bucket or key policy.
-+
-The following is a snippet of these two statements in the _deploy role_ from the bootstrap template:
-+
-[source,yaml,subs="verbatim,attributes"]
-----
-DeploymentActionRole:
- Type: {aws}::IAM::Role
- Properties:
- ...
- Policies:
- - PolicyDocument:
- Statement:
- ...
- - Sid: PipelineCrossAccountArtifactsBucket
- Effect: Allow
- Action:
- - s3:GetObject*
- - s3:GetBucket*
- - s3:List*
- - s3:Abort*
- - s3:DeleteObject*
- - s3:PutObject*
- Resource: "*"
- Condition:
- StringNotEquals:
- s3:ResourceAccount:
- Ref: {aws}::AccountId
- - Sid: PipelineCrossAccountArtifactsKey
- Effect: Allow
- Action:
- - kms:Decrypt
- - kms:DescribeKey
- - kms:Encrypt
- - kms:ReEncrypt*
- - kms:GenerateDataKey*
- Resource: "*"
- Condition:
- StringEquals:
- kms:ViaService:
- Fn::Sub: s3.${{aws}::Region}.amazonaws.com
- ...
-----
-+
-[#bootstrapping-securityhub-kms2-why]
-*Why does Security Hub flag this?*:::
-+
-The policies contain a `Resource: \*` combined with a `Condition` clause. Security Hub flags the `*` wildcard. This wildcard is used because at the time the account is bootstrapped, the {aws} KMS key created by CDK Pipelines for the CodePipeline artifact bucket does not exist yet, and therefore, can`'t be referenced on the bootstrap template by ARN. In addition, Security Hub does not consider the `Condition` clause when raising this flag. This `Condition` restricts `Resource: *` to requests made from the same {aws} account of the {aws} KMS key. These requests must come from Amazon S3 in the same {aws} Region as the {aws} KMS key.
-+
-[#bootstrapping-securityhub-kms2-decide]
-*Do I need to fix this finding?*:::
-+
-As long as you have not modified the {aws} KMS key on your bootstrap template to be overly permissive, the _deploy role_ does not allow more access than it needs. Therefore, it is not necessary to fix this finding.
-+
-[#bootstrapping-securityhub-kms2-fix]
-*What if I want to fix this finding?*:::
-+
-How you fix this finding depends on whether or not you will be using CDK Pipelines for cross-account deployments.
-+
-*To fix the Security Hub finding and use CDK Pipelines for cross-account deployments*::::
-+
-. If you have not done so, deploy the CDK bootstrap stack using the `cdk bootstrap` command.
-. If you have not done so, create and deploy your CDK [.noloc]``Pipeline``. For instructions, see xref:cdk-pipeline[Continuous integration and delivery (CI/CD) using CDK Pipelines].
-. Obtain the {aws} KMS key ARN of the CodePipeline artifact bucket. This resource is created during pipeline creation.
-. Obtain a copy of the CDK bootstrap template to modify it. The following is an example, using the {aws} CDK CLI:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --show-template > bootstrap-template.yaml
-----
-. Modify the template by replacing `Resource: *` of the `PipelineCrossAccountArtifactsKey` statement with your ARN value.
-. Deploy the template to update your bootstrap stack. The following is an example, using the CDK CLI:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk bootstrap aws:/// --template bootstrap-template.yaml
-----
-+
-
-*To fix the Security Hub finding if you’re not using CDK Pipelines for cross-account deployments*::::
-+
-. Obtain a copy of the CDK bootstrap template to modify it. The following is an example, using the CDK CLI:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --show-template > bootstrap-template.yaml
-----
-. Delete the `PipelineCrossAccountArtifactsBucket` and `PipelineCrossAccountArtifactsKey` statements from the template.
-. Deploy the template to update your bootstrap stack. The following is an example, using the CDK CLI:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk bootstrap aws:/// --template bootstrap-template.yaml
-----
-
-[#bootstrapping-env-considerations]
-== Considerations
-
-Since bootstrapping provisions resources in your environment, you may incur {aws} charges when those resources are used with the {aws} CDK.
-
-include::bootstrapping-customizing.adoc[leveloffset=+1]
-
-
-include::customize-permissions-boundaries.adoc[leveloffset=+1]
-
-
-include::bootstrapping-troubleshoot.adoc[leveloffset=+1]
diff --git a/v2/guide/bootstrapping-troubleshoot.adoc b/v2/guide/bootstrapping-troubleshoot.adoc
deleted file mode 100644
index 84dfd1fb..00000000
--- a/v2/guide/bootstrapping-troubleshoot.adoc
+++ /dev/null
@@ -1,271 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#bootstrapping-troubleshoot]
-= Troubleshoot {aws} CDK bootstrapping issues
-:info_titleabbrev: Troubleshoot bootstrapping
-:keywords: {aws} CDK, Bootstrapping, Troubleshoot
-
-[abstract]
---
-Troubleshoot common issues when bootstrapping your environment with the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-
-Troubleshoot common issues when bootstrapping your environment with the {aws} Cloud Development Kit ({aws} CDK).
-
-* For an introduction to bootstrapping, see xref:bootstrapping[{aws} CDK bootstrapping].
-* For instructions on bootstrapping, see xref:bootstrapping-env[Bootstrap your environment for use with the {aws} CDK].
-
-[#bootstrapping-troubleshoot-s3-bucket-name]
-== When bootstrapping using the default template, you get a 'CREATE_FAILED' error for the Amazon S3 bucket
-
-When bootstrapping using the {aws} CDK Command Line Interface (CDK CLI) `cdk bootstrap` command with the default bootstrap template, you receive the following error:
-
-[source,none,subs="verbatim,attributes"]
-----
-CREATE_FAILED | {aws}::S3::Bucket | already exists
-----
-
-Before troubleshooting, ensure that you are using the latest version of the CDK CLI.
-
-* To check your version, run `cdk --version`.
-* To install the latest version, run `npm install -g aws-cdk`.
-
-After installing the latest version, try bootstrapping your environment again. If you still receive the same error, continue with troubleshooting.
-
-[#bootstrapping-troubleshoot-s3-bucket-name-causes]
-=== Common causes
-
-When you bootstrap your environment, the {aws} CDK generates physical IDs for your bootstrap resources. For more information, see xref:bootstrapping-env-default-id[Resource IDs created during bootstrapping].
-
-Unlike the other bootstrap resources, Amazon S3 bucket names are global. This means that each bucket name must be unique across all {aws} accounts in all {aws} Regions within a partition. For more information, see https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingBucket.html[Buckets overview] in the _Amazon S3 User Guide_. Therefore, the most common cause of this error is that the physical ID generated as your bucket name already exists somewhere within the partition. This could be within your account or another account.
-
-The following is an example bucket name: `cdk-hnb659fds-assets-012345678910-us-west-1`. While unlikely, due to the qualifier and account ID being a part of the name, it is possible that this name for an Amazon S3 bucket is used by another {aws} account. Since bucket names are globally scoped, it can`'t be used by you if its used by a different account in the same partition. Most likely, a bucket with the same name exists somewhere in your account. This could be in the Region you are attempting to bootstrap, or another Region.
-
-Generally, the resolution is to locate this bucket in your account and determine what to do with it, or customize bootstrapping to create bootstrap resources of a different name.
-
-[#bootstrapping-troubleshoot-s3-bucket-name-resolution]
-=== Resolution
-
-First, determine if a bucket with the same name exists within your {aws} account. Using an {aws} identity with valid permissions to lookup Amazon S3 buckets in your account, you can do this in the following ways:
-
-* Use the {aws} Command Line Interface ({aws} CLI) `aws s3 ls` command to view a list of all your buckets.
-* Look up bucket names for each Region in your account using the https://console.aws.amazon.com/s3[Amazon S3 console].
-
-If a bucket with the same name exists, determine if it's being used. If it's not being used, consider deleting the bucket and attempting to bootstrap your environment again.
-
-If a bucket with the same name exists and you don't want to delete it, determine if it's already associated with a bootstrap stack in your account. You may have to check multiple Regions. The Region in the Amazon S3 bucket name doesn't necessarily mean that the bucket is in that Region. To check if it's associated with the `CDKToolkit` bootstrap stack, you can do either of the following for each Region:
-
-* Use the {aws} CLI `aws cloudformation describe-stack-resources --stack-name --region ` command to view the resources in your bootstrap stack and check if the bucket is listed.
-* In the https://console.aws.amazon.com/cloudformation[{aws} CloudFormation console], locate the `CDKToolkit` stack. Then, on the *Resources* tab, check if the bucket exists.
-
-If the bucket is associated with a bootstrap stack, determine if the bootstrap stack is in the same Region that you are attempting to bootstrap. If it is, your environment is already bootstrapped and you should be able to start using the CDK to deploy applications into your environment. If the Amazon S3 bucket is associated with a bootstrap stack in a different Region, you`'ll need to determine what to do. Possible resolutions include renaming the existing Amazon S3 bucket, deleting the current Amazon S3 bucket if its not being used, or using a new name for the Amazon S3 bucket you are attempting to create.
-
-If you are unable to locate an Amazon S3 bucket with the same name in your account, it may exist in a different account. To resolve this, you`'ll need to customize bootstrapping to create new names for all of your bootstrap resources or for just your Amazon S3 bucket. To create new names for all bootstrap resources, you can modify the qualifier. To create a new name for only your Amazon S3 bucket, you can provide a new bucket name.
-
-To customize bootstrapping, you can use options with the CDK CLI `cdk bootstrap` command or by modifying the bootstrap template. For instructions, see xref:bootstrapping-customizing[Customize {aws} CDK bootstrapping].
-
-If you customize bootstrapping, you will need to apply the same changes to synthesis before you can properly deploy an application. For instructions, see xref:bootstrapping-custom-synth[Customize CDK stack synthesis].
-
-For example, you can provide a new qualifier with `cdk bootstrap`:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --qualifier
-----
-
-The following is an example Amazon S3 bucket name that will be created with this modification: `cdk-abcde0123-assets-012345678910-us-west-1`. All bootstrap resources created during bootstrapping will use this qualifier.
-
-When developing your CDK app, you must specify your custom qualifier in your synthesizer. This helps the CDK with identifying your bootstrap resources during synthesis and deployment. The following is an example of customizing the default synthesizer for your stack instance:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new DefaultStackSynthesizer({
- qualifier: 'abcde0123',
- }),
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new DefaultStackSynthesizer({
- qualifier: 'abcde0123',
- }),
-})
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-MyStack(self, "MyStack",
- synthesizer=DefaultStackSynthesizer(
- qualifier="abcde0123"
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", StackProps.builder()
- .synthesizer(DefaultStackSynthesizer.Builder.create()
- .qualifier("abcde0123")
- .build())
- .build();
-)
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", new StackProps
-{
- Synthesizer = new DefaultStackSynthesizer(new DefaultStackSynthesizerProps
- {
- Qualifier = "abcde0123"
- })
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-func NewMyStack(scope constructs.Construct, id string, props *MyStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- synth := awscdk.NewDefaultStackSynthesizer(&awscdk.DefaultStackSynthesizerProps{
- Qualifier: jsii.String("abcde0123"),
- })
-
- stack.SetSynthesizer(synth)
-
- return stack
-}
-----
-
-You can also specify the new qualifier in the `cdk.json` file of your CDK project:
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "...",
- "context": {
- "@aws-cdk/core:bootstrapQualifier": "abcde0123"
- }
-}
-----
-
-To modify only the Amazon S3 bucket name, you can use the ``xref:ref-cli-cmd-bootstrap-options-bootstrap-bucket-name[--bootstrap-bucket-name]`` option. The following is an example:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --bootstrap-bucket-name ''
-----
-====
-
-When developing your CDK app, you must specify your new bucket name in your synthesizer. The following is an example of customizing the default synthesizer for your stack instance:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new DefaultStackSynthesizer({
- fileAssetsBucketName: 'my-new-bucket-name',
- }),
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new DefaultStackSynthesizer({
- fileAssetsBucketName: 'my-new-bucket-name',
- }),
-})
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-MyStack(self, "MyStack",
- synthesizer=DefaultStackSynthesizer(
- file_assets_bucket_name='my-new-bucket-name'
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", StackProps.builder()
- .synthesizer(DefaultStackSynthesizer.Builder.create()
- .fileAssetsBucketName("my-new-bucket-name")
- .build())
- .build();
-)
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", new StackProps
-{
- Synthesizer = new DefaultStackSynthesizer(new DefaultStackSynthesizerProps
- {
- FileAssetsBucketName = "my-new-bucket-name"
- })
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-func NewMyStack(scope constructs.Construct, id string, props *MyStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- synth := awscdk.NewDefaultStackSynthesizer(&awscdk.DefaultStackSynthesizerProps{
- FileAssetsBucketName: jsii.String("my-new-bucket-name"),
- })
-
- stack.SetSynthesizer(synth)
-
- return stack
-}
-----
-====
-
-[#bootstrapping-troubleshoot-s3-bucket-name-prevention]
-=== Prevention
-
-We recommend that you proactively bootstrap each {aws} environment that you plan to use. For more information, see xref:bootstrapping-env-when[When to bootstrap your environment]. Specifically for the Amazon S3 bucket naming issue, this will create Amazon S3 buckets in each {aws} environment and prevent others from using your Amazon S3 bucket name.
\ No newline at end of file
diff --git a/v2/guide/bootstrapping.adoc b/v2/guide/bootstrapping.adoc
deleted file mode 100644
index 0f3e2beb..00000000
--- a/v2/guide/bootstrapping.adoc
+++ /dev/null
@@ -1,43 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Bootstrapping
-:keywords: {aws} CDK, {aws} Cloud Development Kit ({aws} CDK), {aws} account, {aws} Region, Bootstrapping, Bootstrap, Environment
-
-[#bootstrapping]
-= {aws} CDK bootstrapping
-
-[abstract]
---
-_Bootstrapping_ is the process of preparing your {aws} environment for usage with the {aws} Cloud Development Kit ({aws} CDK). Before you deploy a CDK stack into an {aws} environment, the environment must first be bootstrapped.
---
-
-// Content start
-
-_Bootstrapping_ is the process of preparing your {aws} environment for usage with the {aws} Cloud Development Kit ({aws} CDK). Before you deploy a CDK stack into an {aws} environment, the environment must first be bootstrapped.
-
-[#bootstrapping-what]
-== What is bootstrapping?
-
-Bootstrapping prepares your {aws} environment by provisioning specific {aws} resources in your environment that are used by the {aws} CDK. These resources are commonly referred to as your _bootstrap resources_. They include the following:
-
-* *Amazon Simple Storage Service (Amazon S3) bucket* – Used to store your CDK project files, such as {aws} Lambda function code and assets.
-* *Amazon Elastic Container Registry (Amazon ECR) repository* – Used primarily to store [.noloc]`Docker` images.
-* *{aws} Identity and Access Management (IAM) roles* – Configured to grant permissions needed by the {aws} CDK to perform deployments. For more information about the IAM roles created during bootstrapping, see xref:bootstrapping-env-roles[IAM roles created during bootstrapping].
-
-[#bootstrapping-how]
-== How does bootstrapping work?
-
-Resources and their configuration that are used by the CDK are defined in an {aws} CloudFormation template. This template is created and managed by the CDK team. For the latest version of this template, see https://github.com/aws/aws-cdk-cli/blob/main/packages/aws-cdk/lib/api/bootstrap/bootstrap-template.yaml[`bootstrap-template.yaml`] in the _aws-cdk-cli [.noloc]`GitHub` repository_.
-
-To bootstrap an environment, you use the {aws} CDK Command Line Interface ({aws} CDK CLI) `cdk bootstrap` command. The CDK CLI retrieves the template and deploys it to {aws} CloudFormation as a stack, known as the _bootstrap stack_. By default, the stack name is `CDKToolkit`. By deploying this template, CloudFormation provisions the resources in your environment. After deployment, the bootstrap stack will appear in the {aws} CloudFormation console of your environment.
-
-You can also customize bootstrapping by modifying the template or by using CDK CLI options with the `cdk bootstrap` command.
-
-{aws} environments are independent. Each environment that you want to use with the {aws} CDK must first be bootstrapped.
-
-[#bootstrapping-learn]
-== Learn more
-
-For instructions on bootstrapping your environment, see xref:bootstrapping-env[Bootstrap your environment for use with the {aws} CDK].
\ No newline at end of file
diff --git a/v2/guide/build-containers.adoc b/v2/guide/build-containers.adoc
deleted file mode 100644
index fd69e0a8..00000000
--- a/v2/guide/build-containers.adoc
+++ /dev/null
@@ -1,133 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#build-containers]
-= Build and deploy container image assets in CDK apps
-:info_titleabbrev: Build and deploy container image assets
-:keywords: Docker, Dockerfile, Finch, Container, Container image, Container image asset, Amazon ECR, {aws} CDK, {aws} CDK CLI, Deploy, Build
-
-[abstract]
---
-When you build container image assets with the {aws} Cloud Development Kit ({aws} CDK), Docker is utilized by default to perform these actions. If you want to use a different container management tool, you can replace Docker through the `CDK_DOCKER` environment variable.
---
-
-// Content start
-
-When you build container image assets with the {aws} Cloud Development Kit ({aws} CDK), Docker is utilized by default to perform these actions. If you want to use a different container management tool, you can replace Docker through the `CDK_DOCKER` environment variable.
-
-[#build-containers-intro-example]
-== Example: Build and publish a container image asset with the {aws} CDK
-
-The following is a simple example of an {aws} CDK app that builds and publishes a container asset to Amazon Elastic Container Registry (Amazon ECR) using Docker by default:
-
-*Project structure*::
-+
-[source,none]
-----
-my-cdk-app/
-├── lib/
-│ ├── my-stack.ts
-│ └── docker/
-│ ├── Dockerfile
-│ └── app/
-│ └── index.js
-├── bin/
-│ └── my-cdk-app.ts
-├── package.json
-├── tsconfig.json
-└── cdk.json
-----
-
-*Dockerfile*::
-+
-[source,auto]
-----
-FROM public.ecr.aws/lambda/nodejs:16
-
-# Copy application code
-COPY app/ /var/task/
-
-# (Optional) Install dependencies
-# RUN npm install
-
-# The Lambda Node.js base image looks for index.handler by default
-----
-
-*Application code*::
-+
-In `lib/docker/app/index.js`:
-+
-[source,javascript]
-----
-console.log("Hello from inside the container!");
-----
-
-*CDK stack*::
-+
-[source,javascript]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import * as ecr_assets from 'aws-cdk-lib/aws-ecr-assets';
-
-export class MyStack extends cdk.Stack {
- constructor(scope: Construct, id: string) {
- super(scope, id);
-
- // Define a Docker image asset
- const dockerImageAsset = new ecr_assets.DockerImageAsset(this, 'MyDockerImage', {
- directory: 'lib/docker', // Path to the directory containing the Dockerfile
- });
-
- // Output the ECR URI
- new cdk.CfnOutput(this, 'ECRImageUri', {
- value: dockerImageAsset.imageUri,
- });
- }
-}
-----
-
-*CDK app*::
-+
-[source,javascript]
-----
-#!/usr/bin/env node
-import * as cdk from 'aws-cdk-lib';
-import { MyStack } from '../lib/my-stack';
-
-const app = new cdk.App();
-new MyStack(app, 'MyStack');
-----
-
-When we run `cdk deploy`, the {aws} Cloud Development Kit ({aws} CDK) Command Line Interface (CLI) does the following:
-
-. *Build the Docker image* – Run `docker build` locally based on the `Dockerfile` in the specified directory (`lib/docker`).
-. *Tag the image* – Run `docker tag` to tag the built image with a unique hash, based on the image contents.
-. *Publish to Amazon ECR* – Run `docker push` to publish the container image to an Amazon ECR repository. This repository must already exist. It is created during the default bootstrapping process.
-. *Output the Image URI* – After a successful deployment, the Amazon ECR URI of the published container image is output in your command prompt. This is the URI of our Docker image in Amazon ECR.
-
-[#build-container-replace]
-== How to replace Docker with another container management tool
-
-Use the `CDK_DOCKER` environment variable to specify the path to the binary of your replacement container management tool. The following is an example of replacing Docker with [noloc]``Finch``:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ which finch
-/usr/local/bin/finch # Locate the path to the binary
-
-$ export CDK_DOCKER='/usr/local/bin/finch' # Set the environment variable
-
-$ cdk deploy # Deploy using the replacement
-----
-
-Aliasing or linking is not supported. To replace Docker, you must use the `CDK_DOCKER` environment variable.
-
-[#build-container-supported]
-== Supported Docker drop-in replacement engines
-
-[noloc]`Finch` is supported, although there may be some Docker features that are unavailable or may work differently as the tool evolves. For more information on Finch, see https://aws.amazon.com/blogs/opensource/ready-for-flight-announcing-finch-1-0-ga/[Ready for Flight: Announcing Finch 1.0 GA!] in the _{aws} Open Source Blog_.
-
-Other container management tools may work. The CDK doesn't check which Docker replacement you are using to determine if it's supported. If the tool has equivalent Docker commands and behaves similarly, it should work.
\ No newline at end of file
diff --git a/v2/guide/cfn-layer.adoc b/v2/guide/cfn-layer.adoc
deleted file mode 100644
index 1b928c94..00000000
--- a/v2/guide/cfn-layer.adoc
+++ /dev/null
@@ -1,534 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#cfn-layer]
-= Customize constructs from the {aws} Construct Library
-:info_titleabbrev: Customize constructs
-
-[abstract]
---
-Customize constructs from the {aws} Construct Library through escape hatches, raw overrides, and custom resources.
---
-
-// Content start
-
-Customize constructs from the {aws} Construct Library through escape hatches, raw overrides, and custom resources.
-
-[#develop-customize-escape]
-== Use escape hatches
-
-The {aws} Construct Library provides xref:constructs[constructs] of varying levels of abstraction.
-
-At the highest level, your {aws} CDK application and the stacks in it are themselves abstractions of your entire cloud infrastructure, or significant chunks of it. They can be parameterized to deploy them in different environments or for different needs.
-
-Abstractions are powerful tools for designing and implementing cloud applications. The {aws} CDK gives you the power not only to build with its abstractions, but also to create new abstractions. Using the existing open-source L2 and L3 constructs as guidance, you can build your own L2 and L3 constructs to reflect your own organization's best practices and opinions.
-
-No abstraction is perfect, and even good abstractions cannot cover every possible use case. During development, you may find a construct that almost fits your needs, requiring a small or large customization.
-
-For this reason, the {aws} CDK provides ways to _break out_ of the construct model. This includes moving to a lower-level abstraction or to a different model entirely. Escape hatches let you _escape_ the {aws} CDK paradigm and customize it in ways that suit your needs. Then, you can wrap your changes in a new construct to abstract away the underlying complexity and provide a clean API for other developers.
-
-The following are examples of situations where you can use escape hatches:
-
-* An {aws} service feature is available through {aws} CloudFormation, but there are no L2 constructs for it.
-* An {aws} service feature is available through {aws} CloudFormation, and there are L2 constructs for the service, but these don't yet expose the feature. Because L2 constructs are curated by the CDK team, they may not be immediately available for new features.
-* The feature is not yet available through {aws} CloudFormation at all.
-+
-To determine whether a feature is available through {aws} CloudFormation, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html[{aws} Resource and Property Types Reference].
-
-[#develop-customize-escape-l1]
-=== Develop escape hatches for L1 constructs
-
-If L2 constructs are not available for the service, you can use the automatically generated L1 constructs. These resources can be recognized by their name starting with `Cfn`, such as `CfnBucket` or `CfnRole`. You instantiate them exactly as you would use the equivalent {aws} CloudFormation resource.
-
-For example, to instantiate a low-level Amazon S3 bucket L1 with analytics enabled, you would write something like the following.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new s3.CfnBucket(this, 'amzn-s3-demo-bucket', {
- analyticsConfigurations: [
- {
- id: 'Config',
- // ...
- }
- ]
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new s3.CfnBucket(this, 'amzn-s3-demo-bucket', {
- analyticsConfigurations: [
- {
- id: 'Config'
- // ...
- }
- ]
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-s3.CfnBucket(self, "amzn-s3-demo-bucket",
- analytics_configurations: [
- dict(id="Config",
- # ...
- )
- ]
-)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-CfnBucket.Builder.create(this, "amzn-s3-demo-bucket")
- .analyticsConfigurations(Arrays.asList(java.util.Map.of( // Java 9 or later
- "id", "Config", // ...
- ))).build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new CfnBucket(this, 'amzn-s3-demo-bucket', new CfnBucketProps {
- AnalyticsConfigurations = new Dictionary
- {
- ["id"] = "Config",
- // ...
- }
-});
-----
-====
-
-There might be rare cases where you want to define a resource that doesn't have a corresponding `CfnXxx` class. This could be a new resource type that hasn't yet been published in the {aws} CloudFormation resource specification. In cases like this, you can instantiate the `cdk.CfnResource` directly and specify the resource type and properties. This is shown in the following example.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new cdk.CfnResource(this, 'amzn-s3-demo-bucket', {
- type: '{aws}::S3::Bucket',
- properties: {
- // Note the PascalCase here! These are CloudFormation identifiers.
- AnalyticsConfigurations: [
- {
- Id: 'Config',
- // ...
- }
- ]
- }
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new cdk.CfnResource(this, 'amzn-s3-demo-bucket', {
- type: '{aws}::S3::Bucket',
- properties: {
- // Note the PascalCase here! These are CloudFormation identifiers.
- AnalyticsConfigurations: [
- {
- Id: 'Config'
- // ...
- }
- ]
- }
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-cdk.CfnResource(self, 'amzn-s3-demo-bucket',
- type="{aws}::S3::Bucket",
- properties=dict(
- # Note the PascalCase here! These are CloudFormation identifiers.
- "AnalyticsConfigurations": [
- {
- "Id": "Config",
- # ...
- }
- ]
- )
-)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-CfnResource.Builder.create(this, "amzn-s3-demo-bucket")
- .type("{aws}::S3::Bucket")
- .properties(java.util.Map.of( // Map.of requires Java 9 or later
- // Note the PascalCase here! These are CloudFormation identifiers
- "AnalyticsConfigurations", Arrays.asList(
- java.util.Map.of("Id", "Config", // ...
- ))))
- .build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new CfnResource(this, "amzn-s3-demo-bucket", new CfnResourceProps
-{
- Type = "{aws}::S3::Bucket",
- Properties = new Dictionary
- { // Note the PascalCase here! These are CloudFormation identifiers
- ["AnalyticsConfigurations"] = new Dictionary[]
- {
- new Dictionary {
- ["Id"] = "Config"
- }
- }
- }
-});
-----
-====
-
-[#develop-customize-escape-l2]
-=== Develop escape hatches for L2 constructs
-
-If an L2 construct is missing a feature or you're trying to work around an issue, you can modify the L1 construct that's encapsulated by the L2 construct.
-
-All L2 constructs contain within them the corresponding L1 construct. For example, the high-level `Bucket` construct wraps the low-level `CfnBucket` construct. Because the `CfnBucket` corresponds directly to the {aws} CloudFormation resource, it exposes all features that are available through {aws} CloudFormation.
-
-The basic approach to get access to the L1 construct is to use `construct.node.defaultChild` (Python: `default_child`), cast it to the right type (if necessary), and modify its properties. Again, let's take the example of a `Bucket`.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-const cfnBucket = bucket.node.defaultChild as s3.CfnBucket;
-
-// Change its properties
-cfnBucket.analyticsConfiguration = [
- {
- id: 'Config',
- // ...
- }
-];
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-const cfnBucket = bucket.node.defaultChild;
-
-// Change its properties
-cfnBucket.analyticsConfiguration = [
- {
- id: 'Config'
- // ...
- }
-];
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-# Get the CloudFormation resource
-cfn_bucket = bucket.node.default_child
-
-# Change its properties
-cfn_bucket.analytics_configuration = [
- {
- "id": "Config",
- # ...
- }
-]
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-CfnBucket cfnBucket = (CfnBucket)bucket.getNode().getDefaultChild();
-
-cfnBucket.setAnalyticsConfigurations(
- Arrays.asList(java.util.Map.of( // Java 9 or later
- "Id", "Config", // ...
- ));
-)
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-var cfnBucket = (CfnBucket)bucket.Node.DefaultChild;
-
-cfnBucket.AnalyticsConfigurations = new List {
- new Dictionary
- {
- ["Id"] = "Config",
- // ...
- }
-};
-----
-====
-
-You can also use this object to change {aws} CloudFormation options such as `Metadata` and ``UpdatePolicy``.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-cfnBucket.cfnOptions.metadata = {
- MetadataKey: 'MetadataValue'
-};
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-cfnBucket.cfnOptions.metadata = {
- MetadataKey: 'MetadataValue'
-};
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-cfn_bucket.cfn_options.metadata = {
- "MetadataKey": "MetadataValue"
-}
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-cfnBucket.getCfnOptions().setMetadata(java.util.Map.of( // Java 9+
- "MetadataKey", "Metadatavalue"));
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-cfnBucket.CfnOptions.Metadata = new Dictionary
-{
- ["MetadataKey"] = "Metadatavalue"
-};
-----
-====
-
-[#develop-customize-unescape]
-== Use un-escape hatches
-
-The {aws} CDK also provides the capability to go _up_ an abstraction level, which we might refer to as an "un-escape" hatch. If you have an L1 construct, such as `CfnBucket`, you can create a new L2 construct (`Bucket` in this case) to wrap the L1 construct.
-
-This is convenient when you create an L1 resource but want to use it with a construct that requires an L2 resource. It's also helpful when you want to use convenience methods like `.grantXxxxx()` that aren't available on the L1 construct.
-
-You move to the higher abstraction level using a static method on the L2 class called `.fromCfnXxxxx()`--for example, `Bucket.fromCfnBucket()` for Amazon S3 buckets. The L1 resource is the only parameter.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-b1 = new s3.CfnBucket(this, "buck09", { ... });
-b2 = s3.Bucket.fromCfnBucket(b1);
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-b1 = new s3.CfnBucket(this, "buck09", { ...} );
-b2 = s3.Bucket.fromCfnBucket(b1);
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-b1 = s3.CfnBucket(self, "buck09", ...)
- b2 = s3.from_cfn_bucket(b1)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-CfnBucket b1 = CfnBucket.Builder.create(this, "buck09")
- // ....
- .build();
-IBucket b2 = Bucket.fromCfnBucket(b1);
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var b1 = new CfnBucket(this, "buck09", new CfnBucketProps { ... });
-var v2 = Bucket.FromCfnBucket(b1);
-----
-====
-
-L2 constructs created from L1 constructs are proxy objects that refer to the L1 resource, similar to those created from resource names, ARNs, or lookups. Modifications to these constructs do not affect the final synthesized {aws} CloudFormation template (since you have the L1 resource, however, you can modify that instead). For more information on proxy objects, see xref:resources-external[Referencing resources in your {aws} account].
-
-To avoid confusion, do not create multiple L2 constructs that refer to the same L1 construct. For example, if you extract the `CfnBucket` from a `Bucket` using the technique in the xref:develop-customize-escape-l2[previous section], you shouldn't create a second `Bucket` instance by calling `Bucket.fromCfnBucket()` with that `CfnBucket`. It actually works as you'd expect (only one `{aws}::S3::Bucket` is synthesized) but it makes your code more difficult to maintain.
-
-[#develop-customize-override]
-== Use raw overrides
-
-If there are properties that are missing from the L1 construct, you can bypass all typing using raw overrides. This also makes it possible to delete synthesized properties.
-
-Use one of the `addOverride` methods (Python: `add_override`) methods, as shown in the following example.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-const cfnBucket = bucket.node.defaultChild as s3.CfnBucket;
-
-// Use dot notation to address inside the resource template fragment
-cfnBucket.addOverride('Properties.VersioningConfiguration.Status', 'NewStatus');
-cfnBucket.addDeletionOverride('Properties.VersioningConfiguration.Status');
-
-// use index (0 here) to address an element of a list
-cfnBucket.addOverride('Properties.Tags.0.Value', 'NewValue');
-cfnBucket.addDeletionOverride('Properties.Tags.0');
-
-// addPropertyOverride is a convenience function for paths starting with "Properties."
-cfnBucket.addPropertyOverride('VersioningConfiguration.Status', 'NewStatus');
-cfnBucket.addPropertyDeletionOverride('VersioningConfiguration.Status');
-cfnBucket.addPropertyOverride('Tags.0.Value', 'NewValue');
-cfnBucket.addPropertyDeletionOverride('Tags.0');
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-const cfnBucket = bucket.node.defaultChild ;
-
-// Use dot notation to address inside the resource template fragment
-cfnBucket.addOverride('Properties.VersioningConfiguration.Status', 'NewStatus');
-cfnBucket.addDeletionOverride('Properties.VersioningConfiguration.Status');
-
-// use index (0 here) to address an element of a list
-cfnBucket.addOverride('Properties.Tags.0.Value', 'NewValue');
-cfnBucket.addDeletionOverride('Properties.Tags.0');
-
-// addPropertyOverride is a convenience function for paths starting with "Properties."
-cfnBucket.addPropertyOverride('VersioningConfiguration.Status', 'NewStatus');
-cfnBucket.addPropertyDeletionOverride('VersioningConfiguration.Status');
-cfnBucket.addPropertyOverride('Tags.0.Value', 'NewValue');
-cfnBucket.addPropertyDeletionOverride('Tags.0');
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-# Get the CloudFormation resource
-cfn_bucket = bucket.node.default_child
-
-# Use dot notation to address inside the resource template fragment
-cfn_bucket.add_override("Properties.VersioningConfiguration.Status", "NewStatus")
-cfn_bucket.add_deletion_override("Properties.VersioningConfiguration.Status")
-
-# use index (0 here) to address an element of a list
-cfn_bucket.add_override("Properties.Tags.0.Value", "NewValue")
-cfn_bucket.add_deletion_override("Properties.Tags.0")
-
-# addPropertyOverride is a convenience function for paths starting with "Properties."
-cfn_bucket.add_property_override("VersioningConfiguration.Status", "NewStatus")
-cfn_bucket.add_property_deletion_override("VersioningConfiguration.Status")
-cfn_bucket.add_property_override("Tags.0.Value", "NewValue")
-cfn_bucket.add_property_deletion_override("Tags.0")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-CfnBucket cfnBucket = (CfnBucket)bucket.getNode().getDefaultChild();
-
-// Use dot notation to address inside the resource template fragment
-cfnBucket.addOverride("Properties.VersioningConfiguration.Status", "NewStatus");
-cfnBucket.addDeletionOverride("Properties.VersioningConfiguration.Status");
-
-// use index (0 here) to address an element of a list
-cfnBucket.addOverride("Properties.Tags.0.Value", "NewValue");
-cfnBucket.addDeletionOverride("Properties.Tags.0");
-
-// addPropertyOverride is a convenience function for paths starting with "Properties."
-cfnBucket.addPropertyOverride("VersioningConfiguration.Status", "NewStatus");
-cfnBucket.addPropertyDeletionOverride("VersioningConfiguration.Status");
-cfnBucket.addPropertyOverride("Tags.0.Value", "NewValue");
-cfnBucket.addPropertyDeletionOverride("Tags.0");
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-// Get the CloudFormation resource
-var cfnBucket = (CfnBucket)bucket.node.defaultChild;
-
-// Use dot notation to address inside the resource template fragment
-cfnBucket.AddOverride("Properties.VersioningConfiguration.Status", "NewStatus");
-cfnBucket.AddDeletionOverride("Properties.VersioningConfiguration.Status");
-
-// use index (0 here) to address an element of a list
-cfnBucket.AddOverride("Properties.Tags.0.Value", "NewValue");
-cfnBucket.AddDeletionOverride("Properties.Tags.0");
-
-// addPropertyOverride is a convenience function for paths starting with "Properties."
-cfnBucket.AddPropertyOverride("VersioningConfiguration.Status", "NewStatus");
-cfnBucket.AddPropertyDeletionOverride("VersioningConfiguration.Status");
-cfnBucket.AddPropertyOverride("Tags.0.Value", "NewValue");
-cfnBucket.AddPropertyDeletionOverride("Tags.0");
-----
-====
-
-[#develop-customize-custom]
-== Use custom resources
-
-If the feature isn't available through {aws} CloudFormation, but only through a direct API call, you must write an {aws} CloudFormation Custom Resource to make the API call you need. You can use the {aws} CDK to write custom resources and wrap them into a regular construct interface. From the perspective of a consumer of your construct, the experience will feel native.
-
-Building a custom resource involves writing a Lambda function that responds to a resource's `CREATE`, `UPDATE`, and `DELETE` lifecycle events. If your custom resource needs to make only a single API call, consider using the https://github.com/awslabs/aws-cdk/tree/master/packages/%40aws-cdk/custom-resources[AwsCustomResource]. This makes it possible to perform arbitrary SDK calls during an {aws} CloudFormation deployment. Otherwise, you should write your own Lambda function to perform the work you need to get done.
-
-The subject is too broad to cover completely here, but the following links should get you started:
-
-* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html[Custom Resources]
-* https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/custom-resource/[Custom-Resource Example]
-* For a more fully fledged example, see the https://github.com/awslabs/aws-cdk/blob/master/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts[DnsValidatedCertificate] class in the CDK standard library. This is implemented as a custom resource.
\ No newline at end of file
diff --git a/v2/guide/chapter-deploy.adoc b/v2/guide/chapter-deploy.adoc
deleted file mode 100644
index 6ef008db..00000000
--- a/v2/guide/chapter-deploy.adoc
+++ /dev/null
@@ -1,234 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-:https---docs-aws-amazon-com-cdk-api-v2-docs-aws-cdk-lib-aws-cloudformation-readme-html: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudformation-readme.html
-:https---docs-aws-amazon-com-cdk-api-v2-docs-aws-cdk-lib-readme-html-stack-synthesizers: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib-readme.html#stack-synthesizers
-[.topic]
-[#deploy]
-= Deploy {aws} CDK applications
-:keywords: {aws} CDK, IaC, Infrastructure as code, {aws}, {aws} Cloud, serverless, modern applications
-
-[abstract]
---
-An {aws} Cloud Development Kit ({aws} CDK) deployment is the process of provisioning your infrastructure on {aws}.
---
-
-// Content start
-
-An {aws} Cloud Development Kit ({aws} CDK) deployment is the process of provisioning your infrastructure on {aws}.
-
-[#deploy-how]
-== How {aws} CDK deployments work
-
-The {aws} CDK utilizes the {aws} CloudFormation service to perform deployments. Before you deploy, you synthesize your CDK stacks. This creates a CloudFormation template and deployment artifacts for each CDK stack in your app. Deployments are initiated from a local development machine or from a _continuous integration and continuous delivery (CI/CD)_ environment. During deployment, assets are uploaded to the bootstrapped resources and the CloudFormation template is submitted to CloudFormation to provision your {aws} resources.
-
-For a deployment to be successful, the following is required:
-
-* The {aws} CDK Command Line Interface ({aws} CDK CLI) must be provided with valid permissions.
-* The {aws} environment must be bootstrapped.
-* The {aws} CDK must know the bootstrapped resources to upload assets into.
-
-[#deploy-prerequisites]
-== Prerequisites for CDK deployments
-
-Before you can deploy an {aws} CDK application, you must complete the following:
-
-* Configure security credentials for the CDK CLI.
-* Bootstrap your {aws} environment.
-* Configure an {aws} environment for each of your CDK stacks.
-* Develop your CDK app.
-
-[#deploy-prerequisites-creds]
-*Configure security credentials*::
-+
-To use the CDK CLI to interact with {aws}, you must configure security credentials on your local machine. For instructions, see xref:configure-access[Configure security credentials for the {aws} CDK CLI].
-
-[#deploy-prerequisites-bootstrap]
-*Bootstrap your {aws} environment*::
-+
-A deployment is always associated with one or more {aws} xref:environments[environments]. Before you can deploy, the environment must first be xref:bootstrapping[bootstrapped]. Bootstrapping provisions resources in your environment that the CDK uses to perform and manage deployments. These resources include an Amazon Simple Storage Service (Amazon S3) bucket and Amazon Elastic Container Registry (Amazon ECR) repository to store and manage xref:assets[assets]. These resources also include {aws} Identity and Access Management (IAM) roles that are used to provide permissions during development and deployment.
-+
-We recommend that you use the {aws} CDK Command Line Interface ({aws} CDK CLI) `cdk bootstrap` command to bootstrap your environment. You can customize bootstrapping or manually create these resources in your environment if necessary. For instructions, see xref:bootstrapping-env[Bootstrap your environment for use with the {aws} CDK].
-
-[#deploy-prerequisites-env]
-*Configure {aws} environments*::
-+
-Each CDK stack must be associated with an environment to determine where the stack is deployed to. For instructions, see xref:configure-env[Configure environments to use with the {aws} CDK].
-
-[#deploy-prerequisites-develop]
-*Develop your CDK app*::
-+
-Within a CDK xref:projects[project], you create and develop your CDK app. Within your app, you create one or more CDK xref:stacks[stacks]. Within your stacks, you import and use xref:constructs[constructs] from the {aws} Construct Library to define your infrastructure. Before you can deploy, your CDK app must contain at least one stack.
-
-[#deploy-how-synth]
-== CDK app synthesis
-
-To perform synthesis, we recommend that you use the CDK CLI `cdk synth` command. The `cdk deploy` command will also perform synthesis before initiating deployment. However, by using `cdk synth`, you can validate your CDK app and catch errors before initiating deployment.
-
-Synthesis behavior is determined by the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib-readme.html#stack-synthesizers[stack synthesizer] that you configure for your CDK stack. If you don`'t configure a synthesizer, `https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.DefaultStackSynthesizer.html[DefaultStackSynthesizer]` will be used. You can also configure and customize synthesis to meet your needs. For instructions, see xref:configure-synth[Configure and perform CDK stack synthesis].
-
-For your synthesized CloudFormation template to deploy successfully into your environment, it must be compatible with how your environment was bootstrapped. For example, your CloudFormation template must specify the correct Amazon S3 bucket to deploy assets into. If you use the default method of bootstrapping your environment, the default stack synthesizer will work. If you customize CDK behavior, such as customizing bootstrapping or synthesis, CDK deployment behavior may vary.
-
-[#deploy-how-synth-app]
-*The app lifecycle*::
-+
-When you perform synthesis, your CDK app is run through the following phases, known as the __app lifecycle__:
-+
-*Construction (or Initialization)*:::
-+
-Your code instantiates all of the defined constructs and then links them together. In this stage, all of the constructs (app, stacks, and their child constructs) are instantiated and the constructor chain is run. Most of your app code is run in this stage.
-+
-*Preparation*:::
-All constructs that have implemented the `prepare` method participate in a final round of modifications, to set up their final state. The preparation phase happens automatically. As a user, you don't see any feedback from this phase. It's rare to need to use the "prepare" hook, and generally not recommended. Be very careful when mutating the construct tree during this phase, because the order of operations could impact behavior.
-+
-During this phase, once the construct tree has been built, any xref:aspects[aspects] that you have configured are applied as well.
-+
-*Validation*:::
-+
-All constructs that have implemented the `validate` method can validate themselves to ensure that they're in a state that will correctly deploy. You will get notified of any validation failures that happen during this phase. Generally, we recommend performing validation as soon as possible (usually as soon as you get some input) and throwing exceptions as early as possible. Performing validation early improves reliability as stack traces will be more accurate, and ensures that your code can continue to execute safely.
-+
-*Synthesis*:::
-+
-This is the final stage of running your CDK app. It's triggered by a call to `app.synth()`, and it traverses the construct tree and invokes the `synthesize` method on all constructs. Constructs that implement `synthesize` can participate in synthesis and produce deployment artifacts to the resulting cloud assembly. These artifacts include CloudFormation templates, {aws} Lambda application bundles, file and Docker image assets, and other deployment artifacts. In most cases, you won't need to implement the `synthesize` method.
-
-[#deploy-how-synth-run]
-*Running your app*::
-+
-The CDK CLI needs to know how to run your CDK app. If you created the project from a template using the `cdk init` command, your app's `cdk.json` file includes an `app` key. This key specifies the necessary command for the language that the app is written in. If your language requires compilation, the command line performs this step before running the app automatically.
-+
-====
-[role="tablist"]
-TypeScript::
-+
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "npx ts-node --prefer-ts-exts bin/my-app.ts"
-}
-----
-
-JavaScript::
-+
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "node bin/my-app.js"
-}
-----
-
-Python::
-+
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "python app.py"
-}
-----
-
-Java::
-+
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "mvn -e -q compile exec:java"
-}
-----
-
-C#::
-+
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "dotnet run -p src/MyApp/MyApp.csproj"
-}
-----
-
-Go::
-+
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "go mod download && go run my-app.go"
-}
-----
-====
-+
-If you didn't create your project using the CDK CLI, or if you want to override the command line given in `cdk.json`, you can provide the `xref:ref-cli-cmd-options-app[--app]` option when running the `cdk` command.
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk --app '' ...
-----
-
-The `` part of the command indicates the command that should be run to execute your CDK application. Use quotation marks as shown, since such commands contain spaces. The `` is a subcommand like `synth` or `deploy` that tells the CDK CLI what you want to do with your app. Follow this with any additional options needed for that subcommand.
-
-The CDK CLI can also interact directly with an already-synthesized cloud assembly. To do that, pass the directory in which the cloud assembly is stored in `--app`. The following example lists the stacks defined in the cloud assembly stored under `./my-cloud-assembly`.
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk --app <./my-cloud-assembly> ls
-----
-
-[#deploy-how-synth-assemblies]
-*Cloud assemblies*::
-+
-The call to `app.synth()` is what tells the {aws} CDK to synthesize a cloud assembly from an app. Typically you don't interact directly with cloud assemblies. They are files that include everything needed to deploy your app to a cloud environment. For example, it includes an {aws} CloudFormation template for each stack in your app. It also includes a copy of any file assets or Docker images that you reference in your app.
-+
-See the https://github.com/aws/aws-cdk/blob/master/design/cloud-assembly.md[cloud assembly specification] for details on how cloud assemblies are formatted.
-+
-To interact with the cloud assembly that your {aws} CDK app creates, you typically use the {aws} CDK CLI. However, any tool that can read the cloud assembly format can be used to deploy your app.
-
-[#deploy-how-deploy]
-== Deploy your application
-
-To deploy your application, we recommend that you use the CDK CLI `cdk deploy` command to initiate deployments or to configure automated deployments.
-
-When you run `cdk deploy`, the CDK CLI initiates `cdk synth` to prepare for deployment. The following diagram illustrates the app lifecycle in the context of a deployment:
-
-image::./images/app-lifecycle_cdk-flowchart.png[Flowchart of the {aws} CDK app lifecycle.,scaledwidth=100%]
-
-During deployment, the CDK CLI takes the cloud assembly produced by synthesis and deploys it to an {aws} environment. Assets are uploaded to Amazon S3 and Amazon ECR and the CloudFormation template is submitted to {aws} CloudFormation for deployment.
-
-By the time the {aws} CloudFormation deployment phase starts, your CDK app has already finished running and exited. This has the following implications:
-
-* The CDK app can't respond to events that happen during deployment, such as a resource being created or the whole deployment finishing. To run code during the deployment phase, you must inject it into the {aws} CloudFormation template as a xref:develop-customize-custom[custom resource]. For more information about adding a custom resource to your app, see the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudformation-readme.html[{aws} CloudFormation module], or the link:https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/custom-resource/[custom-resource] example. You can also configure the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.triggers-readme.html[Triggers] module to run code during deployments.
-* The CDK app might have to work with values that can't be known at the time it runs. For example, if the {aws} CDK app defines an Amazon S3 bucket with an automatically generated name, and you retrieve the `bucket.bucketName` (Python: `bucket_name`) attribute, that value is not the name of the deployed bucket. Instead, you get a `Token` value. To determine whether a particular value is available, call `cdk.isUnresolved(value)` (Python: `is_unresolved`). See xref:tokens[Tokens and the {aws} CDK] for details.
-
-[#deploy-how-deploy-permissions]
-*Deployment permissions*::
-+
-Before deployment can be performed, permissions must be established. The following diagram illustrates the permissions that are used during a default deployment, when using the default bootstrapping process and stack synthesizer:
-+
-image::./images/default-deploy-process_cdk_flowchart.png[Flowchart of the default {aws} CDK deployment process.,scaledwidth=100%]
-+
-*Actor initiates deployment*:::
-+
-Deployments are initiated by an _actor_, using the CDK CLI. An actor can either be a person, or a service such as {aws} CodePipeline.
-+
-If necessary, the CDK CLI runs `cdk synth` when you run `cdk deploy`. During synthesis, the {aws} identity assumes the `LookupRole` to perform context lookups in the {aws} environment.
-+
-*Permissions are established*:::
-+
-First, the actor's security credentials are used to authenticate to {aws} and obtain the first IAM identity in the process. For human actors, how security credentials are configured and obtained depends on how you or your organization manages users. For more information, see xref:configure-access[Configure security credentials for the {aws} CDK CLI]. For service actors, such as CodePipeline, an IAM execution role is assumed and used.
-+
-Next, the IAM roles created in your {aws} environment during bootstrapping are used to establish permissions to perform the actions needed for deployment. For more information about these roles and what they grant permissions for, see xref:bootstrapping-env-roles[IAM roles created during bootstrapping]. This process includes the following:
-+
---
-* The {aws} identity assumes the `DeploymentActionRole` role and passes the `CloudFormationExecutionRole` role to CloudFormation, ensuring that CloudFormation assumes the role when it performs any actions in your {aws} environment. `DeploymentActionRole` grants permission to perform deployments into your environment and `CloudFormationExecutionRole` determines what actions CloudFormation can perform.
-* The {aws} identity assumes the `FilePublishingRole`, which determines the actions that can be performed on the Amazon S3 bucket created during bootstrapping.
-* The {aws} identity assumes the `ImagePublishingRole`, which determines the actions that can be performed on the Amazon ECR repository created during bootstrapping.
-* If necessary, the {aws} identity assumes the `LookupRole` to perform context lookups in the {aws} environment. This action may also be performed during template synthesis.
---
-+
-*Deployment is performed*:::
-+
-During deployment, the CDK CLI reads the bootstrap version parameter to confirm the bootstrap version number. {aws} CloudFormation also reads this parameter at deployment time to confirm. If permissions across the deployment workflow are valid, deployment is performed. Assets are uploaded to the bootstrapped resources and the CloudFormation template produced at synthesis is deployed using the CloudFormation service as a CloudFormation stack to provision your resources.
-
-include::policy-validation-synthesis.adoc[leveloffset=+1]
-
-include::create-cdk-pipeline.adoc[leveloffset=+1]
-
-include::build-containers.adoc[leveloffset=+1]
-
-include::deploy-troubleshoot.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/chapter-develop.adoc b/v2/guide/chapter-develop.adoc
deleted file mode 100644
index 43b294dc..00000000
--- a/v2/guide/chapter-develop.adoc
+++ /dev/null
@@ -1,68 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#develop]
-= Develop {aws} CDK applications
-:keywords: {aws} CDK, IaC, Infrastructure as code, {aws}, {aws} Cloud, serverless, modern applications
-
-[abstract]
---
-Manage your infrastructure on {aws} by developing applications using the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-
-Manage your infrastructure on {aws} by developing applications using the {aws} Cloud Development Kit ({aws} CDK).
-
-[#develop-prerequisites]
-== Prerequisites
-
-Before you can start developing applications, complete all set up steps in xref:getting-started[Getting started with the {aws} CDK].
-
-[#develop-overview]
-== Developing {aws} CDK applications overview
-
-At a high-level, developing CDK applications involves the following steps:
-
-. *Create a CDK project* – A CDK xref:projects[project] consists of the files and folders that store and organize your CDK code.
-. *Create a CDK app* – Within a CDK project, you use the `App` construct to define a CDK xref:apps[application].
-. *Create a CDK stack* – Within the scope of your CDK app, you define one or more CDK xref:stacks[stacks].
-. *Define your infrastructure* – Within the scope of a CDK stack, you use xref:constructs[constructs] from the {aws} Construct Library to define the {aws} resources and properties that will become your infrastructure. Using a general-purpose programming xref:languages[language] of your choice, you can use logic, such as conditional statements and loops, to define your infrastructure based on certain conditions.
-
-[#develop-gs]
-== Get started with developing CDK applications
-
-To get started, you can use the {aws} CDK Command Line Interface ({aws} CDK CLI) `cdk init` command. Provide the `--language` option to specify the programming language to use. This command creates a starting CDK project and imports the main {aws} Construct Library and core modules.
-
-[#develop-library]
-== Import and use the {aws} CDK Library
-
-After you create a CDK project, import and use constructs from the {aws} CDK Library to begin defining your infrastructure. For instructions, see xref:work-with[Work with the {aws} CDK library].
-
-[#develop-next]
-== Next steps
-
-When ready to deploy your application, use the CDK CLI `cdk deploy` command. For instructions, see xref:deploy[Deploy {aws} CDK applications].
-
-include::usage-data.adoc[leveloffset=+1]
-
-include::cfn-layer.adoc[leveloffset=+1]
-
-include::get-env-var.adoc[leveloffset=+1]
-
-include::get-cfn-val.adoc[leveloffset=+1]
-
-include::use-cfn-template.adoc[leveloffset=+1]
-
-include::get-ssm-val.adoc[leveloffset=+1]
-
-include::get-sm-val.adoc[leveloffset=+1]
-
-include::set-cw-alarm.adoc[leveloffset=+1]
-
-include::get-context-var.adoc[leveloffset=+1]
-
-include::use-cfn-public-registry.adoc[leveloffset=+1]
-
-include::define-iam-l2.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/cli.adoc b/v2/guide/cli.adoc
deleted file mode 100644
index 81cf29ff..00000000
--- a/v2/guide/cli.adoc
+++ /dev/null
@@ -1,785 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#cli]
-= {aws} CDK CLI reference
-
-// Content start
-
-The {aws} Cloud Development Kit ({aws} CDK) Command Line Interface ({aws} CDK CLI), also known as the CDK Toolkit, is the primary tool for interacting with your {aws} CDK app. It executes your app, interrogates the application model you defined, and produces and deploys the {aws} CloudFormation templates generated by the {aws} CDK. It also provides other features useful for creating and working with {aws} CDK projects. This topic contains information about common use cases of the CDK CLI.
-
-The CDK CLI is installed with the Node Package Manager. In most cases, we recommend installing it globally.
-
-[source,none,subs="verbatim,attributes"]
-----
-npm install -g aws-cdk # install latest version
-npm install -g aws-cdk@X.YY.Z # install specific version
-----
-
-[TIP]
-====
-
-If you regularly work with multiple versions of the {aws} CDK, consider installing a matching version of the CDK CLI in individual CDK projects. To do this, omit `-g` from the `npm install` command. Then use `npx aws-cdk` to invoke it. This runs the local version if one exists, falling back to a global version if not.
-
-====
-
-[#cli-commands]
-== CDK CLI commands
-
-All CDK CLI commands start with `cdk`, which is followed by a subcommand (`list`, `synthesize`, `deploy`, etc.). Some subcommands have a shorter version (`ls`, `synth`, etc.) that is equivalent. Options and arguments follow the subcommand in any order.
-
-For a description of all subcommands, options, and arguments, see xref:ref-cli-cmd[{aws} CDK CLI command reference].
-
-[#cli-options]
-== Specify options and their values
-
-Command line options begin with two hyphens (`--`). Some frequently used options have single-letter synonyms that begin with a single hyphen (for example, `--app` has a synonym `-a`). The order of options in an CDK CLI command is not important.
-
-All options accept a value, which must follow the option name. The value may be separated from the name by white space or by an equals sign `=`. The following two options are equivalent.
-
-[source,none,subs="verbatim,attributes"]
-----
---toolkit-stack-name MyBootstrapStack
---toolkit-stack-name=MyBootstrapStack
-----
-
-Some options are flags (Booleans). You may specify `true` or `false` as their value. If you do not provide a value, the value is taken to be `true`. You may also prefix the option name with `no-` to imply `false`.
-
-[source,none,subs="verbatim,attributes"]
-----
-# sets staging flag to true
---staging
---staging=true
---staging true
-
-# sets staging flag to false
---no-staging
---staging=false
---staging false
-----
-
-A few options, namely `--context`, `--parameters`, `--plugin`, `--tags`, and `--trust`, may be specified more than once to specify multiple values. These are noted as having `[array]` type in the CDK CLI help. For example:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk bootstrap --tags costCenter=0123 --tags responsibleParty=jdoe
-----
-
-[#cli-help]
-== Built-in help
-
-The CDK CLI has integrated help. You can see general help about the utility and a list of the provided subcommands by issuing:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk --help
-----
-
-To see help for a particular subcommand, for example `deploy`, specify it before the `--help` flag.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy --help
-----
-
-Issue `cdk version` to display the version of the CDK CLI. Provide this information when requesting support.
-
-[#version-reporting]
-== Version reporting
-
-To gain insight into how the {aws} CDK is used, the constructs used by {aws} CDK applications are collected and reported by using a resource identified as `{aws}::CDK::Metadata`. To learn more, see xref:usage-data[Configure {aws} CDK usage data reporting].
-
-[#cli-auth]
-== Authentication with {aws}
-
-There are different ways in which you can configure programmatic access to {aws} resources, depending on the environment and the {aws} access available to you.
-
-To choose your method of authentication and configure it for the CDK CLI, see xref:configure-access[Configure security credentials for the {aws} CDK CLI].
-
-The recommended approach for new users developing locally, who are not given a method of authentication by their employer, is to set up {aws} IAM Identity Center. This method includes installing the {aws} CLI for ease of configuration and for regularly signing in to the {aws} access portal. If you choose this method, your environment should contain the following elements after you complete the procedure for https://docs.aws.amazon.com/sdkref/latest/guide/access-sso.html[IAM Identity Center authentication] in the _{aws} SDKs and Tools Reference Guide_:
-
-* The {aws} CLI, which you use to start an {aws} access portal session before you run your application.
-* A https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html[shared {aws} config file] having a `[default]` profile with a set of configuration values that can be referenced from the {aws} CDK. To find the location of this file, see https://docs.aws.amazon.com/sdkref/latest/guide/file-location.html[Location of the shared files] in the _{aws} SDKs and Tools Reference Guide_.
-* The shared `config` file sets the https://docs.aws.amazon.com/sdkref/latest/guide/feature-region.html[region] setting. This sets the default {aws} Region the {aws} CDK and CDK CLI use for {aws} requests.
-* The CDK CLI uses the profile's link:https://docs.aws.amazon.com/sdkref/latest/guide/feature-sso-credentials.html#feature-sso-credentials-profile[SSO token provider configuration] to acquire credentials before sending requests to {aws}. The `sso_role_name` value, which is an IAM role connected to an IAM Identity Center permission set, should allow access to the {aws} services used in your application.
-+
-The following sample `config` file shows a default profile set up with SSO token provider configuration. The profile's `sso_session` setting refers to the named link:https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html#section-session[`sso-session` section]. The `sso-session` section contains settings to initiate an {aws} access portal session.
-+
-[source,none,subs="verbatim,attributes"]
-----
-[default]
-sso_session =
-sso_account_id = \<111122223333>
-sso_role_name =
-region =
-output =
-
-[sso-session ]
-sso_region =
-sso_start_url =
-sso_registration_scopes = sso:account:access
-----
-
-[#accessportal]
-=== Start an {aws} access portal session
-
-Before accessing {aws} services, you need an active {aws} access portal session for the CDK CLI to use IAM Identity Center authentication to resolve credentials. Depending on your configured session lengths, your access will eventually expire and the CDK CLI will encounter an authentication error. Run the following command in the {aws} CLI to sign in to the {aws} access portal.
-
-[source,bash,subs="verbatim,attributes"]
-----
-aws sso login
-----
-
-If your SSO token provider configuration is using a named profile instead of the default profile, the command is `aws sso login --profile `. Also specify this profile when issuing `cdk` commands using the `--profile` option or the `AWS_PROFILE` environment variable.
-
-To test if you already have an active session, run the following {aws} CLI command.
-
-[source,bash,subs="verbatim,attributes"]
-----
-aws sts get-caller-identity
-----
-
-The response to this command should report the IAM Identity Center account and permission set configured in the shared `config` file.
-
-[NOTE]
-====
-
-If you already have an active {aws} access portal session and run `aws sso login`, you will not be required to provide credentials.
-
-The sign in process may prompt you to allow the {aws} CLI access to your data. Since the {aws} CLI is built on top of the SDK for Python, permission messages may contain variations of the `botocore` name.
-
-====
-
-[#cli-environment]
-== Specify Region and other configuration
-
-The CDK CLI needs to know the {aws} Region that you're deploying into and how to authenticate with {aws}. This is needed for deployment operations and to retrieve context values during synthesis. Together, your account and Region make up the _environment_.
-
-Region may be specified using environment variables or in configuration files. These are the same variables and files used by other {aws} tools such as the {aws} CLI and the various {aws} SDKs. The CDK CLI looks for this information in the following order.
-
-* The `AWS_DEFAULT_REGION` environment variable.
-* A named profile defined in the standard {aws} `config` file and specified using the `--profile` option on `cdk` commands.
-* The `[default]` section of the standard {aws} `config` file.
-
-Besides specifying {aws} authentication and a Region in the `[default]` section, you can also add one or more `[profile ]` sections, where `` is the name of the profile. For more information about named profiles, see https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html[Shared config and credentials files] in the _{aws} SDKs and Tools Reference Guide_.
-
-The standard {aws} `config` file is located at `~/.aws/config` (macOS/Linux) or `%USERPROFILE%\.aws\config` (Windows). For details and alternate locations, see https://docs.aws.amazon.com/sdkref/latest/guide/file-location.html[Location of the shared config and credentials files] in the _{aws} SDKs and Tools Reference Guide_
-
-The environment that you specify in your {aws} CDK app by using the stack's `env` property is used during synthesis. It's used to generate an environment-specific {aws} CloudFormation template, and during deployment, it overrides the account or Region specified by one of the preceding methods. For more information, see xref:environments[Environments for the {aws} CDK].
-
-[NOTE]
-====
-
-The {aws} CDK uses credentials from the same source files as other {aws} tools and SDKs, including the https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html[{aws} Command Line Interface]. However, the {aws} CDK might behave somewhat differently from these tools. It uses the {aws} SDK for JavaScript under the hood. For complete details on setting up credentials for the {aws} SDK for JavaScript, see https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials.html[Setting credentials].
-
-====
-
-You may optionally use the `--role-arn` (or `-r`) option to specify the ARN of an IAM role that should be used for deployment. This role must be assumable by the {aws} account being used.
-
-[#cli-app-command]
-== Specify the app command
-
-Many features of the CDK CLI require one or more {aws} CloudFormation templates be synthesized, which in turn requires running your application. The {aws} CDK supports programs written in a variety of languages. Therefore, it uses a configuration option to specify the exact command necessary to run your app. This option can be specified in two ways.
-
-First, and most commonly, it can be specified using the `app` key inside the file `cdk.json`. This is in the main directory of your {aws} CDK project. The CDK CLI provides an appropriate command when creating a new project with `cdk init`. Here is the `cdk.json` from a fresh TypeScript project, for instance.
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "npx ts-node bin/hello-cdk.ts"
-}
-----
-
-The CDK CLI looks for `cdk.json` in the current working directory when attempting to run your app. Because of this, you might keep a shell open in your project's main directory for issuing CDK CLI commands.
-
-The CDK CLI also looks for the app key in `~/.cdk.json` (that is, in your home directory) if it can't find it in `./cdk.json`. Adding the app command here can be useful if you usually work with CDK code in the same language.
-
-If you are in some other directory, or to run your app using a command other than the one in `cdk.json`, use the `--app` (or `-a`) option to specify it.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk --app "npx ts-node bin/hello-cdk.ts" ls
-----
-
-When deploying, you may also specify a directory containing synthesized cloud assemblies, such as `cdk.out`, as the value of `--app`. The specified stacks are deployed from this directory; the app is not synthesized.
-
-[#cli-stacks]
-== Specify stacks
-
-Many CDK CLI commands (for example, `cdk deploy`) work on stacks defined in your app. If your app contains only one stack, the CDK CLI assumes you mean that one if you don't specify a stack explicitly.
-
-Otherwise, you must specify the stack or stacks you want to work with. You can do this by specifying the desired stacks by ID individually on the command line. Recall that the ID is the value specified by the second argument when you instantiate the stack.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth PipelineStack LambdaStack
-----
-
-You may also use wildcards to specify IDs that match a pattern.
-
-* `?` matches any single character
-* `\*` matches any number of characters (`*` alone matches all stacks)
-* `**` matches everything in a hierarchy
-
-You may also use the `--all` option to specify all stacks.
-
-If your app uses xref:cdk-pipeline[CDK Pipelines], the CDK CLI understands your stacks and stages as a hierarchy. Also, the `--all` option and the `\*` wildcard only match top-level stacks. To match all the stacks, use ``\**``. Also use `**` to indicate all the stacks under a particular hierarchy.
-
-When using wildcards, enclose the pattern in quotes, or escape the wildcards with `\`. If you don't, your shell may try to expand the pattern to the names of files in the current directory. At best, this won't do what you expect; at worst, you could deploy stacks you didn't intend to. This isn't strictly necessary on Windows because `cmd.exe` does not expand wildcards, but is good practice nonetheless.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth "*Stack" # PipelineStack, LambdaStack, etc.
-cdk synth 'Stack?' # StackA, StackB, Stack1, etc.
-cdk synth \* # All stacks in the app, or all top-level stacks in a CDK Pipelines app
-cdk synth '**' # All stacks in a CDK Pipelines app
-cdk synth 'PipelineStack/Prod/**' # All stacks in Prod stage in a CDK Pipelines app
-----
-
-[NOTE]
-====
-
-The order in which you specify the stacks is not necessarily the order in which they will be processed. The CDK CLI accounts for dependencies between stacks when deciding the order in which to process them. For example, let's say that one stack uses a value produced by another (such as the ARN of a resource defined in the second stack). In this case, the second stack is synthesized before the first one because of this dependency. You can add dependencies between stacks manually using the stack's `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html#addwbrdependencytarget-reason[addDependency()]` method.
-
-====
-
-[#cli-bootstrap]
-== Bootstrap your {aws} environment
-
-Deploying stacks with the CDK requires special dedicated {aws} CDK resources to be provisioned. The `cdk bootstrap` command creates the necessary resources for you. You only need to bootstrap if you are deploying a stack that requires these dedicated resources. See xref:bootstrapping[{aws} CDK bootstrapping] for details.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk bootstrap
-----
-
-If issued with no arguments, as shown here, the `cdk bootstrap` command synthesizes the current app and bootstraps the environments its stacks will be deployed to. If the app contains environment-agnostic stacks, which don't explicitly specify an environment, the default account and Region are bootstrapped, or the environment specified using `--profile`.
-
-Outside of an app, you must explicitly specify the environment to be bootstrapped. You may also do so to bootstrap an environment that's not specified in your app or local {aws} profile. Credentials must be configured (e.g. in `~/.aws/credentials`) for the specified account and Region. You may specify a profile that contains the required credentials.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk bootstrap / # e.g.
-cdk bootstrap 1111111111/us-east-1
-cdk bootstrap --profile test 1111111111/us-east-1
-----
-
-[IMPORTANT]
-====
-
-Each environment (account/region combination) to which you deploy such a stack must be bootstrapped separately.
-
-====
-
-You may incur {aws} charges for what the {aws} CDK stores in the bootstrapped resources. Additionally, if you use `--bootstrap-customer-key`, an {aws} KMS key will be created, which also incurs charges per environment.
-
-[NOTE]
-====
-
-Earlier versions of the bootstrap template created a KMS key by default. To avoid charges, re-bootstrap using `--no-bootstrap-customer-key`.
-
-====
-
-[NOTE]
-====
-
-CDK CLI v2 does not support the original bootstrap template, dubbed the legacy template, used by default with CDK v1.
-
-====
-
-[IMPORTANT]
-====
-
-The modern bootstrap template effectively grants the permissions implied by the `--cloudformation-execution-policies` to any {aws} account in the `--trust` list. By default, this extends permissions to read and write to any resource in the bootstrapped account. Make sure to xref:bootstrapping-customizing[configure the bootstrapping stack] with policies and trusted accounts that you are comfortable with.
-
-====
-
-[#cli-init]
-== Create a new app
-
-To create a new app, create a directory for it, then, inside the directory, issue `cdk init`.
-
-[source,none,subs="verbatim,attributes"]
-----
-mkdir my-cdk-app
-cd my-cdk-app
-cdk init --language
-----
-
-The supported languages () are:
-
-[cols="1,1", options="header"]
-|===
-| Code
-| Language
-
-|`typescript`
-|TypeScript
-
-|`javascript`
-|JavaScript
-
-|`python`
-|Python
-
-|`java`
-|Java
-
-|`csharp`
-|C#
-
-|`Go`
-|Go
-|===
-
- is an optional template. If the desired template is _app_, the default, you may omit it. The available templates are:
-
-[cols="1,1", options="header"]
-|===
-| Template
-| Description
-
-|`app` (default)
-|Creates an empty {aws} CDK app.
-
-|`sample-app`
-|Creates an {aws} CDK app with a stack containing an Amazon SQS queue and an Amazon SNS topic.
-|===
-
-The templates use the name of the project folder to generate names for files and classes inside your new app.
-
-[#cli-list]
-== List stacks
-
-To see a list of the IDs of the stacks in your {aws} CDK application, enter one of the following equivalent commands:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk list
-cdk ls
-----
-
-If your application contains xref:cdk-pipeline[CDK Pipelines] stacks, the CDK CLI displays stack names as paths according to their location in the pipeline hierarchy. (For example, `PipelineStack`, `PipelineStack/Prod`, and `PipelineStack/Prod/MyService`.)
-
-If your app contains many stacks, you can specify full or partial stack IDs of the stacks to be listed. For more information, see xref:cli-stacks[Specify stacks].
-
-Add the `--long` flag to see more information about the stacks, including the stack names and their environments ({aws} account and Region).
-
-[#cli-synth]
-== Synthesize stacks
-
-The `cdk synthesize` command (almost always abbreviated `synth`) synthesizes a stack defined in your app into a CloudFormation template.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth # if app contains only one stack
-cdk synth MyStack
-cdk synth Stack1 Stack2
-cdk synth "*" # all stacks in app
-----
-
-[NOTE]
-====
-
-The CDK CLI actually runs your app and synthesizes fresh templates before most operations (such as when deploying or comparing stacks). These templates are stored by default in the `cdk.out` directory. The `cdk synth` command simply prints the generated templates for one or more specified stacks.
-
-====
-
-See `cdk synth --help` for all available options. A few of the most frequently used options are covered in the following section.
-
-[#cli-specify-context#]
-=== Specify context values
-
-Use the `--context` or `-c` option to pass xref:context[runtime context] values to your CDK app.
-
-[source,none,subs="verbatim,attributes"]
-----
-# specify a single context value
-cdk synth --context key=value MyStack
-
-# specify multiple context values (any number)
-cdk synth --context key1=value1 --context key2=value2 MyStack
-----
-
-When deploying multiple stacks, the specified context values are normally passed to all of them. If you want, you can specify different values for each stack by prefixing the stack name to the context value.
-
-[source,none,subs="verbatim,attributes"]
-----
-# different context values for each stack
-cdk synth --context Stack1:key=value Stack2:key=value Stack1 Stack2
-----
-
-[#cli-specify-format]
-=== Specify display format
-
-By default, the synthesized template is displayed in YAML format. Add the `--json` flag to display it in JSON format instead.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth --json MyStack
-----
-
-[#cli-specify-output]
-=== Specify the output directory
-
-Add the `--output` (`-o`) option to write the synthesized templates to a directory other than `cdk.out`.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth --output=~/templates
-----
-
-[#cli-deploy]
-== Deploy stacks
-
-The `cdk deploy` subcommand deploys one or more specified stacks to your {aws} account.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy # if app contains only one stack
-cdk deploy MyStack
-cdk deploy Stack1 Stack2
-cdk deploy "*" # all stacks in app
-----
-
-[NOTE]
-====
-
-The CDK CLI runs your app and synthesizes fresh {aws} CloudFormation templates before deploying anything. Therefore, most command line options you can use with `cdk synth` (for example, ``--context``) can also be used with `cdk deploy`.
-
-====
-
-See `cdk deploy --help` for all available options. A few of the most useful options are covered in the following section.
-
-[#cli-deploy-nosynth]
-=== Skip synthesis
-
-The `cdk deploy` command normally synthesizes your app's stacks before deploying to make sure that the deployment reflects the latest version of your app. If you know that you haven't changed your code since your last `cdk synth`, you can suppress the redundant synthesis step when deploying. To do so, specify your project's `cdk.out` directory in the `--app` option.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy --app cdk.out StackOne StackTwo
-----
-
-[#cli-deploy-norollback]
-=== Disable rollback
-
-{aws} CloudFormation has the ability to roll back changes so that deployments are atomic. This means that they either succeed or fail as a whole. The {aws} CDK inherits this capability because it synthesizes and deploys {aws} CloudFormation templates.
-
-Rollback makes sure that your resources are in a consistent state at all times, which is vital for production stacks. However, while you're still developing your infrastructure, some failures are inevitable, and rolling back failed deployments can slow you down.
-
-For this reason, the CDK CLI lets you disable rollback by adding `--no-rollback` to your `cdk deploy` command. With this flag, failed deployments are not rolled back. Instead, resources deployed before the failed resource remain in place, and the next deployment starts with the failed resource. You'll spend a lot less time waiting for deployments and a lot more time developing your infrastructure.
-
-[#cli-deploy-hotswap]
-=== Hot swapping
-
-Use the `--hotswap` flag with `cdk deploy` to attempt to update your {aws} resources directly instead of generating an {aws} CloudFormation change set and deploying it. Deployment falls back to {aws} CloudFormation deployment if hot swapping is not possible.
-
-Currently hot swapping supports Lambda functions, Step Functions state machines, and Amazon ECS container images. The `--hotswap` flag also disables rollback (i.e., implies `--no-rollback`).
-
-[IMPORTANT]
-====
-
-Hot-swapping is not recommended for production deployments.
-
-====
-
-[#cli-deploy-watch]
-=== Watch mode
-
-The CDK CLI's watch mode (`cdk deploy --watch`, or `cdk watch` for short) continuously monitors your CDK app's source files and assets for changes. It immediately performs a deployment of the specified stacks when a change is detected.
-
-By default, these deployments use the `--hotswap` flag, which fast-tracks deployment of changes to Lambda functions. It also falls back to deploying through {aws} CloudFormation if you have changed infrastructure configuration. To have `cdk watch` always perform full {aws} CloudFormation deployments, add the `--no-hotswap` flag to `cdk watch`.
-
-Any changes made while `cdk watch` is already performing a deployment are combined into a single deployment, which begins as soon as the in-progress deployment is complete.
-
-Watch mode uses the `"watch"` key in the project's `cdk.json` to determine which files to monitor. By default, these files are your application files and assets, but this can be changed by modifying the `"include"` and `"exclude"` entries in the `"watch"` key. The following `cdk.json` file shows an example of these entries.
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "mvn -e -q compile exec:java",
- "watch": {
- "include": "src/main/**",
- "exclude": "target/*"
- }
-}
-----
-
-`cdk watch` executes the `"build"` command from `cdk.json` to build your app before synthesis. If your deployment requires any commands to build or package your Lambda code (or anything else that's not in your CDK app), add it here.
-
-Git-style wildcards, both `\*` and `\**`, can be used in the `"watch"` and `"build"` keys. Each path is interpreted relative to the parent directory of `cdk.json`. The default value of `include` is ``\**/*``, meaning all files and directories in the project root directory. `exclude` is optional.
-
-[IMPORTANT]
-====
-
-Watch mode is not recommended for production deployments.
-
-====
-
-[#cli-specify-parameters]
-=== Specify {aws} CloudFormation parameters
-
-The CDK CLI supports specifying {aws} CloudFormation xref:parameters[parameters] at deployment. You may provide these on the command line following the `--parameters` flag.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy MyStack --parameters uploadBucketName=UploadBucket
-----
-
-To define multiple parameters, use multiple `--parameters` flags.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy MyStack --parameters uploadBucketName=UpBucket --parameters downloadBucketName=DownBucket
-----
-
-If you are deploying multiple stacks, you can specify a different value of each parameter for each stack. To do so, prefix the name of the parameter with the stack name and a colon. Otherwise, the same value is passed to all stacks.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy MyStack YourStack --parameters MyStack:uploadBucketName=UploadBucket --parameters YourStack:uploadBucketName=UpBucket
-----
-
-By default, the {aws} CDK retains values of parameters from previous deployments and uses them in later deployments if they are not specified explicitly. Use the `--no-previous-parameters` flag to require all parameters to be specified.
-
-[#cli-specify-outputs-file]
-=== Specify outputs file
-
-If your stack declares {aws} CloudFormation outputs, these are normally displayed on the screen at the conclusion of deployment. To write them to a file in JSON format, use the `--outputs-file` flag.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy --outputs-file outputs.json MyStack
-----
-
-[#cli-security]
-=== Approve security-related changes
-
-To protect you against unintended changes that affect your security posture, the CDK CLI prompts you to approve security-related changes before deploying them. You can specify the level of change that requires approval:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy --require-approval
-----
-
-`` can be one of the following:
-
-[cols="1,1", options="header"]
-|===
-| Term
-| Meaning
-
-|`never`
-|Approval is never required
-
-|`any-change`
-|Requires approval on any IAM or security-group-related change
-
-|`broadening` (default)
-|Requires approval when IAM statements or traffic rules are added; removals don't require approval
-|===
-
-The setting can also be configured in the `cdk.json` file.
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "...",
- "requireApproval": "never"
-}
-----
-
-[#cli-diff]
-== Compare stacks
-
-The `cdk diff` command compares the current version of a stack (and its dependencies) defined in your app with the already-deployed versions, or with a saved {aws} CloudFormation template, and displays a list of changes.
-
-----
-Stack HelloCdkStack
-IAM Statement Changes
-┌───┬──────────────────────────────┬────────┬──────────────────────────────┬──────────────────────────────┬───────────┐
-│ │ Resource │ Effect │ Action │ Principal │ Condition │
-├───┼──────────────────────────────┼────────┼──────────────────────────────┼──────────────────────────────┼───────────┤
-│ + │ ${Custom::S3AutoDeleteObject │ Allow │ sts:AssumeRole │ Service:lambda.amazonaws.com │ │
-│ │ sCustomResourceProvider/Role │ │ │ │ │
-│ │ .Arn} │ │ │ │ │
-├───┼──────────────────────────────┼────────┼──────────────────────────────┼──────────────────────────────┼───────────┤
-│ + │ ${MyFirstBucket.Arn} │ Allow │ s3:DeleteObject* │ {aws}:${Custom::S3AutoDeleteOb │ │
-│ │ ${MyFirstBucket.Arn}/* │ │ s3:GetBucket* │ jectsCustomResourceProvider/ │ │
-│ │ │ │ s3:GetObject* │ Role.Arn} │ │
-│ │ │ │ s3:List* │ │ │
-└───┴──────────────────────────────┴────────┴──────────────────────────────┴──────────────────────────────┴───────────┘
-IAM Policy Changes
-┌───┬────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────┐
-│ │ Resource │ Managed Policy ARN │
-├───┼────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────┤
-│ + │ ${Custom::S3AutoDeleteObjectsCustomResourceProvider/Ro │ {"Fn::Sub":"arn:${{aws}::Partition}:iam::aws:policy/serv │
-│ │ le} │ ice-role/AWSLambdaBasicExecutionRole"} │
-└───┴────────────────────────────────────────────────────────┴────────────────────────────────────────────────────────┘
-(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)
-
-Parameters
-[+] Parameter AssetParameters/4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392/S3Bucket AssetParameters4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392S3BucketBF7A7F3F: {"Type":"String","Description":"S3 bucket for asset \"4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392\""}
-[+] Parameter AssetParameters/4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392/S3VersionKey AssetParameters4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392S3VersionKeyFAF93626: {"Type":"String","Description":"S3 key for asset version \"4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392\""}
-[+] Parameter AssetParameters/4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392/ArtifactHash AssetParameters4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392ArtifactHashE56CD69A: {"Type":"String","Description":"Artifact hash for asset \"4cd61014b71160e8c66fe167e43710d5ba068b80b134e9bd84508cf9238b2392\""}
-
-Resources
-[+] {aws}::S3::BucketPolicy MyFirstBucket/Policy MyFirstBucketPolicy3243DEFD
-[+] Custom::S3AutoDeleteObjects MyFirstBucket/AutoDeleteObjectsCustomResource MyFirstBucketAutoDeleteObjectsCustomResourceC52FCF6E
-[+] {aws}::IAM::Role Custom::S3AutoDeleteObjectsCustomResourceProvider/Role CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092
-[+] {aws}::Lambda::Function Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F
-[~] {aws}::S3::Bucket MyFirstBucket MyFirstBucketB8884501
- ├─ [~] DeletionPolicy
- │ ├─ [-] Retain
- │ └─ [+] Delete
- └─ [~] UpdateReplacePolicy
- ├─ [-] Retain
- └─ [+] Delete
-----
-
-To compare your app's stacks with the existing deployment:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk diff MyStack
-----
-
-To compare your app's stacks with a saved CloudFormation template:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk diff --template ~/stacks/MyStack.old MyStack
-----
-
-[#cli-import]
-== Import existing resources into a stack
-
-You can use the `cdk import` command to bring resources under the management of CloudFormation for a particular {aws} CDK stack. This is useful if you are migrating to {aws} CDK, or are moving resources between stacks or changing their logical id. `cdk import` uses https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html[CloudFormation resource imports]. See the https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html[list of resources that can be imported here].
-
-To import an existing resource into a {aws} CDK stack, follow the following steps:
-
-* Make sure the resource is not currently being managed by any other CloudFormation stack. If it is, first set the removal policy to `RemovalPolicy.RETAIN` in the stack the resource is currently in and perform a deployment. Then, remove the resource from the stack and perform another deployment. This process will make sure that the resource is no longer managed by CloudFormation but does not delete it.
-* Run a `cdk diff` to make sure there are no pending changes to the {aws} CDK stack you want to import resources into. The only changes allowed in an "import" operation are the addition of new resources which you want to import.
-* Add constructs for the resources you want to import to your stack. For example, if you want to import an Amazon S3 bucket, add something like `new s3.Bucket(this, 'ImportedS3Bucket', {});`. Do not make any modifications to any other resource.
-+
-You must also make sure to exactly model the state that the resource currently has into the definition. For the example of the bucket, be sure to include {aws} KMS keys, life cycle policies, and anything else that's relevant about the bucket. If you do not, subsequent update operations may not do what you expect.
-+
-You can choose whether or not to include the physical bucket name. We usually recommend to not include resource names into your {aws} CDK resource definitions so that it becomes easier to deploy your resources multiple times.
-+
-* Run `cdk import `.
-* If the resource names are not in your model, the CLI will prompt you to pass in the actual names of the resources you are importing. After this, the import starts.
-* When `cdk import` reports success, the resource is now managed by {aws} CDK and CloudFormation. Any subsequent changes you make to the resource properties in your {aws} CDK app the construct configuration will be applied on the next deployment.
-* To confirm that the resource definition in your {aws} CDK app matches the current state of the resource, you can start an https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html[CloudFormation drift detection operation].
-
-This feature currently does not support importing resources into nested stacks.
-
-[#cli-config]
-== Configuration (`cdk.json`)
-
-Default values for many CDK CLI command line flags can be stored in a project's `cdk.json` file or in the `.cdk.json` file in your user directory. Following is an alphabetical reference to the supported configuration settings.
-
-[cols="1,1,1", options="header"]
-|===
-| Key
-| Notes
-| CDK CLI option
-
-|`app`
-|The command that executes the CDK application.
-|`--app`
-
-|`assetMetadata`
-|If `false`, CDK does not add metadata to resources that use assets.
-|`--no-asset-metadata`
-
-|`bootstrapKmsKeyId`
-|Overrides the ID of the {aws} KMS key used to encrypt the Amazon S3 deployment bucket.
-|`--bootstrap-kms-key-id`
-
-|`build`
-|The command that compiles or builds the CDK application before synthesis. Not permitted in `~/.cdk.json`.
-|`--build`
-
-|`browser`
-|The command for launching a Web browser for the `cdk docs` subcommand.
-|`--browser`
-
-|`context`
-|See xref:context[Context values and the {aws} CDK]. Context values in a configuration file will not be erased by `cdk context --clear`. (The CDK CLI places cached context values in `cdk.context.json`.)
-|`--context`
-
-|`debug`
-|If `true`, CDK CLI emits more detailed information useful for debugging.
-|`--debug`
-
-|`language`
-|The language to be used for initializing new projects.
-|`--language`
-
-|`lookups`
-|If `false`, no context lookups are permitted. Synthesis will fail if any context lookups need to be performed.
-|`--no-lookups`
-
-|`notices`
-|If `false`, suppresses the display of messages about security vulnerabilities, regressions, and unsupported versions.
-|`--no-notices`
-
-|`output`
-|The name of the directory into which the synthesized cloud assembly will be emitted (default `"cdk.out"`).
-|`--output`
-
-|`outputsFile`
-|The file to which {aws} CloudFormation outputs from deployed stacks will be written (in `JSON` format).
-|`--outputs-file`
-
-|`pathMetadata`
-|If `false`, CDK path metadata is not added to synthesized templates.
-|`--no-path-metadata`
-
-|`plugin`
-|JSON array specifying the package names or local paths of packages that extend the CDK
-|`--plugin`
-
-|`profile`
-|Name of the default {aws} profile used for specifying Region and account credentials.
-|`--profile`
-
-|`progress`
-|If set to `"events"`, the CDK CLI displays all {aws} CloudFormation events during deployment, rather than a progress bar.
-|`--progress`
-
-|`requireApproval`
-|Default approval level for security changes. See xref:cli-security[Approve security-related changes]
-|`--require-approval`
-
-|`rollback`
-|If `false`, failed deployments are not rolled back.
-|`--no-rollback`
-
-|`staging`
-|If `false`, assets are not copied to the output directory (use for local debugging of the source files with {aws} SAM).
-|`--no-staging`
-
-|`tags`
-|`JSON` object containing tags (key-value pairs) for the stack.
-|`--tags`
-
-|`toolkitBucketName`
-|The name of the Amazon S3 bucket used for deploying assets such as Lambda functions and container images (see xref:cli-bootstrap[Bootstrap your {aws} environment]).
-|`--toolkit-bucket-name`
-
-|`toolkitStackName`
-|The name of the bootstrap stack (see xref:cli-bootstrap[Bootstrap your {aws} environment]).
-|`--toolkit-stack-name`
-
-|`versionReporting`
-|If `false`, opts out of version reporting.
-|`--no-version-reporting`
-
-|`watch`
-|JSON object containing `"include"` and `"exclude"` keys that indicate which files should (or should not) trigger a rebuild of the project when changed. See xref:cli-deploy-watch[Watch mode].
-|`--watch`
-|===
\ No newline at end of file
diff --git a/v2/guide/compliance-validation.adoc b/v2/guide/compliance-validation.adoc
deleted file mode 100644
index 3e05b3a0..00000000
--- a/v2/guide/compliance-validation.adoc
+++ /dev/null
@@ -1,30 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#compliance-validation]
-= Compliance validation for the {aws} Cloud Development Kit ({aws} CDK)
-:info_titleabbrev: Compliance validation
-
-[abstract]
---
-Provides information about compliance validation for the {aws} CDK.
---
-
-// Content start
-
-The {aws} CDK follows the link:https://aws.amazon.com/compliance/shared-responsibility-model/[shared responsibility model] through the specific Amazon Web Services ({aws}) services it supports. For {aws} service security information, see the link:https://docs.aws.amazon.com/security/?id=docs_gateway#aws-security[{aws} service security documentation page] and link:https://aws.amazon.com/compliance/services-in-scope/[{aws} services that are in scope of {aws} compliance efforts by compliance program].
-
-The security and compliance of {aws} services is assessed by third-party auditors as part of multiple {aws} compliance programs. These include SOC, PCI, FedRAMP, HIPAA, and others. {aws} provides a frequently updated list of {aws} services in scope of specific compliance programs at link:https://aws.amazon.com/compliance/services-in-scope/[{aws} Services in Scope by Compliance Program].
-
-Third-party audit reports are available for you to download using {aws} Artifact. For more information, see link:https://docs.aws.amazon.com/artifact/latest/ug/downloading-documents.html[Downloading Reports in {aws} Artifact].
-
-For more information about {aws} compliance programs, see https://aws.amazon.com/compliance/programs/[{aws} Compliance Programs].
-
-Your compliance responsibility when using the {aws} CDK to access an {aws} service is determined by the sensitivity of your data, your organization's compliance objectives, and applicable laws and regulations. If your use of an {aws} service is subject to compliance with standards such as HIPAA, PCI, or FedRAMP, {aws} provides resources to help:
-
-* link:https://aws.amazon.com/quickstart/?quickstart-all.sort-by=item.additionalFields.updateDate&quickstart-all.sort-order=desc&awsf.quickstart-homepage-filter=categories%23security-identity-compliance[Security and Compliance Quick Start Guides] – Deployment guides that discuss architectural considerations and provide steps for deploying security-focused and compliance-focused baseline environments on {aws}.
-* link:https://aws.amazon.com/compliance/resources/[{aws} Compliance Resources] – A collection of workbooks and guides that might apply to your industry and location.
-* link:https://aws.amazon.com/config/[{aws} Config] – A service that assesses how well your resource configurations comply with internal practices, industry guidelines, and regulations.
-* link:https://aws.amazon.com/security-hub/[{aws} Security Hub] – A comprehensive view of your security state within {aws} that helps you check your compliance with security industry standards and best practices.
\ No newline at end of file
diff --git a/v2/guide/configure-access-sso-example-cli.adoc b/v2/guide/configure-access-sso-example-cli.adoc
deleted file mode 100644
index 0e395c0b..00000000
--- a/v2/guide/configure-access-sso-example-cli.adoc
+++ /dev/null
@@ -1,162 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#configure-access-sso-example-cli]
-= Example: Authenticate with IAM Identity Center automatic token refresh for use with the {aws} CDK CLI
-:info_titleabbrev: Example: Authenticate with IAM Identity Center automatic token refresh
-:keywords: {aws}, {aws} CDK, {aws} CDK CLI, Programmatic access, Security credentials, IAM, IAM Identity Center
-
-[abstract]
---
-In this example, we configure the {aws} Command Line Interface to authenticate our user with the {aws} IAM Identity Center token provider configuration. The SSO token provider configuration lets the {aws} CLI automatically retrieve refreshed authentication tokens to generate short-term credentials that we can use with the {aws} Cloud Development Kit ({aws} CDK) Command Line Interface ({aws} CDK CLI).
---
-
-// Content start
-
-In this example, we configure the {aws} Command Line Interface ({aws} CLI) to authenticate our user with the {aws} IAM Identity Center token provider configuration. The SSO token provider configuration lets the {aws} CLI automatically retrieve refreshed authentication tokens to generate short-term credentials that we can use with the {aws} Cloud Development Kit ({aws} CDK) Command Line Interface ({aws} CDK CLI).
-
-[#configure-access-sso-example-cli-prerequisites]
-== Prerequisites
-
-This example assumes that the following prerequisites have been completed:
-
-* Prerequisites required to get set up with {aws} and install our starting CLI tools. For more information, see xref:configure-access-prerequisites[Prerequisites].
-* IAM Identity Center has been set up by our organization as the method of managing users.
-* At least one user has been created in IAM Identity Center.
-
-[#configure-access-sso-example-cli-configure]
-== Step 1: Configure the {aws} CLI
-
-For detailed instructions on this step, see https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html[Configure the {aws} CLI to use IAM Identity Center token provider credentials with automatic authentication refresh] in the _{aws} Command Line Interface User Guide_.
-
-We sign in to the {aws} access portal provided by our organization to gather our IAM Identity Center information. This includes the *SSO start URL* and **SSO Region**.
-
-Next, we use the {aws} CLI `aws configure sso` command to configure an IAM Identity Center profile and `sso-session` on our local machine:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ aws configure sso
-SSO session name (Recommended):
-SSO start URL [None]:
-SSO region [None]:
-SSO registration scopes [sso:account:access]:
-----
-
-The {aws} CLI attempts to open our default browser to begin the login process for our IAM Identity Center account. If the {aws} CLI is unable to open our browser, instructions are provided to manually start the login process. This process associates the IAM Identity Center session with our current {aws} CLI session.
-
-After establishing our session, the {aws} CLI displays the {aws} accounts available to us:
-
-[source,none,subs="verbatim,attributes"]
-----
-There are 2 {aws} accounts available to you.
-> DeveloperAccount, developer-account-admin@example.com (<123456789011>)
- ProductionAccount, production-account-admin@example.com (<123456789022>)
-----
-
-We use the arrow keys to select our **DeveloperAccount**.
-
-Next, the {aws} CLI displays the IAM roles available to us from our selected account:
-
-[source,none,subs="verbatim,attributes"]
-----
-Using the account ID <123456789011>
-There are 2 roles available to you.
-> ReadOnly
- FullAccess
-----
-
-We use the arrow keys to select **FullAccess**.
-
-Next, the {aws} CLI prompts us to complete configuration by specifying a default output format, default {aws} Region, and name for our profile:
-
-[source,none,subs="verbatim,attributes"]
-----
-CLI default client Region [None]:
-CLI default output format [None]:
-CLI profile name [123456789011_FullAccess]:
-----
-
-The {aws} CLI displays a final message, showing how to use the named profile with the {aws} CLI:
-
-[source,none,subs="verbatim,attributes"]
-----
-To use this profile, specify the profile name using --profile, as shown:
-
-aws s3 ls --profile
-----
-
-After completing this step, our `config` file will look like the following:
-
-[source,none,subs="verbatim,attributes"]
-----
-[profile ]
-sso_session =
-sso_account_id = \<123456789011>
-sso_role_name =
-region =
-output =
-
-[sso-session ]
-sso_region =
-sso_start_url =
-sso_registration_scopes =
-----
-
-We can now use this `sso-session` and named profile to request security credentials.
-
-[#configure-access-sso-example-cli-credentials]
-== Step 2: Use the {aws} CLI to generate security credentials
-
-For detailed instructions on this step, see https://docs.aws.amazon.com/cli/latest/userguide/sso-using-profile.html[Use an IAM Identity Center named profile] in the _{aws} Command Line Interface User Guide_.
-
-We use the {aws} CLI `aws sso login` command to request security credentials for our profile:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ aws sso login --profile
-----
-
-The {aws} CLI attempts to open our default browser and verifies our IAM log in. If we are not currently signed into IAM Identity Center, we will be prompted to complete the sign in process. If the {aws} CLI is unable to open our browser, instructions are provided to manually start the authorization process.
-
-After successfully logging in, the {aws} CLI caches our IAM Identity Center session credentials. These credentials include an expiration timestamp. When they expire, the {aws} CLI will request that we sign in to IAM Identity Center again.
-
-Using valid IAM Identity Center credentials, the {aws} CLI securely retrieves {aws} credentials for the IAM role specified in our profile. From here, we can use the {aws} CDK CLI with our credentials.
-
-[#configure-access-sso-example-cli-cdk]
-== Step 3: Use the CDK CLI
-
-With any CDK CLI command, we use the ``xref:ref-cli-cmd-options-profile[--profile]`` option to specify the named profile that we generated credentials for. If our credentials are valid, the CDK CLI will successfully perform the command. The following is an example:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk diff --profile
-Stack CdkAppStack
-Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)
-Resources
-[-] {aws}::S3::Bucket amzn-s3-demo-bucket amzn-s3-demo-bucket5AF9C99B destroy
-
-Outputs
-[-] Output BucketRegion: {"Value":{"Ref":"{aws}::Region"}}
-
-
-✨ Number of stacks with differences: 1
-----
-
-When our credentials expire, an error message like the following will display:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk diff --profile
-Stack CdkAppStack
-
-Unable to resolve {aws} account to use. It must be either configured when you define your CDK Stack, or through the environment
-----
-
-To refresh our credentials, we use the {aws} CLI `aws sso login` command:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ aws sso login --profile
-----
\ No newline at end of file
diff --git a/v2/guide/configure-access.adoc b/v2/guide/configure-access.adoc
deleted file mode 100644
index a06b300f..00000000
--- a/v2/guide/configure-access.adoc
+++ /dev/null
@@ -1,92 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#configure-access]
-= Configure security credentials for the {aws} CDK CLI
-:info_titleabbrev: Configure security credentials
-:keywords: {aws}, {aws} CDK, {aws} CDK CLI, Programmatic access, Security credentials, IAM, IAM Identity Center
-
-[abstract]
---
-When you use the {aws} Cloud Development Kit ({aws} CDK) to develop applications in your local environment, you will primarily use the {aws} CDK CLI to interact with {aws} to deploy and manage your CDK stacks. To use the CDK CLI, you must configure security credentials.
---
-
-// Content start
-
-When you use the {aws} Cloud Development Kit ({aws} CDK) to develop applications in your local environment, you will primarily use the {aws} CDK Command Line Interface ({aws} CDK CLI) to interact with {aws}. For example, you can use the CDK CLI to deploy your application or to delete your resources from your {aws} environment.
-
-To use the CDK CLI to interact with {aws}, you must configure security credentials on your local machine. This lets {aws} know who you are and what permissions you have.
-
-To learn more about security credentials, see https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html[{aws} security credentials] in the _IAM User Guide_.
-
-[#configure-access-prerequisites,]
-== Prerequisites
-
-Configuring security credentials is part of the _getting started_ process. Complete all prerequisites and previous steps at xref:getting-started[Getting started with the {aws} CDK].
-
-[#configure-access-how]
-== How to configure security credentials
-
-How you configure security credentials depends on how you or your organization manages users. Whether you use {aws} Identity and Access Management (IAM) or {aws} IAM Identity Center, we recommend that you use the {aws} Command Line Interface ({aws} CLI) to configure and manage security credentials for the CDK CLI. This includes using {aws} CLI commands like `aws configure` to configure security credentials on your local machine. However, you can use alternative methods such as manually updating your `config` and `credentials` files, or setting environment variables.
-
-For guidance on configuring security credentials using the {aws} CLI, along with information on configuration and credential precedence when using different methods, see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-authentication.html[Authentication and access credentials] in the _{aws} Command Line Interface User Guide_. The CDK CLI adheres to the same configuration and credential precedence of the {aws} CLI. The `--profile` command line option takes precedence over environment variables. If you have both the `AWS_PROFILE` and `CDK_DEFAULT_PROFILE` environment variables configured, the `AWS_PROFILE` environment variable takes precedence.
-
-If you configure multiple profiles, you can use the CDK CLI ``xref:ref-cli-cmd-options-profile[--profile]`` option with any command to specify the profile from your `credentials` and `config` files to use for authentication. If you don't provide `--profile`, the `default` profile will be used.
-
-If you prefer to quickly configure basic settings, including security credentials, see https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html[Set up the {aws} CLI] in the _{aws} Command Line Interface User Guide_.
-
-Once you've configured security credentials on your local machine, you can use the CDK CLI to interact with {aws}.
-
-[#configure-access-sso]
-== Configure and manage security credentials for IAM Identity Center users
-
-IAM Identity Center users can authenticate with IAM Identity Center or manually by using short-term credentials.
-
-[#configure-access-sso-auto]
-*Authenticate with IAM Identity Center to generate short-term credentials*::
-+
-You can configure the {aws} CLI to authenticate with IAM Identity Center. This is the recommended approach of configuring security credentials for IAM Identity Center users. IAM Identity Center users can use the {aws} CLI `aws configure sso` wizard to configure an IAM Identity Center profile and `sso-session`, which gets stored in the `config` file on your local machine. For instructions, see https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html[Configure the {aws} CLI to use {aws} IAM Identity Center] in the _{aws} Command Line Interface User Guide_.
-+
-Next, you can use the {aws} CLI `aws sso login` command to request refreshed credentials. You can also use this command to switch profiles. For instructions, see https://docs.aws.amazon.com/cli/latest/userguide/sso-using-profile.html[Use an IAM Identity Center named profile] in the _{aws} Command Line Interface User Guide_.
-+
-Once authenticated, you can use the CDK CLI to interact with {aws} for the duration of your session. For an example, see xref:configure-access-sso-example-cli[Example: Authenticate with IAM Identity Center automatic token refresh for use with the {aws} CDK CLI].
-
-[#configure-access-sso-manual]
-*Manually configure short-term credentials*::
-+
-As an alternative to using the {aws} CLI and authenticating with IAM Identity Center, IAM Identity Center users can obtain short-term credentials from the {aws} Management Console and manually configure the `credentials` and `config` files on their local machine. Once configured, you can use the CDK CLI to interact with {aws} until your credentials expire. For instructions, see https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-short-term.html[Authenticate with short-term credentials] in the _{aws} Command Line Interface User Guide_.
-
-[#configure-access-iam]
-== Configure and manage security credentials for IAM users
-
-IAM users can use an IAM role or IAM user credentials with the CDK CLI.
-
-[#configure-access-iam-role]
-*Use an IAM role to configure short-term credentials*::
-+
-IAM users can assume IAM roles to gain additional (or different) permissions. For IAM users, this is the recommended approach since it provides short-term credentials.
-+
-First, the IAM role and user's permission to assume the role must be configured. This is typically performed by an administrator using the {aws} Management Console or {aws} CLI. Then, the IAM user can use the {aws} CLI to assume the role and configure short-term credentials on their local machine. For instructions, see https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html[Use an IAM role in the {aws} CLI] in the _{aws} Command Line Interface User Guide_.
-
-[#configure-access-iam-user]
-*Use IAM user credentials*::
-+
-[WARNING]
-====
-
-To avoid security risks, we don't recommend using IAM user credentials since they provide long-term access. If you must use long-term credentials, we recommend that you link:https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#rotate-credentials[update access keys] as an IAM security best practice.
-
-====
-+
-IAM users can obtain access keys from the {aws} Management Console. You can then use the {aws} CLI to configure long-term credentials on your local machine. For instructions, see https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-user.html[Authenticate with IAM user credentials] in the _{aws} Command Line Interface User Guide_.
-
-[#configure-access-info,]
-== Additional information
-
-To learn about the different ways that you can sign in to {aws}, depending on the type of user you are, see https://docs.aws.amazon.com/signin/latest/userguide/what-is-sign-in.html[What is {aws} Sign-In?] in the _{aws} Sign-In User Guide_.
-
-For reference information when using {aws} SDKs and tools, including the {aws} CLI, see the https://docs.aws.amazon.com/sdkref/latest/guide/overview.html[{aws} SDKs and Tools Reference Guide].
-
-include::configure-access-sso-example-cli.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/configure-env.adoc b/v2/guide/configure-env.adoc
deleted file mode 100644
index c3f09ec4..00000000
--- a/v2/guide/configure-env.adoc
+++ /dev/null
@@ -1,722 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#configure-env]
-= Configure environments to use with the {aws} CDK
-:info_titleabbrev: Configure environments
-:keywords: {aws} CDK, {aws} environments, environments, {aws} account, {aws} Region, env
-
-[abstract]
---
-You can configure {aws} environments in multiple ways to use with the {aws} Cloud Development Kit ({aws} CDK). The best method of managing {aws} environments will vary, based on your specific needs.
---
-
-// Content start
-
-You can configure {aws} environments in multiple ways to use with the {aws} Cloud Development Kit ({aws} CDK). The best method of managing {aws} environments will vary, based on your specific needs.
-
-Each CDK stack in your application must eventually be associated with an environment to determine where the stack gets deployed to.
-
-For an introduction to {aws} environments, see xref:environments[Environments for the {aws} CDK].
-
-[#configure-env-where]
-== Where you can specify environments from
-
-You can specify environments in credentials and configuration files, or by using the `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html#env[env]` property of the `Stack` construct from the {aws} Construct Library.
-
-[#configure-env-where-files]
-=== Credentials and configuration files
-
-You can use the {aws} Command Line Interface ({aws} CLI) to create `credentials` and `config` files that store, organize, and manage your {aws} environment information. To learn more about these files, see https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html[Configuration and credential file settings] in the _{aws} Command Line Interface User Guide_.
-
-Values stored in these files are organized by _profiles_. How you name your profiles and the key-value pairs in these files will vary based on your method of configuring programmatic access. To learn more about the different methods, see xref:configure-access[Configure security credentials for the {aws} CDK CLI].
-
-In general, the {aws} CDK resolves {aws} account information from your `credentials` file and {aws} Region information from your `config` file.
-
-Once you have your `credentials` and `config` files configured, you can specify the environment to use with the {aws} CDK CLI and through environment variables.
-
-[#configure-env-where-env]
-=== env property of the Stack construct
-
-You can specify the environment for each stack by using the `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html#env[env]` property of the `Stack` construct. This property defines an account and Region to use. You can pass hard-coded values to this property or pass environment variables that are offered by the CDK.
-
-To pass environment variables, use the `AWS_DEFAULT_ACCOUNT` and `AWS_DEFAULT_REGION` environment variables. These environment variables can pass values from your `credentials` and `config` files. You can also use logic within your CDK code to determine the values of these environment variables.
-
-[#configure-env-precedence]
-== Environment precedence with the {aws} CDK
-
-If you use multiple methods of specifying environments, the {aws} CDK adheres to the following precedence:
-
-. Hard-coded values specified with the `env` property of the `Stack` construct.
-. `AWS_DEFAULT_ACCOUNT` and `AWS_DEFAULT_REGION` environment variables specified with the `env` property of the `Stack` construct.
-. Environment information associated with the profile from your `credentials` and `config` files and passed to the CDK CLI using the `--profile` option.
-. The `default` profile from your `credentials` and `config` files.
-
-[#configure-env-when]
-== When to specify environments
-
-When you develop with the CDK, you start by defining CDK stacks, which contain constructs that represent {aws} resources. Next, you synthesize each CDK stack into an {aws} CloudFormation template. You then deploy the CloudFormation template to your environment. How you specify environments determines when your environment information gets applied and can affect CDK behavior and outcomes.
-
-[#configure-env-when-synth]
-=== Specify environments at template synthesis
-
-When you specify environment information using the `env` property of the `Stack` construct, your environment information is applied at template synthesis. Running `cdk synth` or `cdk deploy` produces an environment-specific CloudFormation template.
-
-If you use environment variables within the `env` property, you must use the `--profile` option with CDK CLI commands to pass in the profile containing your environment information from your credentials and configuration files. This information will then be applied at template synthesis to produce an environment-specific template.
-
-Environment information within the CloudFormation template takes precedence over other methods. For example, if you provide a different environment with `cdk deploy --profile `, the profile will be ignored.
-
-When you provide environment information in this way, you can use environment-dependent code and logic within your CDK app. This also means that the synthesized template could be different, based on the machine, user, or session that it's synthesized under. This approach is often acceptable or desirable during development, but is not recommended for production use.
-
-[#configure-env-when-deploy,]
-=== Specify environments at stack deployment
-
-If you don't specify an environment using the `env` property of the `Stack` construct, the CDK CLI will produce an environment-agnostic CloudFormation template at synthesis. You can then specify the environment to deploy to by using `cdk deploy --profile `.
-
-If you don't specify a profile when deploying an environment-agnostic template, the CDK CLI will attempt to use environment values from the `default` profile of your `credentials` and `config` files at deployment.
-
-If environment information is not available at deployment, {aws} CloudFormation will attempt to resolve environment information at deployment through environment-related attributes such as `stack.account`, `stack.region`, and `stack.availabilityZones`.
-
-For environment-agnostic stacks, constructs within the stack cannot use environment information and you cannot use logic that requires environment information. For example, you cannot write code like `if (stack.region ==== 'us-east-1')` or use construct methods that require environment information such as `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html#static-fromwbrlookupscope-id-options[Vpc.fromLookup]`. To use these features, you must specify an environment with the `env` property.
-
-For environment-agnostic stacks, any construct that uses Availability Zones will see two Availability Zones, allowing the stack to be deployed to any Region.
-
-[#configure-env-how]
-== How to specify environments with the {aws} CDK
-
-[#configure-env-how-hard-coded]
-=== Specify hard-coded environments for each stack
-
-Use the `env` property of the `Stack` construct to specify {aws} environment values for your stack. The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const envEU = { account: '2383838383', region: 'eu-west-1' };
-const envUSA = { account: '8373873873', region: 'us-west-2' };
-
-new MyFirstStack(app, 'first-stack-us', { env: envUSA });
-new MyFirstStack(app, 'first-stack-eu', { env: envEU });
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const envEU = { account: '2383838383', region: 'eu-west-1' };
-const envUSA = { account: '8373873873', region: 'us-west-2' };
-
-new MyFirstStack(app, 'first-stack-us', { env: envUSA });
-new MyFirstStack(app, 'first-stack-eu', { env: envEU });
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-env_EU = cdk.Environment(account="8373873873", region="eu-west-1")
-env_USA = cdk.Environment(account="2383838383", region="us-west-2")
-
-MyFirstStack(app, "first-stack-us", env=env_USA)
-MyFirstStack(app, "first-stack-eu", env=env_EU)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class MyApp {
-
- // Helper method to build an environment
- static Environment makeEnv(String account, String region) {
- return Environment.builder()
- .account(account)
- .region(region)
- .build();
- }
-
- public static void main(final String argv[]) {
- App app = new App();
-
- Environment envEU = makeEnv("8373873873", "eu-west-1");
- Environment envUSA = makeEnv("2383838383", "us-west-2");
-
- new MyFirstStack(app, "first-stack-us", StackProps.builder()
- .env(envUSA).build());
- new MyFirstStack(app, "first-stack-eu", StackProps.builder()
- .env(envEU).build());
-
- app.synth();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-Amazon.CDK.Environment makeEnv(string account, string region)
-{
- return new Amazon.CDK.Environment
- {
- Account = account,
- Region = region
- };
-}
-
-var envEU = makeEnv(account: "8373873873", region: "eu-west-1");
-var envUSA = makeEnv(account: "2383838383", region: "us-west-2");
-
-new MyFirstStack(app, "first-stack-us", new StackProps { Env=envUSA });
-new MyFirstStack(app, "first-stack-eu", new StackProps { Env=envEU });
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-env_EU := awscdk.Environment{
- Account: jsii.String("8373873873"),
- Region: jsii.String("eu-west-1"),
-}
-
-env_USA := awscdk.Environment{
- Account: jsii.String("2383838383"),
- Region: jsii.String("us-west-2"),
-}
-
-MyFirstStack(app, "first-stack-us", &awscdk.StackProps{
- Env: &env_USA,
-})
-
-MyFirstStack(app, "first-stack-eu", &awscdk.StackProps{
- Env: &env_EU,
-})
-----
-====
-
-We recommend this approach for production environments. By explicitly specifying the environment in this way, you can ensure that the stack is always deployed to the specific environment.
-
-[#configure-env-how-env]
-=== Specify environments using environment variables
-
-The {aws} CDK provides two environment variables that you can use within your CDK code: `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION`. When you use these environment variables within the `env` property of your stack instance, you can pass environment information from your credentials and configuration files using the CDK CLI `--profile` option.
-
-The following is an example of how to specify these environment variables:
-
-====
-[role="tablist"]
-TypeScript::
-Access environment variables via Node's `process` object.
-+
-[NOTE]
---
-You need the `DefinitelyTyped` module to use `process` in TypeScript. `cdk init` installs this module for you. However, you should install this module manually if you are working with a project created before it was added, or if you didn't set up your project using `cdk init`.
-
-[source,none,subs="verbatim,attributes"]
-----
-npm install @types/node
-----
---
-+
-
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyDevStack(app, 'dev', {
- env: {
- account: process.env.CDK_DEFAULT_ACCOUNT,
- region: process.env.CDK_DEFAULT_REGION
-}});
-----
-
-JavaScript::
-Access environment variables via Node's `process` object.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyDevStack(app, 'dev', {
- env: {
- account: process.env.CDK_DEFAULT_ACCOUNT,
- region: process.env.CDK_DEFAULT_REGION
-}});
-----
-
-Python::
-Use the `os` module's `environ` dictionary to access environment variables.
-+
-[source,python,subs="verbatim,attributes"]
-----
-import os
-MyDevStack(app, "dev", env=cdk.Environment(
- account=os.environ["CDK_DEFAULT_ACCOUNT"],
- region=os.environ["CDK_DEFAULT_REGION"]))
-----
-
-Java::
-Use `System.getenv()` to get the value of an environment variable.
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class MyApp {
-
- // Helper method to build an environment
- static Environment makeEnv(String account, String region) {
- account = (account == null) ? System.getenv("CDK_DEFAULT_ACCOUNT") : account;
- region = (region == null) ? System.getenv("CDK_DEFAULT_REGION") : region;
-
- return Environment.builder()
- .account(account)
- .region(region)
- .build();
- }
-
- public static void main(final String argv[]) {
- App app = new App();
-
- Environment envEU = makeEnv(null, null);
- Environment envUSA = makeEnv(null, null);
-
- new MyDevStack(app, "first-stack-us", StackProps.builder()
- .env(envUSA).build());
- new MyDevStack(app, "first-stack-eu", StackProps.builder()
- .env(envEU).build());
-
- app.synth();
- }
-}
-----
-
-C#::
-Use `System.Environment.GetEnvironmentVariable()` to get the value of an environment variable.
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-Amazon.CDK.Environment makeEnv(string account=null, string region=null)
-{
- return new Amazon.CDK.Environment
- {
- Account = account ?? System.Environment.GetEnvironmentVariable("CDK_DEFAULT_ACCOUNT"),
- Region = region ?? System.Environment.GetEnvironmentVariable("CDK_DEFAULT_REGION")
- };
-}
-
-new MyDevStack(app, "dev", new StackProps { Env = makeEnv() });
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import "os"
-
-MyDevStack(app, "dev", &awscdk.StackProps{
- Env: &awscdk.Environment{
- Account: jsii.String(os.Getenv("CDK_DEFAULT_ACCOUNT")),
- Region: jsii.String(os.Getenv("CDK_DEFAULT_REGION")),
- },
-})
-----
-====
-
-By specifying environments using environment variables, you can have the same CDK stack synthesize to {aws} CloudFormation templates for different environments. This means that you can deploy the same CDK stack to different {aws} environments without having to modify your CDK code. You only have to specify the profile to use when running `cdk synth`.
-
-This approach is great for development environments when deploying the same stack to different environments. However, we do not recommend this approach for production environments since the same CDK code can synthesize different templates, depending on the machine, user, or session that it's synthesized under.
-
-[#configure-env-how-files]
-=== Specify environments from your credentials and configuration files with the CDK CLI
-
-When deploying an environment-agnostic template, use the `--profile` option with any CDK CLI command to specify the profile to use. The following is an example that deploys a CDK stack named `myStack` using the `prod` profile that is defined in the `credentials` and `config` files:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk deploy --profile
-----
-
-For more information on the `--profile` option, along with other CDK CLI commands and options, see xref:ref-cli-cmd[{aws} CDK CLI command reference].
-
-[#configure-env-considerations]
-== Considerations when configuring environments with the {aws} CDK
-
-Services that you define by using constructs within your stacks must support the Region that you are deploying to. For a list of supported {aws} services per region, see https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/[{aws} Services by Region].
-
-You must have valid {aws} Identity and Access Management (IAM) credentials to perform stack deployments with the {aws} CDK into your specified environments.
-
-[#configure-env-examples]
-== Examples
-
-[#configure-env-examples-agnostic]
-=== Synthesize an environment–agnostic CloudFormation template from a CDK stack
-
-In this example, we create an environment-agnostic CloudFormation template from our CDK stack. We can then deploy this template to any environment.
-
-The following is our example CDK stack. This stack defines an Amazon S3 bucket and a CloudFormation stack output for the bucket's Region. For this example, `env` is not defined:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-export class CdkAppStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Create the S3 bucket
- const bucket = new s3.Bucket(this, 'amzn-s3-demo-bucket', {
- removalPolicy: cdk.RemovalPolicy.DESTROY,
- });
-
- // Create an output for the bucket's Region
- new cdk.CfnOutput(this, 'BucketRegion', {
- value: bucket.env.region,
- });
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-class CdkAppStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // Create the S3 bucket
- const bucket = new s3.Bucket(this, 'amzn-s3-demo-bucket', {
- removalPolicy: cdk.RemovalPolicy.DESTROY,
- });
-
- // Create an output for the bucket's Region
- new cdk.CfnOutput(this, 'BucketRegion', {
- value: bucket.env.region,
- });
- }
-}
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-class CdkAppStack(cdk.Stack):
-
- def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
- super().__init__(scope, id, **kwargs)
-
- # Create the S3 bucket
- bucket = s3.Bucket(self, 'amzn-s3-demo-bucket',
- removal_policy=cdk.RemovalPolicy.DESTROY
- )
-
- # Create an output for the bucket's Region
- cdk.CfnOutput(self, 'BucketRegion',
- value=bucket.env.region
- )
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class CdkAppStack extends Stack {
-
- public CdkAppStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- // Create the S3 bucket
- Bucket bucket = Bucket.Builder.create(this, "amzn-s3-demo-bucket")
- .removalPolicy(RemovalPolicy.DESTROY)
- .build();
-
- // Create an output for the bucket's Region
- CfnOutput.Builder.create(this, "BucketRegion")
- .value(this.getRegion())
- .build();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-namespace MyCdkApp
-{
- public class CdkAppStack : Stack
- {
- public CdkAppStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- // Create the S3 bucket
- var bucket = new Bucket(this, "amzn-s3-demo-bucket", new BucketProps
- {
- RemovalPolicy = RemovalPolicy.DESTROY
- });
-
- // Create an output for the bucket's Region
- new CfnOutput(this, "BucketRegion", new CfnOutputProps
- {
- Value = this.Region
- });
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-func NewCdkAppStack(scope constructs.Construct, id string, props *CdkAppStackProps) awscdk.Stack {
- stack := awscdk.NewStack(scope, &id, &props.StackProps)
-
- // Create the S3 bucket
- bucket := awss3.NewBucket(stack, jsii.String("amzn-s3-demo-bucket"), &awss3.BucketProps{
- RemovalPolicy: awscdk.RemovalPolicy_DESTROY,
- })
-
- // Create an output for the bucket's Region
- awscdk.NewCfnOutput(stack, jsii.String("BucketRegion"), &awscdk.CfnOutputProps{
- Value: stack.Region(),
- })
-
- return stack
-}
-----
-====
-
-When we run `cdk synth`, the CDK CLI produces a CloudFormation template with the pseudo parameter `{aws}::Region` as the output value for the bucket's Region. This parameter will be resolved at deployment:
-
-[source,yaml,subs="verbatim,attributes"]
-----
-Outputs:
- BucketRegion:
- Value:
- Ref: {aws}::Region
-----
-
-To deploy this stack to an environment that is specified in the `dev` profile of our credentials and configuration files, we run the following:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk deploy CdkAppStack --profile dev
-----
-
-If we don't specify a profile, the CDK CLI will attempt to use environment information from the `default` profile in our credentials and configuration files.
-
-[#configure-env-example-logic]
-=== Use logic to determine environment information at template synthesis
-
-In this example, we configure the `env` property of our `stack` instance to use a valid expression. We specify two additional environment variables, `CDK_DEPLOY_ACCOUNT` and `CDK_DEPLOY_REGION`. These environment variables can override defaults at synthesis time if they exist:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyDevStack(app, 'dev', {
- env: {
- account: process.env.CDK_DEPLOY_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT,
- region: process.env.CDK_DEPLOY_REGION || process.env.CDK_DEFAULT_REGION
-}});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyDevStack(app, 'dev', {
- env: {
- account: process.env.CDK_DEPLOY_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT,
- region: process.env.CDK_DEPLOY_REGION || process.env.CDK_DEFAULT_REGION
-}});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-MyDevStack(app, "dev", env=cdk.Environment(
- account=os.environ.get("CDK_DEPLOY_ACCOUNT", os.environ["CDK_DEFAULT_ACCOUNT"]),
- region=os.environ.get("CDK_DEPLOY_REGION", os.environ["CDK_DEFAULT_REGION"])
- )
-)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class MyApp {
-
- // Helper method to build an environment
- static Environment makeEnv(String account, String region) {
- account = (account == null) ? System.getenv("CDK_DEPLOY_ACCOUNT") : account;
- region = (region == null) ? System.getenv("CDK_DEPLOY_REGION") : region;
- account = (account == null) ? System.getenv("CDK_DEFAULT_ACCOUNT") : account;
- region = (region == null) ? System.getenv("CDK_DEFAULT_REGION") : region;
-
- return Environment.builder()
- .account(account)
- .region(region)
- .build();
- }
-
- public static void main(final String argv[]) {
- App app = new App();
-
- Environment envEU = makeEnv(null, null);
- Environment envUSA = makeEnv(null, null);
-
- new MyDevStack(app, "first-stack-us", StackProps.builder()
- .env(envUSA).build());
- new MyDevStack(app, "first-stack-eu", StackProps.builder()
- .env(envEU).build());
-
- app.synth();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-Amazon.CDK.Environment makeEnv(string account=null, string region=null)
-{
- return new Amazon.CDK.Environment
- {
- Account = account ??
- System.Environment.GetEnvironmentVariable("CDK_DEPLOY_ACCOUNT") ??
- System.Environment.GetEnvironmentVariable("CDK_DEFAULT_ACCOUNT"),
- Region = region ??
- System.Environment.GetEnvironmentVariable("CDK_DEPLOY_REGION") ??
- System.Environment.GetEnvironmentVariable("CDK_DEFAULT_REGION")
- };
-}
-
-new MyDevStack(app, "dev", new StackProps { Env = makeEnv() });
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-var account, region string
-var b bool
-
-if account, b = os.LookupEnv("CDK_DEPLOY_ACCOUNT"); !b || len(account) == 0 {
- account = os.Getenv("CDK_DEFAULT_ACCOUNT")
-}
-if region, b = os.LookupEnv("CDK_DEPLOY_REGION"); !b || len(region) == 0 {
- region = os.Getenv("CDK_DEFAULT_REGION")
-}
-
-MyDevStack(app, "dev", &awscdk.StackProps{
- Env: &awscdk.Environment{
- Account: &account,
- Region: ®ion,
- },
-})
-----
-====
-
-With our stack`'s environment declared this way, we can then write a short script or batch file and set variables from command line arguments, then call ``cdk deploy``. The following is an example. Any arguments beyond the first two are passed through to `cdk deploy` to specify command line options or arguments:
-
-====
-[role="tablist"]
-macOS/Linux::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-#!/usr/bin/env bash
-if [[ $# -ge 2 ]]; then
- export CDK_DEPLOY_ACCOUNT=$1
- export CDK_DEPLOY_REGION=$2
- shift; shift
- npx cdk deploy "$@"
- exit $?
-else
- echo 1>&2 "Provide account and region as first two args."
- echo 1>&2 "Additional args are passed through to cdk deploy."
- exit 1
-fi
-----
-+
-Save the script as `cdk-deploy-to.sh`, then execute `chmod +x cdk-deploy-to.sh` to make it executable.
-
-Windows::
-+
-[source,bat,subs="verbatim,attributes"]
-----
-@findstr /B /V @ %~dpnx0 > %~dpn0.ps1 && powershell -ExecutionPolicy Bypass %~dpn0.ps1 %*
-@exit /B %ERRORLEVEL%
-if ($args.length -ge 2) {
- $env:CDK_DEPLOY_ACCOUNT, $args = $args
- $env:CDK_DEPLOY_REGION, $args = $args
- npx cdk deploy $args
- exit $lastExitCode
-} else {
- [console]::error.writeline("Provide account and region as first two args.")
- [console]::error.writeline("Additional args are passed through to cdk deploy.")
- exit 1
-}
-----
-+
-The Windows version of the script uses PowerShell to provide the same functionality as the macOS/Linux version. It also contains instructions to allow it to be run as a batch file so it can be easily invoked from a command line. It should be saved as `cdk-deploy-to.bat`. The file `cdk-deploy-to.ps1` will be created when the batch file is invoked.
-
-====
-
-We can then write additional scripts that use the `cdk-deploy-to` script to deploy to specific environments. The following is an example:
-
-====
-[role="tablist"]
-macOS/Linux::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-#!/usr/bin/env bash
-# cdk-deploy-to-test.sh
-./cdk-deploy-to.sh 123457689 us-east-1 "$@"
-----
-
-Windows::
-+
-[source,bat,subs="verbatim,attributes"]
-----
-@echo off
-rem cdk-deploy-to-test.bat
-cdk-deploy-to 135792469 us-east-1 %*
-----
-====
-
-The following is an example that uses the `cdk-deploy-to` script to deploy to multiple environments. If the first deployment fails, the process stops:
-
-====
-[role="tablist"]
-macOS/Linux::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-#!/usr/bin/env bash
-# cdk-deploy-to-prod.sh
-./cdk-deploy-to.sh 135792468 us-west-1 "$@" || exit
-./cdk-deploy-to.sh 246813579 eu-west-1 "$@"
-----
-
-Windows::
-+
-[source,bat,subs="verbatim,attributes"]
-----
-@echo off
-rem cdk-deploy-to-prod.bat
-cdk-deploy-to 135792469 us-west-1 %* || exit /B
-cdk-deploy-to 245813579 eu-west-1 %*
-----
-====
\ No newline at end of file
diff --git a/v2/guide/configure-synth.adoc b/v2/guide/configure-synth.adoc
deleted file mode 100644
index 097fdda2..00000000
--- a/v2/guide/configure-synth.adoc
+++ /dev/null
@@ -1,789 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#configure-synth]
-= Configure and perform CDK stack synthesis
-:info_titleabbrev: Configure and perform synthesis
-:keywords: {aws} CDK, {aws} CloudFormation stack, synthesis, cdk synth, {aws} CloudFormation template
-
-[abstract]
---
-Before you can deploy an {aws} Cloud Development Kit ({aws} CDK) stack, it must first be synthesized. Stack synthesis is the process of creating an {aws} CloudFormation template from a CDK stack. The CloudFormation template is what you then deploy to provision your resources on {aws}.
---
-
-// Content start
-
-Before you can deploy an {aws} Cloud Development Kit ({aws} CDK) stack, it must first be synthesized. _Stack synthesis_ is the process of producing an {aws} CloudFormation template and deployment artifacts from a CDK stack. The template and artifacts are known as the _cloud assembly_. The cloud assembly is what gets deployed to provision your resources on {aws}. For more information on how deployments work, see xref:deploy-how[How {aws} CDK deployments work].
-
-[#configure-synth-bootstrap]
-== How synthesis and bootstrapping work together
-
-For your CDK apps to properly deploy, the CloudFormation templates produced during synthesis must correctly specify the resources created during bootstrapping. Therefore, bootstrapping and synthesis must complement one another for a deployment to be successful:
-
-* Bootstrapping is a one-time process of setting up an {aws} environment for {aws} CDK deployments. It configures specific {aws} resources in your environment that are used by the CDK for deployments. These are commonly referred to as _bootstrap resources_. For instructions on bootstrapping, see xref:bootstrapping-env[Bootstrap your environment for use with the {aws} CDK].
-* CloudFormation templates produced during synthesis include information on which bootstrap resources to use. During synthesis, the CDK CLI doesn't know specifically how your {aws} environment has been bootstrapped. Instead, the CDK CLI produces CloudFormation templates based on the synthesizer you configure for each CDK stack. For a deployment to be successful, the synthesizer must produce CloudFormation templates that reference the correct bootstrap resources to use.
-
-The CDK comes with a default synthesizer and bootstrapping configuration that are designed to work together. If you customize one, you must apply relevant customizations to the other.
-
-[#bootstrapping-synthesizers]
-== How to configure CDK stack synthesis
-
-You configure CDK stack synthesis using the `synthesizer` property of your link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html[`Stack`] instance. This property specifies how your CDK stacks will be synthesized. You provide an instance of a class that implements link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IStackSynthesizer.html[`IStackSynthesizer`] or link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IReusableStackSynthesizer.html[`IReusableStackSynthesizer`]. Its methods will be invoked every time an asset is added to the stack or when the stack is synthesized. The following is a basic example of using this property within your stack:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- // stack properties
- synthesizer: new DefaultStackSynthesizer({
- // synthesizer properties
- }),
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- // stack properties
- synthesizer: new DefaultStackSynthesizer({
- // synthesizer properties
- }),
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-MyStack(self, "MyStack",
- # stack properties
- synthesizer=DefaultStackSynthesizer(
- # synthesizer properties
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", StackProps.builder()
- // stack properties
- .synthesizer(DefaultStackSynthesizer.Builder.create()
- // synthesizer properties
- .build())
- .build();
-)
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", new StackProps
-// stack properties
-{
- Synthesizer = new DefaultStackSynthesizer(new DefaultStackSynthesizerProps
- {
- // synthesizer properties
- })
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-func main() {
- app := awscdk.NewApp(nil)
-
- NewMyStack(app, "MyStack", &MyStackProps{
- StackProps: awscdk.StackProps{
- Synthesizer: awscdk.NewDefaultStackSynthesizer(&awscdk.DefaultStackSynthesizerProps{
- // synthesizer properties
- }),
- },
- })
-
- app.Synth(nil)
-}
-----
-====
-
-You can also configure a synthesizer for all CDK stacks in your CDK app using the `defaultStackSynthesizer` property of your `App` instance:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { App, Stack, DefaultStackSynthesizer } from 'aws-cdk-lib';
-
-const app = new App({
- // Configure for all stacks in this app
- defaultStackSynthesizer: new DefaultStackSynthesizer({
- /* ... */
- }),
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { App, Stack, DefaultStackSynthesizer } = require('aws-cdk-lib');
-
-const app = new App({
- // Configure for all stacks in this app
- defaultStackSynthesizer: new DefaultStackSynthesizer({
- /* ... */
- }),
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import App, Stack, DefaultStackSynthesizer
-
-app = App(
- default_stack_synthesizer=DefaultStackSynthesizer(
- # Configure for all stacks in this app
- # ...
- )
-)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.DefaultStackSynthesizer;
-
-public class Main {
- public static void main(final String[] args) {
- App app = new App(AppProps.builder()
- // Configure for all stacks in this app
- .defaultStackSynthesizer(DefaultStackSynthesizer.Builder.create().build())
- .build()
- );
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.Synthesizers;
-
-namespace MyNamespace
-{
- sealed class Program
- {
- public static void Main(string[] args)
- {
- var app = new App(new AppProps
- {
- // Configure for all stacks in this app
- DefaultStackSynthesizer = new DefaultStackSynthesizer(new DefaultStackSynthesizerProps
- {
- // ...
- })
- });
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-func main() {
- defer jsii.Close()
-
- app := awscdk.NewApp(&awscdk.AppProps{
- // Configure for all stacks in this app
- DefaultStackSynthesizer: awscdk.NewDefaultStackSynthesizer(&awscdk.DefaultStackSynthesizerProps{
- // ...
- }),
- })
-}
-----
-====
-
-By default, the {aws} CDK uses `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.DefaultStackSynthesizer.html[`DefaultStackSynthesizer`]. If you don't configure a synthesizer, this synthesizer will be used.
-
-If you don't modify bootstrapping, such as making changes to the bootstrap stack or template, you don't have to modify stack synthesis. You don't even have to provide a synthesizer. The CDK will use the default `DefaultStackSynthesizer` class to configure CDK stack synthesis to properly interact with your bootstrap stack.
-
-[#configure-synth-stack]
-== How to synthesize a CDK stack
-
-To synthesize a CDK stack, use the {aws} CDK Command Line Interface ({aws} CDK CLI) `cdk synth` command. For more information about this command, including options that you can use with this command, see xref:ref-cli-cmd-synth[cdk synthesize].
-
-If your CDK app contains a single stack, or to synthesize all stacks, you don't have to provide the CDK stack name as an argument. By default, the CDK CLI will synthesize your CDK stacks into {aws} CloudFormation templates. A `json` formatted template for each stack is saved to the `cdk.out` directory. If your app contains a single stack, a `yaml` formatted template is printed to `stdout`. The following is an example:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk synth
-Resources:
- CDKMetadata:
- Type: {aws}::CDK::Metadata
- Properties:
- Analytics: v2:deflate64:H4sIAAAAAAAA/unique-identifier
- Metadata:
- aws:cdk:path: CdkAppStack/CDKMetadata/Default
- Condition: CDKMetadataAvailable
- ...
-----
-
-If your CDK app contains multiple stacks, you can provide the logical ID of a stack to synthesize a single stack. The following is an example:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk synth MyStackName
-----
-
-If you don't synthesize a stack and run `cdk deploy`, the CDK CLI will automatically synthesize your stack before deployment.
-
-[#how-synth-default]
-== How synthesis works by default
-
-[#how-synth-default-logical-ids]
-*Generated logical IDs in your {aws} CloudFormation template*::
-+
-When you synthesize a CDK stack to produce a CloudFormation template, logical IDs are generated from the following sources, formatted as ``:
-+
-* *Construct path* – The entire path to the construct in your CDK app. This path excludes the ID of the L1 construct, which is always `Resource` or `Default`, and the ID of the top-level stack that it's a part of.
-* *Construct ID* – The ID that you provide as the second argument when instantiating your construct.
-* *Unique hash* – The {aws} CDK generates an 8 character unique hash using a deterministic hashing algorithm. This unique hash helps to ensure that logical ID values in your template are unique from one another. The deterministic behavior of this hash generation ensures that the generated logical ID value for each construct remains the same every time that you perform synthesis. The hash value will only change if you modify specific construct values such as your construct's ID or its path.
-+
-Logical IDs have a maximum length of 255 characters. Therefore, the {aws} CDK will truncate the construct path and construct ID if necessary to keep within that limit.
-+
-The following is an example of a construct that defines an Amazon Simple Storage Service (Amazon S3) bucket. Here, we pass `myBucket` as the ID for our construct:
-+
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct} from 'constructs';
-import * as s3 from 'aws-cdk-lib/aws-s3';
-
-export class MyCdkAppStack extends cdk.Stack {
- constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Define the S3 bucket
- new s3.Bucket(this, 'myBucket', {
- versioned: true,
- removalPolicy: cdk.RemovalPolicy.DESTROY,
- });
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const s3 = require('aws-cdk-lib/aws-s3');
-
-class MyCdkAppStack extends cdk.Stack {
-
- constructor(scope, id, props) {
- super(scope, id, props);
-
- new s3.Bucket(this, 'myBucket', {
- versioned: true,
- removalPolicy: cdk.RemovalPolicy.DESTROY,
- });
- }
-}
-
-module.exports = { MyCdkAppStack }
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-from aws_cdk import Stack
-from aws_cdk import aws_s3 as s3
-
-class MyCdkAppStack(Stack):
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- s3.Bucket(self, 'MyBucket',
- versioned=True,
- removal_policy=cdk.RemovalPolicy.DESTROY
- )
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.amazon.awscdk.services.s3.Bucket;
-import software.amazon.awscdk.services.s3.BucketProps;
-import software.amazon.awscdk.RemovalPolicy;
-
-public class MyCdkAppStack extends Stack {
- public MyCdkAppStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyCdkAppStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- Bucket.Builder.create(this, "myBucket")
- .versioned(true)
- .removalPolicy(RemovalPolicy.DESTROY)
- .build();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-using Amazon.CDK.{aws}.S3;
-
-namespace MyCdkApp
-{
- public class MyCdkAppStack : Stack
- {
- public MyCdkAppStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- new Bucket(this, "myBucket", new BucketProps
- {
- Versioned = true,
- RemovalPolicy = RemovalPolicy.DESTROY
- });
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awss3"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-type MyCdkAppStackProps struct {
- awscdk.StackProps
-}
-
-func NewMyCdkAppStack(scope constructs.Construct, id string, props *MyCdkAppStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- awss3.NewBucket(stack, jsii.String("myBucket"), &awss3.BucketProps{
- Versioned: jsii.Bool(true),
- RemovalPolicy: awscdk.RemovalPolicy_DESTROY,
- })
-
- return stack
-}
-
-// ...
-----
-====
-+
-When we run `cdk synth`, a logical ID in the format of `myBucket` gets generated. The following is an example of this resource in the generated {aws} CloudFormation template:
-+
-[source,yaml,subs="verbatim,attributes"]
-----
-Resources:
- myBucket5AF9C99B:
- Type: {aws}::S3::Bucket
- Properties:
- VersioningConfiguration:
- Status: Enabled
- UpdateReplacePolicy: Delete
- DeletionPolicy: Delete
- Metadata:
- aws:cdk:path: S3BucketAppStack/myBucket/Resource
-----
-+
-The following is an example of a custom construct named `Bar` that defines an Amazon S3 bucket. The `Bar` construct includes the custom construct `Foo` in its path:
-+
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import * as s3 from 'aws-cdk-lib/aws-s3';
-
-// Define the Bar construct
-export class Bar extends Construct {
- constructor(scope: Construct, id: string) {
- super(scope, id);
-
- // Define an S3 bucket inside of Bar
- new s3.Bucket(this, 'Bucket', {
- versioned: true,
- removalPolicy: cdk.RemovalPolicy.DESTROY,
- } );
- }
-}
-
-// Define the Foo construct
-export class Foo extends Construct {
- constructor(scope: Construct, id: string) {
- super(scope, id);
-
- // Create an instance of Bar inside Foo
- new Bar(this, 'Bar');
- }
-}
-
-// Define the CDK stack
-export class MyCustomAppStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Instantiate Foo construct in the stack
- new Foo(this, 'Foo');
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const s3 = require('aws-cdk-lib/aws-s3');
-const { Construct } = require('constructs');
-
-// Define the Bar construct
-class Bar extends Construct {
- constructor(scope, id) {
- super(scope, id);
-
- // Define an S3 bucket inside of Bar
- new s3.Bucket(this, 'Bucket', {
- versioned: true,
- removalPolicy: cdk.RemovalPolicy.DESTROY,
- });
- }
-}
-
-// Define the Foo construct
-class Foo extends Construct {
- constructor(scope, id) {
- super(scope, id);
-
- // Create an instance of Bar inside Foo
- new Bar(this, 'Bar');
- }
-}
-
-// Define the CDK stack
-class MyCustomAppStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // Instantiate Foo construct in the stack
- new Foo(this, 'Foo');
- }
-}
-
-module.exports = { MyCustomAppStack }
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-from aws_cdk import (
- Stack,
- aws_s3 as s3,
- RemovalPolicy,
-)
-
-# Define the Bar construct
-class Bar(Construct):
- def __init__(self, scope: Construct, id: str) -> None:
- super().__init__(scope, id)
-
- # Define an S3 bucket inside of Bar
- s3.Bucket(self, 'Bucket',
- versioned=True,
- removal_policy=RemovalPolicy.DESTROY
- )
-
-# Define the Foo construct
-class Foo(Construct):
- def __init__(self, scope: Construct, id: str) -> None:
- super().__init__(scope, id)
-
- # Create an instance of Bar inside Foo
- Bar(self, 'Bar')
-
-# Define the CDK stack
-class MyCustomAppStack(Stack):
- def __init__(self, scope: Construct, id: str, **kwargs) -> None:
- super().__init__(scope, id, **kwargs)
-
- # Instantiate Foo construct in the stack
- Foo(self, 'Foo')
-----
-
-Java::
-In `my-custom-app/src/main/java/com/myorg/Bar.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.services.s3.Bucket;
-import software.amazon.awscdk.services.s3.BucketProps;
-import software.amazon.awscdk.RemovalPolicy;
-
-public class Bar extends Construct {
- public Bar(final Construct scope, final String id) {
- super(scope, id);
-
- // Define an S3 bucket inside Bar
- Bucket.Builder.create(this, "Bucket")
- .versioned(true)
- .removalPolicy(RemovalPolicy.DESTROY)
- .build();
- }
-}
-----
-+
-In `my-custom-app/src/main/java/com/myorg/Foo.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-
-public class Foo extends Construct {
- public Foo(final Construct scope, final String id) {
- super(scope, id);
-
- // Create an instance of Bar inside Foo
- new Bar(this, "Bar");
- }
-}
-----
-+
-In `my-custom-app/src/main/java/com/myorg/MyCustomAppStack.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-
-public class MyCustomAppStack extends Stack {
- public MyCustomAppStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- // Instantiate Foo construct in the stack
- new Foo(this, "Foo");
- }
-
- // Overload constructor in case StackProps is not provided
- public MyCustomAppStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-using Amazon.CDK.{aws}.S3;
-
-namespace MyCustomApp
-{
- // Define the Bar construct
- public class Bar : Construct
- {
- public Bar(Construct scope, string id) : base(scope, id)
- {
- // Define an S3 bucket inside Bar
- new Bucket(this, "Bucket", new BucketProps
- {
- Versioned = true,
- RemovalPolicy = RemovalPolicy.DESTROY
- });
- }
- }
-
- // Define the Foo construct
- public class Foo : Construct
- {
- public Foo(Construct scope, string id) : base(scope, id)
- {
- // Create an instance of Bar inside Foo
- new Bar(this, "Bar");
- }
- }
-
- // Define the CDK Stack
- public class MyCustomAppStack : Stack
- {
- public MyCustomAppStack(Construct scope, string id, StackProps props = null) : base(scope, id, props)
- {
- // Instantiate Foo construct in the stack
- new Foo(this, "Foo");
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awss3"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-// Define the Bar construct
-type Bar struct {
- constructs.Construct
-}
-
-func NewBar(scope constructs.Construct, id string) constructs.Construct {
- bar := constructs.NewConstruct(scope, &id)
-
- // Define an S3 bucket inside Bar
- awss3.NewBucket(bar, jsii.String("Bucket"), &awss3.BucketProps{
- Versioned: jsii.Bool(true),
- RemovalPolicy: awscdk.RemovalPolicy_DESTROY,
- })
-
- return bar
-}
-
-// Define the Foo construct
-type Foo struct {
- constructs.Construct
-}
-
-func NewFoo(scope constructs.Construct, id string) constructs.Construct {
- foo := constructs.NewConstruct(scope, &id)
-
- // Create an instance of Bar inside Foo
- NewBar(foo, "Bar")
-
- return foo
-}
-
-// Define the CDK Stack
-type MyCustomAppStackProps struct {
- awscdk.StackProps
-}
-
-func NewMyCustomAppStack(scope constructs.Construct, id string, props *MyCustomAppStackProps) awscdk.Stack {
- stack := awscdk.NewStack(scope, &id, &props.StackProps)
-
- // Instantiate Foo construct in the stack
- NewFoo(stack, "Foo")
-
- return stack
-}
-
-// Define the CDK App
-func main() {
- app := awscdk.NewApp(nil)
-
- NewMyCustomAppStack(app, "MyCustomAppStack", &MyCustomAppStackProps{
- StackProps: awscdk.StackProps{},
- })
-
- app.Synth(nil)
-}
-----
-====
-+
-When we run `cdk synth`, a logical ID in the format of `FooBarBucket` gets generated. The following is an example of this resource in the generated {aws} CloudFormation template:
-+
-[source,yaml,subs="verbatim,attributes"]
-----
-Resources:
- FooBarBucketBA3ED1FA:
- Type: {aws}::S3::Bucket
- Properties:
- VersioningConfiguration:
- Status: Enabled
- UpdateReplacePolicy: Delete
- DeletionPolicy: Delete
- # ...
-----
-
-[#bootstrapping-custom-synth]
-== Customize CDK stack synthesis
-
-If the default CDK synthesis behavior doesn't suit your needs, you can customize CDK synthesis. To do this, you modify `DefaultStackSynthesizer`, use other available built-in synthesizers, or create your own synthesizer. For instructions, see xref:customize-synth[Customize CDK stack synthesis].
-
-include::customize-synth.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/constructs.adoc b/v2/guide/constructs.adoc
deleted file mode 100644
index 434035ad..00000000
--- a/v2/guide/constructs.adoc
+++ /dev/null
@@ -1,1214 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Constructs
-:keywords: {aws} CDK, {aws} CloudFormation, IaC, Infrastructure as code, constructs
-
-[#constructs]
-= {aws} CDK Constructs
-
-[abstract]
---
-Constructs are the basic building blocks of {aws} Cloud Development Kit ({aws} CDK) applications. A construct is a component within your application that represents one or more {aws} CloudFormation resources and their configuration. You build your application, piece by piece, by importing and configuring constructs.
---
-
-// Content start
-
-Constructs are the basic building blocks of {aws} Cloud Development Kit ({aws} CDK) applications. A construct is a component within your application that represents one or more {aws} CloudFormation resources and their configuration. You build your application, piece by piece, by importing and configuring constructs.
-
-[#constructs-import]
-== Import and use constructs
-
-Constructs are classes that you import into your CDK applications from the xref:libraries-construct[{aws} Construct Library]. You can also create and distribute your own constructs, or use constructs created by third-party developers.
-
-Constructs are part of the Construct Programming Model (CPM). They are available to use with other tools such as CDK for [.noloc]`Terraform` (CDKtf), CDK for [.noloc]`Kubernetes` (CDK8s), and [.noloc]`Projen`.
-
-Numerous third parties have also published constructs compatible with the {aws} CDK. Visit https://constructs.dev/search?q=&cdk=aws-cdk&cdkver=2&offset=0[Construct Hub] to explore the {aws} CDK construct partner ecosystem.
-
-[#constructs-lib-levels]
-== Construct levels
-
-Constructs from the {aws} Construct Library are categorized into three levels. Each level offers an increasing level of abstraction. The higher the abstraction, the easier to configure, requiring less expertise. The lower the abstraction, the more customization available, requiring more expertise.
-
-[#constructs-lib-levels-one]
-*Level 1 (L1) constructs*::
-L1 constructs, also known as _CFN resources_, are the lowest-level construct and offer no abstraction. Each L1 construct maps directly to a single {aws} CloudFormation resource. With L1 constructs, you import a construct that represents a specific {aws} CloudFormation resource. You then define the resource`'s properties within your construct instance.
-+
-L1 constructs are great to use when you are familiar with {aws} CloudFormation and need complete control over defining your {aws} resource properties.
-+
-In the {aws} Construct Library, L1 constructs are named starting with `Cfn`, followed by an identifier for the {aws} CloudFormation resource that it represents. For example, the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.CfnBucket.html[`CfnBucket`] construct is an L1 construct that represents an https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html[`{aws}::S3::Bucket`] {aws} CloudFormation resource.
-+
-L1 constructs are generated from the https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html[{aws} CloudFormation resource specification]. If a resource exists in {aws} CloudFormation, it'll be available in the {aws} CDK as an L1 construct. New resources or properties may take up to a week to become available in the {aws} Construct Library. For more information, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html[{aws} resource and property types reference] in the _{aws} CloudFormation User Guide_.
-
-[#constructs-lib-levels-two]
-*Level 2 (L2) constructs*::
-L2 constructs, also known as _curated_ constructs, are thoughtfully developed by the CDK team and are usually the most widely used construct type. L2 constructs map directly to single {aws} CloudFormation resources, similar to L1 constructs. Compared to L1 constructs, L2 constructs provide a higher-level abstraction through an intuitive intent-based API. L2 constructs include sensible default property configurations, best practice security policies, and generate a lot of the boilerplate code and glue logic for you.
-+
-L2 constructs also provide helper methods for most resources that make it simpler and quicker to define properties, permissions, event-based interactions between resources, and more.
-+
-The https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html[`s3.Bucket`] class is an example of an L2 construct for an Amazon Simple Storage Service (Amazon S3) bucket resource.
-+
-The {aws} Construct Library contains L2 constructs that are designated stable and ready for production use. For L2 constructs under development, they are designated as experimental and offered in a separate module.
-
-[#constructs-lib-levels-three]
-*Level 3 (L3) constructs*::
-L3 constructs, also known as _patterns_, are the highest-level of abstraction. Each L3 construct can contain a collection of resources that are configured to work together to accomplish a specific task or service within your application. L3 constructs are used to create entire {aws} architectures for particular use cases in your application.
-+
-To provide complete system designs, or substantial parts of a larger system, L3 constructs offer opinionated default property configurations. They are built around a particular approach toward solving a problem and providing a solution. With L3 constructs, you can create and configure multiple resources quickly, with the fewest amount of input and code.
-+
-The https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ApplicationLoadBalancedFargateService.html[`ecsPatterns.ApplicationLoadBalancedFargateService`] class is an example of an L3 construct that represents an {aws} Fargate service running on an Amazon Elastic Container Service (Amazon ECS) cluster and fronted by an application load balancer.
-+
-Similar to L2 constructs, L3 constructs that are ready for production use are included in the {aws} Construct Library. Those under development are offered in separate modules.
-
-[#constructs-define,constructs-define.title]
-== Defining constructs
-
-[#constructs-composition]
-=== Composition
-
-_Composition_ is the key pattern for defining higher-level abstractions through constructs. A high-level construct can be composed from any number of lower-level constructs. From a bottom-up perspective, you use constructs to organize the individual {aws} resources that you want to deploy. You use whatever abstractions are convenient for your purpose, with as many levels as you need.
-
-With composition, you define reusable components and share them like any other code. For example, a team can define a construct that implements the company`'s best practice for an Amazon DynamoDB table, including backup, global replication, automatic scaling, and monitoring. The team can share the construct internally with other teams, or publicly.
-
-Teams can use constructs like any other library package. When the library is updated, developers get access to the new version's improvements and bug fixes, similar to any other code library.
-
-[#constructs-init]
-=== Initialization
-
-Constructs are implemented in classes that extend the https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html[`Construct`] base class. You define a construct by instantiating the class. All constructs take three parameters when they are initialized:
-
-* *scope* – The construct's parent or owner. This can either be a stack or another construct. Scope determines the construct's place in the xref:apps-tree[construct tree]. You should usually pass `this` (`self` in Python), which represents the current object, for the scope.
-* *id* – An xref:identifiers[identifier] that must be unique within the scope. The identifier serves as a namespace for everything that's defined within the construct. It's used to generate unique identifiers, such as xref:resources-physical-names[resource names] and {aws} CloudFormation logical IDs.
-+
-Identifiers need only be unique within a scope. This lets you instantiate and reuse constructs without concern for the constructs and identifiers they might contain, and enables composing constructs into higher-level abstractions. In addition, scopes make it possible to refer to groups of constructs all at once. Examples include for https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Tag.html[tagging], or specifying where the constructs will be deployed.
-
-* *props* – A set of properties or keyword arguments, depending on the language, that define the construct`'s initial configuration. Higher-level constructs provide more defaults, and if all prop elements are optional, you can omit the props parameter completely.
-
-[#constructs-config]
-=== Configuration
-
-Most constructs accept `props` as their third argument (or in Python, keyword arguments), a name/value collection that defines the construct's configuration. The following example defines a bucket with {aws} Key Management Service ({aws} KMS) encryption and static website hosting enabled. Since it does not explicitly specify an encryption key, the `Bucket` construct defines a new `kms.Key` and associates it with the bucket.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new s3.Bucket(this, 'MyEncryptedBucket', {
- encryption: s3.BucketEncryption.KMS,
- websiteIndexDocument: 'index.html'
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new s3.Bucket(this, 'MyEncryptedBucket', {
- encryption: s3.BucketEncryption.KMS,
- websiteIndexDocument: 'index.html'
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-s3.Bucket(self, "MyEncryptedBucket", encryption=s3.BucketEncryption.KMS,
- website_index_document="index.html")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-Bucket.Builder.create(this, "MyEncryptedBucket")
- .encryption(BucketEncryption.KMS_MANAGED)
- .websiteIndexDocument("index.html").build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new Bucket(this, "MyEncryptedBucket", new BucketProps
-{
- Encryption = BucketEncryption.KMS_MANAGED,
- WebsiteIndexDocument = "index.html"
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
- awss3.NewBucket(stack, jsii.String("MyEncryptedBucket"), &awss3.BucketProps{
- Encryption: awss3.BucketEncryption_KMS,
- WebsiteIndexDocument: jsii.String("index.html"),
- })
-----
-====
-
-[#constructs-interact]
-=== Interacting with constructs
-
-Constructs are classes that extend the base https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html[Construct] class. After you instantiate a construct, the construct object exposes a set of methods and properties that let you interact with the construct and pass it around as a reference to other parts of the system.
-
-The {aws} CDK framework doesn't put any restrictions on the APIs of constructs. Authors can define any API they want. However, the {aws} constructs that are included with the {aws} Construct Library, such as `s3.Bucket`, follow guidelines and common patterns. This provides a consistent experience across all {aws} resources.
-
-Most {aws} constructs have a set of xref:permissions-grants[grant] methods that you can use to grant {aws} Identity and Access Management (IAM) permissions on that construct to a principal. The following example grants the IAM group `data-science` permission to read from the Amazon S3 bucket `raw-data`.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const rawData = new s3.Bucket(this, 'raw-data');
-const dataScience = new iam.Group(this, 'data-science');
-rawData.grantRead(dataScience);
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const rawData = new s3.Bucket(this, 'raw-data');
-const dataScience = new iam.Group(this, 'data-science');
-rawData.grantRead(dataScience);
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-raw_data = s3.Bucket(self, 'raw-data')
-data_science = iam.Group(self, 'data-science')
-raw_data.grant_read(data_science)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-Bucket rawData = new Bucket(this, "raw-data");
-Group dataScience = new Group(this, "data-science");
-rawData.grantRead(dataScience);
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var rawData = new Bucket(this, "raw-data");
-var dataScience = new Group(this, "data-science");
-rawData.GrantRead(dataScience);
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
- rawData := awss3.NewBucket(stack, jsii.String("raw-data"), nil)
- dataScience := awsiam.NewGroup(stack, jsii.String("data-science"), nil)
- rawData.GrantRead(dataScience, nil)
-----
-====
-
-Another common pattern is for {aws} constructs to set one of the resource's attributes from data supplied elsewhere. Attributes can include Amazon Resource Names (ARNs), names, or URLs.
-
-The following code defines an {aws} Lambda function and associates it with an Amazon Simple Queue Service (Amazon SQS) queue through the queue's URL in an environment variable.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const jobsQueue = new sqs.Queue(this, 'jobs');
-const createJobLambda = new lambda.Function(this, 'create-job', {
- runtime: lambda.Runtime.NODEJS_18_X,
- handler: 'index.handler',
- code: lambda.Code.fromAsset('./create-job-lambda-code'),
- environment: {
- QUEUE_URL: jobsQueue.queueUrl
- }
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const jobsQueue = new sqs.Queue(this, 'jobs');
-const createJobLambda = new lambda.Function(this, 'create-job', {
- runtime: lambda.Runtime.NODEJS_18_X,
- handler: 'index.handler',
- code: lambda.Code.fromAsset('./create-job-lambda-code'),
- environment: {
- QUEUE_URL: jobsQueue.queueUrl
- }
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-jobs_queue = sqs.Queue(self, "jobs")
-create_job_lambda = lambda_.Function(self, "create-job",
- runtime=lambda_.Runtime.NODEJS_18_X,
- handler="index.handler",
- code=lambda_.Code.from_asset("./create-job-lambda-code"),
- environment=dict(
- QUEUE_URL=jobs_queue.queue_url
- )
-)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-final Queue jobsQueue = new Queue(this, "jobs");
-Function createJobLambda = Function.Builder.create(this, "create-job")
- .handler("index.handler")
- .code(Code.fromAsset("./create-job-lambda-code"))
- .environment(java.util.Map.of( // Map.of is Java 9 or later
- "QUEUE_URL", jobsQueue.getQueueUrl()))
- .build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var jobsQueue = new Queue(this, "jobs");
-var createJobLambda = new Function(this, "create-job", new FunctionProps
-{
- Runtime = Runtime.NODEJS_18_X,
- Handler = "index.handler",
- Code = Code.FromAsset(@".\create-job-lambda-code"),
- Environment = new Dictionary
- {
- ["QUEUE_URL"] = jobsQueue.QueueUrl
- }
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
- createJobLambda := awslambda.NewFunction(stack, jsii.String("create-job"), &awslambda.FunctionProps{
- Runtime: awslambda.Runtime_NODEJS_18_X(),
- Handler: jsii.String("index.handler"),
- Code: awslambda.Code_FromAsset(jsii.String(".\\create-job-lambda-code"), nil),
- Environment: &map[string]*string{
- "QUEUE_URL": jsii.String(*jobsQueue.QueueUrl()),
- },
- })
-----
-====
-
-For information about the most common API patterns in the {aws} Construct Library, see xref:resources[Resources and the {aws} CDK].
-
-[#constructs-apps-stacks]
-=== The app and stack construct
-
-The https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.App.html[`App`] and https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html[`Stack`] classes from the {aws} Construct Library are unique constructs. Compared to other constructs, they don't configure {aws} resources on their own. Instead, they are used to provide context for your other constructs. All constructs that represent {aws} resources must be defined, directly or indirectly, within the scope of a `Stack` construct. `Stack` constructs are defined within the scope of an `App` construct.
-
-To learn more about CDK apps, see xref:apps[{aws} CDK apps]. To learn more about CDK stacks, see xref:stacks[Introduction to {aws} CDK stacks].
-
-The following example defines an app with a single stack. Within the stack, an L2 construct is used to configure an Amazon S3 bucket resource.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { App, Stack, StackProps } from 'aws-cdk-lib';
-import * as s3 from 'aws-cdk-lib/aws-s3';
-
-class HelloCdkStack extends Stack {
- constructor(scope: App, id: string, props?: StackProps) {
- super(scope, id, props);
-
- new s3.Bucket(this, 'MyFirstBucket', {
- versioned: true
- });
- }
-}
-
-const app = new App();
-new HelloCdkStack(app, "HelloCdkStack");
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { App , Stack } = require('aws-cdk-lib');
-const s3 = require('aws-cdk-lib/aws-s3');
-
-class HelloCdkStack extends Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- new s3.Bucket(this, 'MyFirstBucket', {
- versioned: true
- });
- }
-}
-
-const app = new App();
-new HelloCdkStack(app, "HelloCdkStack");
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import App, Stack
-import aws_cdk.aws_s3 as s3
-from constructs import Construct
-
-class HelloCdkStack(Stack):
-
- def __init__(self, scope: Construct, id: str, **kwargs) -> None:
- super().__init__(scope, id, **kwargs)
-
- s3.Bucket(self, "MyFirstBucket", versioned=True)
-
-app = App()
-HelloCdkStack(app, "HelloCdkStack")
-----
-
-Java::
-Stack defined in `HelloCdkStack.java` file:
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.amazon.awscdk.services.s3.*;
-
-public class HelloCdkStack extends Stack {
- public HelloCdkStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public HelloCdkStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- Bucket.Builder.create(this, "MyFirstBucket")
- .versioned(true).build();
- }
-}
-----
-+
-
-App defined in `HelloCdkApp.java` file:
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.StackProps;
-
-public class HelloCdkApp {
- public static void main(final String[] args) {
- App app = new App();
-
- new HelloCdkStack(app, "HelloCdkStack", StackProps.builder()
- .build());
-
- app.synth();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.{aws}.S3;
-
-namespace HelloCdkApp
-{
- internal static class Program
- {
- public static void Main(string[] args)
- {
- var app = new App();
- new HelloCdkStack(app, "HelloCdkStack");
- app.Synth();
- }
- }
-
- public class HelloCdkStack : Stack
- {
- public HelloCdkStack(Construct scope, string id, IStackProps props=null) : base(scope, id, props)
- {
- new Bucket(this, "MyFirstBucket", new BucketProps { Versioned = true });
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-func NewHelloCdkStack(scope constructs.Construct, id string, props *HelloCdkStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- awss3.NewBucket(stack, jsii.String("MyFirstBucket"), &awss3.BucketProps{
- Versioned: jsii.Bool(true),
- })
-
- return stack
-}
-----
-====
-
-
-[#constructs-work]
-== Working with constructs
-
-[#constructs-l1-using]
-=== Working with L1 constructs
-
-L1 constructs map directly to individual {aws} CloudFormation resources. You must provide the resource's required configuration.
-
-In this example, we create a `bucket` object using the `CfnBucket` L1 construct:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new s3.CfnBucket(this, "amzn-s3-demo-bucket", {
- bucketName: "amzn-s3-demo-bucket"
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new s3.CfnBucket(this, "amzn-s3-demo-bucket", {
- bucketName: "amzn-s3-demo-bucket"
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-bucket = s3.CfnBucket(self, "amzn-s3-demo-bucket", bucket_name="amzn-s3-demo-bucket")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-CfnBucket bucket = new CfnBucket.Builder().bucketName("amzn-s3-demo-bucket").build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var bucket = new CfnBucket(this, "amzn-s3-demo-bucket", new CfnBucketProps
-{
- BucketName= "amzn-s3-demo-bucket"
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
- awss3.NewCfnBucket(stack, jsii.String("amzn-s3-demo-bucket"), &awss3.CfnBucketProps{
- BucketName: jsii.String("amzn-s3-demo-bucket"),
- })
-----
-====
-
-Construct properties that aren't simple Booleans, strings, numbers, or containers are handled differently in the supported languages.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new s3.CfnBucket(this, "amzn-s3-demo-bucket", {
- bucketName: "amzn-s3-demo-bucket",
- corsConfiguration: {
- corsRules: [{
- allowedOrigins: ["*"],
- allowedMethods: ["GET"]
- }]
- }
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new s3.CfnBucket(this, "amzn-s3-demo-bucket", {
- bucketName: "amzn-s3-demo-bucket",
- corsConfiguration: {
- corsRules: [{
- allowedOrigins: ["*"],
- allowedMethods: ["GET"]
- }]
- }
-});
-----
-
-Python::
-In Python, these properties are represented by types defined as inner classes of the L1 construct. For example, the optional property `cors_configuration` of a `CfnBucket` requires a wrapper of type `CfnBucket.CorsConfigurationProperty`. Here we are defining `cors_configuration` on a `CfnBucket` instance.
-+
-[source,python,subs="verbatim,attributes"]
-----
-bucket = CfnBucket(self, "amzn-s3-demo-bucket", bucket_name="amzn-s3-demo-bucket",
- cors_configuration=CfnBucket.CorsConfigurationProperty(
- cors_rules=[CfnBucket.CorsRuleProperty(
- allowed_origins=["*"],
- allowed_methods=["GET"]
- )]
- )
-)
-----
-
-Java::
-In Java, these properties are represented by types defined as inner classes of the L1 construct. For example, the optional property `corsConfiguration` of a `CfnBucket` requires a wrapper of type `CfnBucket.CorsConfigurationProperty`. Here we are defining `corsConfiguration` on a `CfnBucket` instance.
-+
-[source,java,subs="verbatim,attributes"]
-----
-CfnBucket bucket = CfnBucket.Builder.create(this, "amzn-s3-demo-bucket")
- .bucketName("amzn-s3-demo-bucket")
- .corsConfiguration(new CfnBucket.CorsConfigurationProperty.Builder()
- .corsRules(Arrays.asList(new CfnBucket.CorsRuleProperty.Builder()
- .allowedOrigins(Arrays.asList("*"))
- .allowedMethods(Arrays.asList("GET"))
- .build()))
- .build())
- .build();
-----
-
-C#::
-In C#, these properties are represented by types defined as inner classes of the L1 construct. For example, the optional property `CorsConfiguration` of a `CfnBucket` requires a wrapper of type `CfnBucket.CorsConfigurationProperty`. Here we are defining `CorsConfiguration` on a `CfnBucket` instance.
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var bucket = new CfnBucket(this, "amzn-s3-demo-bucket", new CfnBucketProps
-{
- BucketName = "amzn-s3-demo-bucket",
- CorsConfiguration = new CfnBucket.CorsConfigurationProperty
- {
- CorsRules = new object[] {
- new CfnBucket.CorsRuleProperty
- {
- AllowedOrigins = new string[] { "*" },
- AllowedMethods = new string[] { "GET" },
- }
- }
- }
-});
-----
-
-Go::
-In Go, these types are named using the name of the L1 construct, an underscore, and the property name. For example, the optional property `CorsConfiguration` of a `CfnBucket` requires a wrapper of type `CfnBucket_CorsConfigurationProperty`. Here we are defining `CorsConfiguration` on a `CfnBucket` instance.
-+
-[source,go,subs="verbatim,attributes"]
-----
- awss3.NewCfnBucket(stack, jsii.String("amzn-s3-demo-bucket"), &awss3.CfnBucketProps{
- BucketName: jsii.String("amzn-s3-demo-bucket"),
- CorsConfiguration: &awss3.CfnBucket_CorsConfigurationProperty{
- CorsRules: []awss3.CorsRule{
- awss3.CorsRule{
- AllowedOrigins: jsii.Strings("*"),
- AllowedMethods: &[]awss3.HttpMethods{"GET"},
- },
- },
- },
- })
-----
-====
-
-
-[IMPORTANT]
-====
-
-You can't use L2 property types with L1 constructs, or vice versa. When working with L1 constructs, always use the types defined for the L1 construct you're using. Do not use types from other L1 constructs (some may have the same name, but they are not the same type).
-
-Some of our language-specific API references currently have errors in the paths to L1 property types, or don't document these classes at all. We hope to fix this soon. In the meantime, remember that such types are always inner classes of the L1 construct they are used with.
-
-====
-
-[#constructs-using]
-=== Working with L2 constructs
-
-In the following example, we define an Amazon S3 bucket by creating an object from the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html[`Bucket`] L2 construct:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as s3 from 'aws-cdk-lib/aws-s3';
-
-// "this" is HelloCdkStack
-new s3.Bucket(this, 'MyFirstBucket', {
- versioned: true
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const s3 = require('aws-cdk-lib/aws-s3');
-
-// "this" is HelloCdkStack
-new s3.Bucket(this, 'MyFirstBucket', {
- versioned: true
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_s3 as s3
-
-# "self" is HelloCdkStack
-s3.Bucket(self, "MyFirstBucket", versioned=True)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.s3.*;
-
-public class HelloCdkStack extends Stack {
- public HelloCdkStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public HelloCdkStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- Bucket.Builder.create(this, "MyFirstBucket")
- .versioned(true).build();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.S3;
-
-// "this" is HelloCdkStack
-new Bucket(this, "MyFirstBucket", new BucketProps
-{
- Versioned = true
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2/awss3"
- "github.com/aws/jsii-runtime-go"
-)
-
-// stack is HelloCdkStack
-awss3.NewBucket(stack, jsii.String("MyFirstBucket"), &awss3.BucketProps{
- Versioned: jsii.Bool(true),
- })
-----
-====
-
-`MyFirstBucket` is not the name of the bucket that {aws} CloudFormation creates. It is a logical identifier given to the new construct within the context of your CDK app. The https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Resource.html#physicalname[physicalName] value will be used to name the {aws} CloudFormation resource.
-
-[#constructs-work-third]
-== Working with third-party constructs
-
-https://constructs.dev/search?q=&cdk=aws-cdk&cdkver=2&sort=downloadsDesc&offset=0[Construct Hub] is a resource to help you discover additional constructs from {aws}, third parties, and the open-source CDK community.
-
-[#constructs-author]
-=== Writing your own constructs
-
-In addition to using existing constructs, you can also write your own constructs and let anyone use them in their apps. All constructs are equal in the {aws} CDK. Constructs from the {aws} Construct Library are treated the same as a construct from a third-party library published via [.noloc]`NPM`, [.noloc]`Maven`, or [.noloc]`PyPI`. Constructs published to your company's internal package repository are also treated in the same way.
-
-To declare a new construct, create a class that extends the https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html[Construct] base class, in the `constructs` package, then follow the pattern for initializer arguments.
-
-The following example shows how to declare a construct that represents an Amazon S3 bucket. The S3 bucket sends an Amazon Simple Notification Service (Amazon SNS) notification every time someone uploads a file into it.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-export interface NotifyingBucketProps {
- prefix?: string;
-}
-
-export class NotifyingBucket extends Construct {
- constructor(scope: Construct, id: string, props: NotifyingBucketProps = {}) {
- super(scope, id);
- const bucket = new s3.Bucket(this, 'bucket');
- const topic = new sns.Topic(this, 'topic');
- bucket.addObjectCreatedNotification(new s3notify.SnsDestination(topic),
- { prefix: props.prefix });
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-class NotifyingBucket extends Construct {
- constructor(scope, id, props = {}) {
- super(scope, id);
- const bucket = new s3.Bucket(this, 'bucket');
- const topic = new sns.Topic(this, 'topic');
- bucket.addObjectCreatedNotification(new s3notify.SnsDestination(topic),
- { prefix: props.prefix });
- }
-}
-
-module.exports = { NotifyingBucket }
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-class NotifyingBucket(Construct):
-
- def __init__(self, scope: Construct, id: str, *, prefix=None):
- super().__init__(scope, id)
- bucket = s3.Bucket(self, "bucket")
- topic = sns.Topic(self, "topic")
- bucket.add_object_created_notification(s3notify.SnsDestination(topic),
- s3.NotificationKeyFilter(prefix=prefix))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class NotifyingBucket extends Construct {
-
- public NotifyingBucket(final Construct scope, final String id) {
- this(scope, id, null, null);
- }
-
- public NotifyingBucket(final Construct scope, final String id, final BucketProps props) {
- this(scope, id, props, null);
- }
-
- public NotifyingBucket(final Construct scope, final String id, final String prefix) {
- this(scope, id, null, prefix);
- }
-
- public NotifyingBucket(final Construct scope, final String id, final BucketProps props, final String prefix) {
- super(scope, id);
-
- Bucket bucket = new Bucket(this, "bucket");
- Topic topic = new Topic(this, "topic");
- if (prefix != null)
- bucket.addObjectCreatedNotification(new SnsDestination(topic),
- NotificationKeyFilter.builder().prefix(prefix).build());
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-public class NotifyingBucketProps : BucketProps
-{
- public string Prefix { get; set; }
-}
-
-public class NotifyingBucket : Construct
-{
- public NotifyingBucket(Construct scope, string id, NotifyingBucketProps props = null) : base(scope, id)
- {
- var bucket = new Bucket(this, "bucket");
- var topic = new Topic(this, "topic");
- bucket.AddObjectCreatedNotification(new SnsDestination(topic), new NotificationKeyFilter
- {
- Prefix = props?.Prefix
- });
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-type NotifyingBucketProps struct {
- awss3.BucketProps
- Prefix *string
-}
-
-func NewNotifyingBucket(scope constructs.Construct, id *string, props *NotifyingBucketProps) awss3.Bucket {
- var bucket awss3.Bucket
- if props == nil {
- bucket = awss3.NewBucket(scope, jsii.String(*id+"Bucket"), nil)
- } else {
- bucket = awss3.NewBucket(scope, jsii.String(*id+"Bucket"), &props.BucketProps)
- }
- topic := awssns.NewTopic(scope, jsii.String(*id+"Topic"), nil)
- if props == nil {
- bucket.AddObjectCreatedNotification(awss3notifications.NewSnsDestination(topic))
- } else {
- bucket.AddObjectCreatedNotification(awss3notifications.NewSnsDestination(topic), &awss3.NotificationKeyFilter{
- Prefix: props.Prefix,
- })
- }
- return bucket
-}
-----
-====
-
-
-[NOTE]
-====
-
-Our `NotifyingBucket` construct inherits not from `Bucket` but rather from `Construct`. We are using composition, not inheritance, to bundle an Amazon S3 bucket and an Amazon SNS topic together. In general, composition is preferred over inheritance when developing {aws} CDK constructs.
-
-====
-
-The `NotifyingBucket` constructor has a typical construct signature: `scope`, `id`, and `props`. The last argument, `props`, is optional (gets the default value `{}`) because all props are optional. (The base `Construct` class does not take a `props` argument.) You could define an instance of this construct in your app without `props`, for example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, 'MyNotifyingBucket');
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, 'MyNotifyingBucket');
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-NotifyingBucket(self, "MyNotifyingBucket")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, "MyNotifyingBucket");
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, "MyNotifyingBucket");
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-NewNotifyingBucket(stack, jsii.String("MyNotifyingBucket"), nil)
-----
-====
-
-Or you could use `props` (in Java, an additional parameter) to specify the path prefix to filter on, for example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, 'MyNotifyingBucket', { prefix: 'images/' });
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, 'MyNotifyingBucket', { prefix: 'images/' });
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-NotifyingBucket(self, "MyNotifyingBucket", prefix="images/")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, "MyNotifyingBucket", "/images");
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new NotifyingBucket(this, "MyNotifyingBucket", new NotifyingBucketProps
-{
- Prefix = "/images"
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-NewNotifyingBucket(stack, jsii.String("MyNotifyingBucket"), &NotifyingBucketProps{
- Prefix: jsii.String("images/"),
-})
-----
-====
-
-Typically, you would also want to expose some properties or methods on your constructs. It's not very useful to have a topic hidden behind your construct, because users of your construct aren't able to subscribe to it. Adding a `topic` property lets consumers access the inner topic, as shown in the following example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-export class NotifyingBucket extends Construct {
- public readonly topic: sns.Topic;
-
- constructor(scope: Construct, id: string, props: NotifyingBucketProps) {
- super(scope, id);
- const bucket = new s3.Bucket(this, 'bucket');
- this.topic = new sns.Topic(this, 'topic');
- bucket.addObjectCreatedNotification(new s3notify.SnsDestination(this.topic), { prefix: props.prefix });
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-class NotifyingBucket extends Construct {
-
- constructor(scope, id, props) {
- super(scope, id);
- const bucket = new s3.Bucket(this, 'bucket');
- this.topic = new sns.Topic(this, 'topic');
- bucket.addObjectCreatedNotification(new s3notify.SnsDestination(this.topic), { prefix: props.prefix });
- }
-}
-
-module.exports = { NotifyingBucket };
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-class NotifyingBucket(Construct):
-
- def __init__(self, scope: Construct, id: str, *, prefix=None, **kwargs):
- super().__init__(scope, id)
- bucket = s3.Bucket(self, "bucket")
- self.topic = sns.Topic(self, "topic")
- bucket.add_object_created_notification(s3notify.SnsDestination(self.topic),
- s3.NotificationKeyFilter(prefix=prefix))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class NotifyingBucket extends Construct {
-
- public Topic topic = null;
-
- public NotifyingBucket(final Construct scope, final String id) {
- this(scope, id, null, null);
- }
-
- public NotifyingBucket(final Construct scope, final String id, final BucketProps props) {
- this(scope, id, props, null);
- }
-
- public NotifyingBucket(final Construct scope, final String id, final String prefix) {
- this(scope, id, null, prefix);
- }
-
- public NotifyingBucket(final Construct scope, final String id, final BucketProps props, final String prefix) {
- super(scope, id);
-
- Bucket bucket = new Bucket(this, "bucket");
- topic = new Topic(this, "topic");
- if (prefix != null)
- bucket.addObjectCreatedNotification(new SnsDestination(topic),
- NotificationKeyFilter.builder().prefix(prefix).build());
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-public class NotifyingBucket : Construct
-{
- public readonly Topic topic;
-
- public NotifyingBucket(Construct scope, string id, NotifyingBucketProps props = null) : base(scope, id)
- {
- var bucket = new Bucket(this, "bucket");
- topic = new Topic(this, "topic");
- bucket.AddObjectCreatedNotification(new SnsDestination(topic), new NotificationKeyFilter
- {
- Prefix = props?.Prefix
- });
- }
-}
-----
-
-Go::
-To do this in Go, we'll need a little extra plumbing. Our original `NewNotifyingBucket` function returned an `awss3.Bucket`. We'll need to extend `Bucket` to include a `topic` member by creating a `NotifyingBucket` struct. Our function will then return this type.
-+
-[source,go,subs="verbatim,attributes"]
-----
-type NotifyingBucket struct {
- awss3.Bucket
- topic awssns.Topic
-}
-
-func NewNotifyingBucket(scope constructs.Construct, id *string, props *NotifyingBucketProps) NotifyingBucket {
- var bucket awss3.Bucket
- if props == nil {
- bucket = awss3.NewBucket(scope, jsii.String(*id+"Bucket"), nil)
- } else {
- bucket = awss3.NewBucket(scope, jsii.String(*id+"Bucket"), &props.BucketProps)
- }
- topic := awssns.NewTopic(scope, jsii.String(*id+"Topic"), nil)
- if props == nil {
- bucket.AddObjectCreatedNotification(awss3notifications.NewSnsDestination(topic))
- } else {
- bucket.AddObjectCreatedNotification(awss3notifications.NewSnsDestination(topic), &awss3.NotificationKeyFilter{
- Prefix: props.Prefix,
- })
- }
- var nbucket NotifyingBucket
- nbucket.Bucket = bucket
- nbucket.topic = topic
- return nbucket
-}
-----
-====
-
-Now, consumers can subscribe to the topic, for example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const queue = new sqs.Queue(this, 'NewImagesQueue');
-const images = new NotifyingBucket(this, '/images');
-images.topic.addSubscription(new sns_sub.SqsSubscription(queue));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const queue = new sqs.Queue(this, 'NewImagesQueue');
-const images = new NotifyingBucket(this, '/images');
-images.topic.addSubscription(new sns_sub.SqsSubscription(queue));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-queue = sqs.Queue(self, "NewImagesQueue")
-images = NotifyingBucket(self, prefix="Images")
-images.topic.add_subscription(sns_sub.SqsSubscription(queue))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-NotifyingBucket images = new NotifyingBucket(this, "MyNotifyingBucket", "/images");
-images.topic.addSubscription(new SqsSubscription(queue));
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var queue = new Queue(this, "NewImagesQueue");
-var images = new NotifyingBucket(this, "MyNotifyingBucket", new NotifyingBucketProps
-{
- Prefix = "/images"
-});
-images.topic.AddSubscription(new SqsSubscription(queue));
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
- queue := awssqs.NewQueue(stack, jsii.String("NewImagesQueue"), nil)
- images := NewNotifyingBucket(stack, jsii.String("MyNotifyingBucket"), &NotifyingBucketProps{
- Prefix: jsii.String("/images"),
- })
- images.topic.AddSubscription(awssnssubscriptions.NewSqsSubscription(queue, nil))
-----
-====
-
-[#constructs-learn]
-== Learn more
-
-The following video provides a comprehensive overview of CDK constructs, and explains how you can use them in your CDK apps.
-
-video::PzU-i0rJPGw[youtube,align = center,height = 390,fileref = https://www.youtube.com/embed/PzU-i0rJPGw,width = 480]
diff --git a/v2/guide/context.adoc b/v2/guide/context.adoc
deleted file mode 100644
index 8f21a8cf..00000000
--- a/v2/guide/context.adoc
+++ /dev/null
@@ -1,392 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Context values
-:keywords: {aws} CDK, Context values
-
-[#context]
-= Context values and the {aws} CDK
-
-[abstract]
---
-Context values are key-value pairs that can be associated with an app, stack, or construct. They may be supplied to your app from a file (usually either `cdk.json` or `cdk.context.json` in your project directory) or on the command line.
---
-
-// Context start
-
-Context values are key-value pairs that can be associated with an app, stack, or construct. They may be supplied to your app from a file (usually either `cdk.json` or `cdk.context.json` in your project directory) or on the command line.
-
-The CDK Toolkit uses context to cache values retrieved from your {aws} account during synthesis. Values include the Availability Zones in your account or the Amazon Machine Image (AMI) IDs currently available for Amazon EC2 instances. Because these values are provided by your {aws} account, they can change between runs of your CDK application. This makes them a potential source of unintended change. The CDK Toolkit's caching behavior "freezes" these values for your CDK app until you decide to accept the new values.
-
-Imagine the following scenario without context caching. Let's say you specified "latest Amazon Linux" as the AMI for your Amazon EC2 instances, and a new version of this AMI was released. Then, the next time you deployed your CDK stack, your already-deployed instances would be using the outdated ("wrong") AMI and would need to be upgraded. Upgrading would result in replacing all your existing instances with new ones, which would probably be unexpected and undesired.
-
-Instead, the CDK records your account's available AMIs in your project's `cdk.context.json` file, and uses the stored value for future synthesis operations. This way, the list of AMIs is no longer a potential source of change. You can also be sure that your stacks will always synthesize to the same {aws} CloudFormation templates.
-
-Not all context values are cached values from your {aws} environment. xref:featureflags[{aws} CDK feature flags] are also context values. You can also create your own context values for use by your apps or constructs.
-
-Context keys are strings. Values may be any type supported by JSON: numbers, strings, arrays, or objects.
-
-[TIP]
-====
-
-If your constructs create their own context values, incorporate your library's package name in its keys so they won't conflict with other packages' context values.
-
-====
-
-Many context values are associated with a particular {aws} environment, and a given CDK app can be deployed in more than one environment. The key for such values includes the {aws} account and Region so that values from different environments do not conflict.
-
-The following context key illustrates the format used by the {aws} CDK, including the account and Region.
-
-[source,none,subs="verbatim,attributes"]
-----
-availability-zones:account=123456789012:region=eu-central-1
-----
-
-[IMPORTANT]
-====
-
-Cached context values are managed by the {aws} CDK and its constructs, including constructs you may write. Do not add or change cached context values by manually editing files. It can be useful, however, to review `cdk.context.json` occasionally to see what values are being cached. Context values that don't represent cached values should be stored under the `context` key of `cdk.json`. This way, they won't be cleared when cached values are cleared.
-
-====
-
-[#context-construct]
-== Sources of context values
-
-Context values can be provided to your {aws} CDK app in six different ways:
-
-* Automatically from the current {aws} account.
-* Through the `--context` option to the `cdk` command. (These values are always strings.)
-* In the project's `cdk.context.json` file.
-* In the `context` key of the project's `cdk.json` file.
-* In the `context` key of your `~/.cdk.json` file.
-* In your {aws} CDK app using the `construct.node.setContext()` method.
-
-The project file `cdk.context.json` is where the {aws} CDK caches context values retrieved from your {aws} account. This practice avoids unexpected changes to your deployments when, for example, a new Availability Zone is introduced. The {aws} CDK does not write context data to any of the other files listed.
-
-[IMPORTANT]
-====
-
-Because they're part of your application's state, `cdk.json` and `cdk.context.json` must be committed to source control along with the rest of your app's source code. Otherwise, deployments in other environments (for example, a CI pipeline) might produce inconsistent results.
-
-====
-
-Context values are scoped to the construct that created them; they are visible to child constructs, but not to parents or siblings. Context values that are set by the {aws} CDK Toolkit (the `cdk` command) can be set automatically, from a file, or from the `--context` option. Context values from these sources are implicitly set on the `App` construct. Therefore, they're visible to every construct in every stack in the app.
-
-Your app can read a context value using the `construct.node.tryGetContext` method. If the requested entry isn't found on the current construct or any of its parents, the result is `undefined`. (Alternatively, the result could be your language's equivalent, such as `None` in Python.)
-
-[#context-methods]
-== Context methods
-
-The {aws} CDK supports several context methods that enable {aws} CDK apps to obtain contextual information from the {aws} environment. For example, you can get a list of Availability Zones that are available in a given {aws} account and Region, using the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html#availabilityzones[`stack.availabilityZones`] method.
-
-The following are the context methods:
-
-link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53.HostedZone.html#static-fromwbrlookupscope-id-query[`HostedZone.fromLookup`]::
-+
-Gets the hosted zones in your account.
-
-link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html#availabilityzones[`stack.availabilityZones`]::
-+
-Gets the supported Availability Zones.
-
-link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm.StringParameter.html#static-valuewbrfromwbrlookupscope-parametername[`StringParameter.valueFromLookup`]::
-+
-Gets a value from the current Region's Amazon EC2 Systems Manager Parameter Store.
-
-link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Vpc.html#static-fromwbrlookupscope-id-options[`Vpc.fromLookup`]::
-+
-Gets the existing Amazon Virtual Private Clouds in your accounts.
-
-link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.LookupMachineImage.html[`LookupMachineImage`]::
-+
-Looks up a machine image for use with a NAT instance in an Amazon Virtual Private Cloud.
-
-If a required context value isn't available, the {aws} CDK app notifies the CDK Toolkit that the context information is missing. Next, the CLI queries the current {aws} account for the information and stores the resulting context information in the `cdk.context.json` file. Then, it executes the {aws} CDK app again with the context values.
-
-[#context-viewing]
-== Viewing and managing context
-
-Use the `cdk context` command to view and manage the information in your `cdk.context.json` file. To see this information, use the `cdk context` command without any options. The output should be something like the following.
-
-[source,none,subs="verbatim,attributes"]
-----
-Context found in cdk.json:
-
-┌───┬─────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────┐
-│ # │ Key │ Value │
-├───┼─────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
-│ 1 │ availability-zones:account=123456789012:region=eu-central-1 │ [ "eu-central-1a", "eu-central-1b", "eu-central-1c" ] │
-├───┼─────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────┤
-│ 2 │ availability-zones:account=123456789012:region=eu-west-1 │ [ "eu-west-1a", "eu-west-1b", "eu-west-1c" ] │
-└───┴─────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────┘
-
-Run
-
- cdk context --reset KEY_OR_NUMBER
-
- to remove a context key. If it is a cached value, it will be refreshed on the next
-
- cdk synth
-
-.
-----
-
-To remove a context value, run `cdk context --reset`, specifying the value's corresponding key or number. The following example removes the value that corresponds to the second key in the preceding example. This value represents the list of Availability Zones in the Europe (Ireland) Region.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk context --reset 2
-----
-
-[source,none,subs="verbatim,attributes"]
-----
-Context value
-availability-zones:account=123456789012:region=eu-west-1
-reset. It will be refreshed on the next SDK synthesis run.
-----
-
-Therefore, if you want to update to the latest version of the Amazon Linux AMI, use the preceding example to do a controlled update of the context value and reset it. Then, synthesize and deploy your app again.
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk synth
-----
-
-To clear all of the stored context values for your app, run `cdk context --clear`, as follows.
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk context --clear
-----
-
-Only context values stored in `cdk.context.json` can be reset or cleared. The {aws} CDK does not touch other context values. Therefore, to protect a context value from being reset using these commands, you might copy the value to `cdk.json`.
-
-[#context-cli]
-== {aws} CDK Toolkit `--context` flag
-
-Use the `--context` (`-c` for short) option to pass runtime context values to your CDK app during synthesis or deployment.
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk synth --context key=value MyStack
-----
-
-To specify multiple context values, repeat the `--context` option any number of times, providing one key-value pair each time.
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk synth --context key1=value1 --context key2=value2 MyStack
-----
-
-When synthesizing multiple stacks, the specified context values are passed to all stacks. To provide different context values to individual stacks, either use different keys for the values, or use multiple `cdk synth` or `cdk deploy` commands.
-
-Context values passed from the command line are always strings. If a value is usually of some other type, your code must be prepared to convert or parse the value. You might have non-string context values provided in other ways (for example, in `cdk.context.json`). To make sure this kind of value works as expected, confirm that the value is a string before converting it.
-
-[#context-example]
-== Example
-
-Following is an example of using an existing Amazon VPC using {aws} CDK context.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import * as ec2 from 'aws-cdk-lib/aws-ec2';
-import { Construct } from 'constructs';
-
-export class ExistsVpcStack extends cdk.Stack {
-
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
-
- super(scope, id, props);
-
- const vpcid = this.node.tryGetContext('vpcid');
- const vpc = ec2.Vpc.fromLookup(this, 'VPC', {
- vpcId: vpcid,
- });
-
- const pubsubnets = vpc.selectSubnets({subnetType: ec2.SubnetType.PUBLIC});
-
- new cdk.CfnOutput(this, 'publicsubnets', {
- value: pubsubnets.subnetIds.toString(),
- });
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const ec2 = require('aws-cdk-lib/aws-ec2');
-
-class ExistsVpcStack extends cdk.Stack {
-
- constructor(scope, id, props) {
-
- super(scope, id, props);
-
- const vpcid = this.node.tryGetContext('vpcid');
- const vpc = ec2.Vpc.fromLookup(this, 'VPC', {
- vpcId: vpcid
- });
-
- const pubsubnets = vpc.selectSubnets({subnetType: ec2.SubnetType.PUBLIC});
-
- new cdk.CfnOutput(this, 'publicsubnets', {
- value: pubsubnets.subnetIds.toString()
- });
- }
-}
-
-module.exports = { ExistsVpcStack }
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-import aws_cdk.aws_ec2 as ec2
-from constructs import Construct
-
-class ExistsVpcStack(cdk.Stack):
-
- def __init__(scope: Construct, id: str, **kwargs):
-
- super().__init__(scope, id, **kwargs)
-
- vpcid = self.node.try_get_context("vpcid")
- vpc = ec2.Vpc.from_lookup(self, "VPC", vpc_id=vpcid)
-
- pubsubnets = vpc.select_subnets(subnetType=ec2.SubnetType.PUBLIC)
-
- cdk.CfnOutput(self, "publicsubnets",
- value=pubsubnets.subnet_ids.to_string())
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.CfnOutput;
-
-import software.amazon.awscdk.services.ec2.Vpc;
-import software.amazon.awscdk.services.ec2.VpcLookupOptions;
-import software.amazon.awscdk.services.ec2.SelectedSubnets;
-import software.amazon.awscdk.services.ec2.SubnetSelection;
-import software.amazon.awscdk.services.ec2.SubnetType;
-import software.constructs.Construct;
-
-public class ExistsVpcStack extends Stack {
- public ExistsVpcStack(Construct context, String id) {
- this(context, id, null);
- }
-
- public ExistsVpcStack(Construct context, String id, StackProps props) {
- super(context, id, props);
-
- String vpcId = (String)this.getNode().tryGetContext("vpcid");
- Vpc vpc = (Vpc)Vpc.fromLookup(this, "VPC", VpcLookupOptions.builder()
- .vpcId(vpcId).build());
-
- SelectedSubnets pubSubNets = vpc.selectSubnets(SubnetSelection.builder()
- .subnetType(SubnetType.PUBLIC).build());
-
- CfnOutput.Builder.create(this, "publicsubnets")
- .value(pubSubNets.getSubnetIds().toString()).build();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.{aws}.EC2;
-using Constructs;
-
-class ExistsVpcStack : Stack
-{
- public ExistsVpcStack(Construct scope, string id, StackProps props) : base(scope, id, props)
- {
- var vpcId = (string)this.Node.TryGetContext("vpcid");
- var vpc = Vpc.FromLookup(this, "VPC", new VpcLookupOptions
- {
- VpcId = vpcId
- });
-
- SelectedSubnets pubSubNets = vpc.SelectSubnets([new SubnetSelection
- {
- SubnetType = SubnetType.PUBLIC
- }]);
-
- new CfnOutput(this, "publicsubnets", new CfnOutputProps {
- Value = pubSubNets.SubnetIds.ToString()
- });
- }
-}
-----
-====
-
-You can use `cdk diff` to see the effects of passing in a context value on the command line:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk diff -c vpcid=vpc-0cb9c31031d0d3e22
-----
-
-[source,none,subs="verbatim,attributes"]
-----
-Stack ExistsvpcStack
-Outputs
-[+] Output publicsubnets publicsubnets: {"Value":"subnet-06e0ea7dd302d3e8f,subnet-01fc0acfb58f3128f"}
-----
-
-The resulting context values can be viewed as shown here.
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk context -j
-----
-
-[source,none,subs="verbatim,attributes"]
-----
-{
- "vpc-provider:account=123456789012:filter.vpc-id=vpc-0cb9c31031d0d3e22:region=us-east-1": {
- "vpcId": "vpc-0cb9c31031d0d3e22",
- "availabilityZones": [
- "us-east-1a",
- "us-east-1b"
- ],
- "privateSubnetIds": [
- "subnet-03ecfc033225be285",
- "subnet-0cded5da53180ebfa"
- ],
- "privateSubnetNames": [
- "Private"
- ],
- "privateSubnetRouteTableIds": [
- "rtb-0e955393ced0ada04",
- "rtb-05602e7b9f310e5b0"
- ],
- "publicSubnetIds": [
- "subnet-06e0ea7dd302d3e8f",
- "subnet-01fc0acfb58f3128f"
- ],
- "publicSubnetNames": [
- "Public"
- ],
- "publicSubnetRouteTableIds": [
- "rtb-00d1fdfd823c82289",
- "rtb-04bb1969b42969bcb"
- ]
- }
-}
-----
\ No newline at end of file
diff --git a/v2/guide/core-concepts.adoc b/v2/guide/core-concepts.adoc
deleted file mode 100644
index 629d2194..00000000
--- a/v2/guide/core-concepts.adoc
+++ /dev/null
@@ -1,103 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#core-concepts]
-= Learn {aws} CDK core concepts
-:info_titleabbrev: CDK core concepts
-:keywords: {aws} Cloud Development Kit ({aws} CDK), {aws} CDK, IaC, Infrastructure as code, {aws} CloudFormation, Serverless applications, Modern applications, {aws}
-
-[abstract]
---
-Learn core concepts behind the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-
-Learn core concepts behind the {aws} Cloud Development Kit ({aws} CDK).
-
-[#concepts-iac]
-== {aws} CDK and [.noloc]`IaC`
-
-The {aws} CDK is an open-source framework that you can use to manage your {aws} infrastructure using code. This approach is known as __infrastructure as code ([.noloc]`IaC`)__. By managing and provisioning your infrastructure as code, you treat your infrastructure in the same way that developers treat code. This provides many benefits, such as version control and scalability. To learn more about IaC, see https://aws.amazon.com/what-is/iac/[What is Infrastructure as Code?]
-
-[#concepts-cfn]
-== {aws} CDK and {aws} CloudFormation
-
-The {aws} CDK is tightly integrated with {aws} CloudFormation. {aws} CloudFormation is a fully managed service that you can use to manage and provision your infrastructure on {aws}. With {aws} CloudFormation, you define your infrastructure in templates and deploy them to {aws} CloudFormation. The {aws} CloudFormation service then provisions your infrastructure according to the configuration defined on your templates.
-
-{aws} CloudFormation templates are __declarative__, meaning they declare the desired state or outcome of your infrastructure. Using JSON or YAML, you declare your {aws} infrastructure by defining {aws} _resources_ and __properties__. Resources represent the many services on {aws} and properties represent your desired configuration of those services. When you deploy your template to {aws} CloudFormation, your resources and their configured properties are provisioned as described on your template.
-
-With the {aws} CDK, you can manage your infrastructure __imperatively__, using general-purpose programming languages. Instead of just defining a desired state declaratively, you can define the logic or sequence necessary to reach the desired state. For example, you can use `if` statements or conditional loops that determine how to reach a desired end state for your infrastructure.
-
-Infrastructure created with the {aws} CDK is eventually translated, or _synthesized_ into {aws} CloudFormation templates and deployed using the {aws} CloudFormation service. So while the {aws} CDK offers a different approach to creating your infrastructure, you still receive the benefits of {aws} CloudFormation, such as extensive {aws} resource configuration support and robust deployment processes.
-
-To learn more about {aws} CloudFormation, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html[What is {aws} CloudFormation?] in the __{aws} CloudFormation User Guide__.
-
-[#concepts-abstractions]
-== {aws} CDK and abstractions
-
-With {aws} CloudFormation, you must define every detail of how your resources are configured. This provides the benefit of having complete control over your infrastructure. However, this requires you to learn, understand, and create robust templates that contain resource configuration details and relationships between resources, such as permissions and event-driven interactions.
-
-With the {aws} CDK, you can have the same control over your resource configurations. However, the {aws} CDK also offers powerful abstractions, which can speed up and simplify the infrastructure development process. For example, the {aws} CDK includes constructs that provide sensible default configurations and helper methods that generate boilerplate code for you. The {aws} CDK also offers tools, such as the {aws} CDK Command Line Interface ({aws} CDK CLI), that perform infrastructure management actions for you.
-
-[#concepts-learn]
-== Learn more about core {aws} CDK concepts
-
-[#concepts-learn-interact]
-*Interacting with the {aws} CDK*::
-+
-When using with the {aws} CDK, you will primarily interact with the {aws} Construct Library and the {aws} CDK CLI.
-
-[#concepts-learn-develop]
-*Developing with the {aws} CDK*::
-+
-The {aws} CDK can be written in any xref:languages[supported programming language]. You start with a xref:projects[CDK project], which contains a structure of folders and files, including xref:assets[assets]. Within the project, you create a xref:apps[CDK application]. Within the app, you define a xref:stacks[stack], which directly represents a CloudFormation stack. Within the stack, you define your {aws} resources and properties using xref:constructs[constructs].
-
-[#concepts-learn-deploy]
-*Deploying with the {aws} CDK*::
-+
-You deploy CDK apps into an {aws} xref:environments[environment]. Before deploying, you must perform a one-time xref:bootstrapping[bootstrapping] to prepare your environment.
-
-[#concepts-learn-more]
-*Learn more*::
-+
-To learn more about {aws} CDK core concepts, see the topics in this section.
-
-include::languages.adoc[leveloffset=+1]
-
-include::libraries.adoc[leveloffset=+1]
-
-include::projects.adoc[leveloffset=+1]
-
-include::apps.adoc[leveloffset=+1]
-
-include::stacks.adoc[leveloffset=+1]
-
-include::stages.adoc[leveloffset=+1]
-
-include::constructs.adoc[leveloffset=+1]
-
-include::environments.adoc[leveloffset=+1]
-
-include::bootstrapping.adoc[leveloffset=+1]
-
-include::resources.adoc[leveloffset=+1]
-
-include::identifiers.adoc[leveloffset=+1]
-
-include::tokens.adoc[leveloffset=+1]
-
-include::parameters.adoc[leveloffset=+1]
-
-include::tagging.adoc[leveloffset=+1]
-
-include::assets.adoc[leveloffset=+1]
-
-include::permissions.adoc[leveloffset=+1]
-
-include::context.adoc[leveloffset=+1]
-
-include::feature-flags.adoc[leveloffset=+1]
-
-include::aspects.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/create-cdk-pipeline.adoc b/v2/guide/create-cdk-pipeline.adoc
deleted file mode 100644
index 89c9f2d9..00000000
--- a/v2/guide/create-cdk-pipeline.adoc
+++ /dev/null
@@ -1,1658 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-:https---docs-aws-amazon-com-cdk-api-v2-docs-aws-cdk-lib-pipelines-CodePipeline-html-addwbrstagestage-optionss: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.CodePipeline.html#addwbrstagestage-optionss
-:https---github-com-aws-aws-cdk-blob-master-packages--aws-cdk-pipelines-ORIGINAL-API-md: https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/pipelines/ORIGINAL_API.md
-
-[.topic]
-[#cdk-pipeline]
-= Continuous integration and delivery (CI/CD) using CDK Pipelines
-:info_titleabbrev: Create CDK Pipelines
-
-// Content start
-
-Use the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines-readme.html[CDK Pipelines] module from the {aws} Construct Library to configure continuous delivery of {aws} CDK applications. When you commit your CDK app's source code into {aws} CodeCommit, GitHub, or {aws} CodeStar, CDK Pipelines can automatically build, test, and deploy your new version.
-
-CDK Pipelines are self-updating. If you add application stages or stacks, the pipeline automatically reconfigures itself to deploy those new stages or stacks.
-
-[NOTE]
-====
-
-CDK Pipelines supports two APIs. One is the original API that was made available in the CDK Pipelines Developer Preview. The other is a modern API that incorporates feedback from CDK customers received during the preview phase. The examples in this topic use the modern API. For details on the differences between the two supported APIs, see link:https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/pipelines/ORIGINAL_API.md[CDK Pipelines original API] in the _aws-cdk GitHub repository_.
-
-====
-
-[#cdk-pipeline-bootstrap]
-== Bootstrap your {aws} environments
-
-Before you can use CDK Pipelines, you must bootstrap the {aws} xref:environments[environment] that you will deploy your stacks to.
-
-A CDK Pipeline involves at least two environments. The first environment is where the pipeline is provisioned. The second environment is where you want to deploy the application's stacks or stages to (stages are groups of related stacks). These environments can be the same, but a best practice recommendation is to isolate stages from each other in different environments.
-
-[NOTE]
-====
-
-See xref:bootstrapping[{aws} CDK bootstrapping] for more information on the kinds of resources created by bootstrapping and how to customize the bootstrap stack.
-
-====
-
-Continuous deployment with CDK Pipelines requires the following to be included in the CDK Toolkit stack:
-
-* An Amazon Simple Storage Service (Amazon S3) bucket.
-* An Amazon ECR repository.
-* IAM roles to give the various parts of a pipeline the permissions they need.
-
-The CDK Toolkit will upgrade your existing bootstrap stack or creates a new one if necessary.
-
-To bootstrap an environment that can provision an {aws} CDK pipeline, invoke `cdk bootstrap` as shown in the following example. Invoking the {aws} CDK Toolkit via the `npx` command temporarily installs it if necessary. It will also use the version of the Toolkit installed in the current project, if one exists.
-
-`--cloudformation-execution-policies` specifies the ARN of a policy under which future CDK Pipelines deployments will execute. The default `AdministratorAccess` policy makes sure that your pipeline can deploy every type of {aws} resource. If you use this policy, make sure you trust all the code and dependencies that make up your {aws} CDK app.
-
-Most organizations mandate stricter controls on what kinds of resources can be deployed by automation. Check with the appropriate department within your organization to determine the policy your pipeline should use.
-
-You can omit the `--profile` option if your default {aws} profile contains the necessary authentication configuration and {aws} Region.
-
-====
-[role="tablist"]
-macOS/Linux::
-+
-[source,none,subs="verbatim,attributes"]
-----
-npx cdk bootstrap aws:/// --profile \
- --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess
-----
-
-Windows::
-+
-[source,none,subs="verbatim,attributes"]
-----
-npx cdk bootstrap aws:// --profile< ADMIN-PROFILE> ^
- --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess
-----
-====
-
-To bootstrap additional environments into which {aws} CDK applications will be deployed by the pipeline, use the following commands instead. The `--trust` option indicates which other account should have permissions to deploy {aws} CDK applications into this environment. For this option, specify the pipeline's {aws} account ID.
-
-Again, you can omit the `--profile` option if your default {aws} profile contains the necessary authentication configuration and {aws} Region.
-
-====
-[role="tablist"]
-macOS/Linux::
-+
-[source,none,subs="verbatim,attributes"]
-----
-npx cdk bootstrap aws:/// --profile \
- --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess \
- --trust
-----
-
-Windows::
-+
-[source,none,subs="verbatim,attributes"]
-----
-npx cdk bootstrap aws:/// --profile ^
- --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess ^
- --trust
-----
-====
-
-
-[TIP]
-====
-
-Use administrative credentials only to bootstrap and to provision the initial pipeline. Afterward, use the pipeline itself, not your local machine, to deploy changes.
-
-====
-
-If you are upgrading a legacy bootstrapped environment, the previous Amazon S3 bucket is orphaned when the new bucket is created. Delete it manually by using the Amazon S3 console.
-
-[#cdk-pipeline-protect]
-=== Protecting your bootstrap stack from deletion
-
-If a bootstrap stack is deleted, the {aws} resources that were originally provisioned in the environment to support CDK deployments will also be deleted. This will cause the pipeline to stop working. If this happens, there is no general solution for recovery.
-
-After your environment is bootstrapped, do not delete and recreate the environment's bootstrap stack. Instead, try to update the bootstrap stack to a new version by running the `cdk bootstrap` command again.
-
-To protect against accidental deletion of your bootstrap stack, we recommend that you provide the `--termination-protection` option with the `cdk bootstrap` command to enable termination protection. You can enable termination protection on new or existing bootstrap stacks. To learn more about this option, see `xref:ref-cli-cmd-bootstrap-options-termination-protection[--termination-protection]`.
-
-After enabling termination protection, you can use the {aws} CLI or CloudFormation console to verify.
-
-. Run the following command to enable termination protection on a new or existing bootstrap stack:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --termination-protection
-----
-+
-. Use the {aws} CLI or CloudFormation console to verify. The following is an example, using the {aws} CLI. If you modified your bootstrap stack name, replace `CDKToolkit` with your stack name:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ aws cloudformation describe-stacks --stack-name --query "Stacks[0].EnableTerminationProtection"
-true
-----
-
-[#cdk-pipeline-init]
-== Initialize a project
-
-Create a new, empty GitHub project and clone it to your workstation in the `my-pipeline` directory. (Our code examples in this topic use GitHub. You can also use {aws} CodeStar or {aws} CodeCommit.)
-
-[source,none,subs="verbatim,attributes"]
-----
-git clone my-pipeline
-cd my-pipeline
-----
-
-[NOTE]
-====
-
-You can use a name other than `my-pipeline` for your app's main directory. However, if you do so, you will have to tweak the file and class names later in this topic. This is because the {aws} CDK Toolkit bases some file and class names on the name of the main directory.
-
-====
-
-After cloning, initialize the project as usual.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk init app --language typescript
-----
-
-JavaScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk init app --language javascript
-----
-
-Python::
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk init app --language python
-----
-+
-After the app has been created, also enter the following two commands. These activate the app's Python virtual environment and install the {aws} CDK core dependencies.
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ source .venv/bin/activate # On Windows, run `.\venv\Scripts\activate` instead
-$ python -m pip install -r requirements.txt
-----
-
-Java::
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk init app --language java
-----
-+
-If you are using an IDE, you can now open or import the project. In Eclipse, for example, choose *File* > *Import* > *Maven* > **Existing Maven Projects**. Make sure that the project settings are set to use Java 8 (1.8).
-
-C#::
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk init app --language csharp
-----
-+
-If you are using Visual Studio, open the solution file in the `src` directory.
-
-Go::
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk init app --language go
-----
-+
-After the app has been created, also enter the following command to install the {aws} Construct Library modules that the app requires.
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ go get
-----
-====
-
-[IMPORTANT]
-====
-
-Be sure to commit your `cdk.json` and `cdk.context.json` files to source control. The context information (such as feature flags and cached values retrieved from your {aws} account) are part of your project's state. The values may be different in another environment, which can cause unexpected changes in your results. For more information, see xref:context[Context values and the {aws} CDK].
-
-====
-
-[#cdk-pipeline-define]
-== Define a pipeline
-
-Your CDK Pipelines application will include at least two stacks: one that represents the pipeline itself, and one or more stacks that represent the application deployed through it. Stacks can also be grouped into _stages_, which you can use to deploy copies of infrastructure stacks to different environments. For now, we'll consider the pipeline, and later delve into the application it will deploy.
-
-The construct `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.CodePipeline.html[CodePipeline]` is the construct that represents a CDK Pipeline that uses {aws} CodePipeline as its deployment engine. When you instantiate `CodePipeline` in a stack, you define the source location for the pipeline (such as a GitHub repository). You also define the commands to build the app.
-
-For example, the following defines a pipeline whose source is stored in a GitHub repository. It also includes a build step for a TypeScript CDK application. Fill in the information about your GitHub repo where indicated.
-
-[NOTE]
-====
-
-By default, the pipeline authenticates to GitHub using a personal access token stored in Secrets Manager under the name `github-token`.
-
-====
-
-You'll also need to update the instantiation of the pipeline stack to specify the {aws} account and Region.
-
-====
-[role="tablist"]
-TypeScript::
-In `lib/my-pipeline-stack.ts` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import { CodePipeline, CodePipelineSource, ShellStep } from 'aws-cdk-lib/pipelines';
-
-export class MyPipelineStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: new ShellStep('Synth', {
- input: CodePipelineSource.gitHub('OWNER/REPO', 'main'),
- commands: ['npm ci', 'npm run build', 'npx cdk synth']
- })
- });
- }
-}
-----
-+
-In `bin/my-pipeline.ts` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-import * as cdk from 'aws-cdk-lib';
-import { MyPipelineStack } from '../lib/my-pipeline-stack';
-
-const app = new cdk.App();
-new MyPipelineStack(app, 'MyPipelineStack', {
- env: {
- account: '111111111111',
- region: 'eu-west-1',
- }
-});
-
-app.synth();
-----
-
-JavaScript::
-In `lib/my-pipeline-stack.js` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const { CodePipeline, CodePipelineSource, ShellStep } = require('aws-cdk-lib/pipelines');
-
- class MyPipelineStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: new ShellStep('Synth', {
- input: CodePipelineSource.gitHub('OWNER/REPO', 'main'),
- commands: ['npm ci', 'npm run build', 'npx cdk synth']
- })
- });
- }
-}
-
-module.exports = { MyPipelineStack }
-----
-+
-In `bin/my-pipeline.js` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-
-const cdk = require('aws-cdk-lib');
-const { MyPipelineStack } = require('../lib/my-pipeline-stack');
-
-const app = new cdk.App();
-new MyPipelineStack(app, 'MyPipelineStack', {
- env: {
- account: '111111111111',
- region: 'eu-west-1',
- }
-});
-
-app.synth();
-----
-
-Python::
-In `my-pipeline/my-pipeline-stack.py` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-from aws_cdk.pipelines import CodePipeline, CodePipelineSource, ShellStep
-
-class MyPipelineStack(cdk.Stack):
-
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- pipeline = CodePipeline(self, "Pipeline",
- pipeline_name="MyPipeline",
- synth=ShellStep("Synth",
- input=CodePipelineSource.git_hub("OWNER/REPO", "main"),
- commands=["npm install -g aws-cdk",
- "python -m pip install -r requirements.txt",
- "cdk synth"]
- )
- )
-----
-+
-In `app.py`:
-+
-[source,python,subs="verbatim,attributes"]
-----
-#!/usr/bin/env python3
-import aws_cdk as cdk
-from my_pipeline.my_pipeline_stack import MyPipelineStack
-
-app = cdk.App()
-MyPipelineStack(app, "MyPipelineStack",
- env=cdk.Environment(account="111111111111", region="eu-west-1")
-)
-
-app.synth()
-----
-
-Java::
-In `src/main/java/com/myorg/MyPipelineStack.java` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import java.util.Arrays;
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.amazon.awscdk.pipelines.CodePipeline;
-import software.amazon.awscdk.pipelines.CodePipelineSource;
-import software.amazon.awscdk.pipelines.ShellStep;
-
-public class MyPipelineStack extends Stack {
- public MyPipelineStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyPipelineStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- CodePipeline pipeline = CodePipeline.Builder.create(this, "pipeline")
- .pipelineName("MyPipeline")
- .synth(ShellStep.Builder.create("Synth")
- .input(CodePipelineSource.gitHub("OWNER/REPO", "main"))
- .commands(Arrays.asList("npm install -g aws-cdk", "cdk synth"))
- .build())
- .build();
- }
-}
-----
-+
-In `src/main/java/com/myorg/MyPipelineApp.java` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.Environment;
-import software.amazon.awscdk.StackProps;
-
-public class MyPipelineApp {
- public static void main(final String[] args) {
- App app = new App();
-
- new MyPipelineStack(app, "PipelineStack", StackProps.builder()
- .env(Environment.builder()
- .account("111111111111")
- .region("eu-west-1")
- .build())
- .build());
-
- app.synth();
- }
-}
-----
-
-C#::
-In `src/MyPipeline/MyPipelineStack.cs` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.Pipelines;
-
-namespace MyPipeline
-{
- public class MyPipelineStack : Stack
- {
- internal MyPipelineStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- var pipeline = new CodePipeline(this, "pipeline", new CodePipelineProps
- {
- PipelineName = "MyPipeline",
- Synth = new ShellStep("Synth", new ShellStepProps
- {
- Input = CodePipelineSource.GitHub("OWNER/REPO", "main"),
- Commands = new string[] { "npm install -g aws-cdk", "cdk synth" }
- })
- });
- }
- }
-}
-----
-+
-In `src/MyPipeline/Program.cs` (may vary if your project folder isn't named `my-pipeline`):
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-
-namespace MyPipeline
-{
- sealed class Program
- {
- public static void Main(string[] args)
- {
- var app = new App();
- new MyPipelineStack(app, "MyPipelineStack", new StackProps
- {
- Env = new Amazon.CDK.Environment {
- Account = "111111111111", Region = "eu-west-1" }
- });
-
- app.Synth();
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- codebuild "github.com/aws/aws-cdk-go/awscdk/v2/awscodebuild"
- ssm "github.com/aws/aws-cdk-go/awscdk/v2/awsssm"
- pipeline "github.com/aws/aws-cdk-go/awscdk/v2/pipelines"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
- "os"
-)
-
-// my CDK Stack with resources
-func NewCdkStack(scope constructs.Construct, id *string, props *awscdk.StackProps) awscdk.Stack {
- stack := awscdk.NewStack(scope, id, props)
-
- // create an example ssm parameter
- _ = ssm.NewStringParameter(stack, jsii.String("ssm-test-param"), &ssm.StringParameterProps{
- ParameterName: jsii.String("/testparam"),
- Description: jsii.String("ssm parameter for demo"),
- StringValue: jsii.String("my test param"),
- })
-
- return stack
-}
-
-// my CDK Application
-func NewCdkApplication(scope constructs.Construct, id *string, props *awscdk.StageProps) awscdk.Stage {
- stage := awscdk.NewStage(scope, id, props)
-
- _ = NewCdkStack(stage, jsii.String("cdk-stack"), &awscdk.StackProps{Env: props.Env})
-
- return stage
-}
-
-// my CDK Pipeline
-func NewCdkPipeline(scope constructs.Construct, id *string, props *awscdk.StackProps) awscdk.Stack {
- stack := awscdk.NewStack(scope, id, props)
-
- // GitHub repo with owner and repository name
- githubRepo := pipeline.CodePipelineSource_GitHub(jsii.String("owner/repo"), jsii.String("main"), &pipeline.GitHubSourceOptions{
- Authentication: awscdk.SecretValue_SecretsManager(jsii.String("my-github-token"), nil),
- })
-
- // self mutating pipeline
- myPipeline := pipeline.NewCodePipeline(stack, jsii.String("cdkPipeline"), &pipeline.CodePipelineProps{
- PipelineName: jsii.String("CdkPipeline"),
- // self mutation true - pipeline changes itself before application deployment
- SelfMutation: jsii.Bool(true),
- CodeBuildDefaults: &pipeline.CodeBuildOptions{
- BuildEnvironment: &codebuild.BuildEnvironment{
- // image version 6.0 recommended for newer go version
- BuildImage: codebuild.LinuxBuildImage_FromCodeBuildImageId(jsii.String("aws/codebuild/standard:6.0")),
- },
- },
- Synth: pipeline.NewCodeBuildStep(jsii.String("Synth"), &pipeline.CodeBuildStepProps{
- Input: githubRepo,
- Commands: &[]*string{
- jsii.String("npm install -g aws-cdk"),
- jsii.String("cdk synth"),
- },
- }),
- })
-
- // deployment of actual CDK application
- myPipeline.AddStage(NewCdkApplication(stack, jsii.String("MyApplication"), &awscdk.StageProps{
- Env: targetAccountEnv(),
- }), &pipeline.AddStageOpts{
- Post: &[]pipeline.Step{
- pipeline.NewCodeBuildStep(jsii.String("Manual Steps"), &pipeline.CodeBuildStepProps{
- Commands: &[]*string{
- jsii.String("echo \"My CDK App deployed, manual steps go here ... \""),
- },
- }),
- },
- })
-
- return stack
-}
-
-// main app
-func main() {
- defer jsii.Close()
-
- app := awscdk.NewApp(nil)
-
- // call CDK Pipeline
- NewCdkPipeline(app, jsii.String("CdkPipelineStack"), &awscdk.StackProps{
- Env: pipelineEnv(),
- })
-
- app.Synth(nil)
-}
-
-// env determines the {aws} environment (account+region) in which our stack is to
-// be deployed. For more information see: https://docs.aws.amazon.com/cdk/latest/guide/environments.html
-func pipelineEnv() *awscdk.Environment {
- return &awscdk.Environment{
- Account: jsii.String(os.Getenv("CDK_DEFAULT_ACCOUNT")),
- Region: jsii.String(os.Getenv("CDK_DEFAULT_REGION")),
- }
-}
-
-func targetAccountEnv() *awscdk.Environment {
- return &awscdk.Environment{
- Account: jsii.String(os.Getenv("CDK_DEFAULT_ACCOUNT")),
- Region: jsii.String(os.Getenv("CDK_DEFAULT_REGION")),
- }
-}
-----
-====
-
-You must deploy a pipeline manually once. After that, the pipeline keeps itself up to date from the source code repository. So be sure that the code in the repo is the code you want deployed. Check in your changes and push to GitHub, then deploy:
-
-[source,none,subs="verbatim,attributes"]
-----
-git add --all
-git commit -m "initial commit"
-git push
-cdk deploy
-----
-
-[TIP]
-====
-
-Now that you've done the initial deployment, your local {aws} account no longer needs administrative access. This is because all changes to your app will be deployed via the pipeline. All you need to be able to do is push to GitHub.
-
-====
-
-[#cdk-pipeline-stages]
-== Application stages
-
-To define a multi-stack {aws} application that can be added to the pipeline all at once, define a subclass of `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stage.html[Stage]`. (This is different from `CdkStage` in the CDK Pipelines module.)
-
-The stage contains the stacks that make up your application. If there are dependencies between the stacks, the stacks are automatically added to the pipeline in the right order. Stacks that don't depend on each other are deployed in parallel. You can add a dependency relationship between stacks by calling `stack1.addDependency(stack2)`.
-
-Stages accept a default `env` argument, which becomes the default environment for the stacks inside it. (Stacks can still have their own environment specified.).
-
-An application is added to the pipeline by calling `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.CodePipeline.html#addwbrstagestage-optionss[addStage()]` with instances of https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stage.html[Stage]. A stage can be instantiated and added to the pipeline multiple times to define different stages of your DTAP or multi-Region application pipeline.
-
-We will create a stack containing a simple Lambda function and place that stack in a stage. Then we will add the stage to the pipeline so it can be deployed.
-
-====
-[role="tablist"]
-TypeScript::
-Create the new file `lib/my-pipeline-lambda-stack.ts` to hold our application stack containing a Lambda function.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import { Function, InlineCode, Runtime } from 'aws-cdk-lib/aws-lambda';
-
-export class MyLambdaStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- new Function(this, 'LambdaFunction', {
- runtime: Runtime.NODEJS_18_X,
- handler: 'index.handler',
- code: new InlineCode('exports.handler = _ => "Hello, CDK";')
- });
- }
-}
-----
-+
-Create the new file `lib/my-pipeline-app-stage.ts` to hold our stage.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from "constructs";
-import { MyLambdaStack } from './my-pipeline-lambda-stack';
-
-export class MyPipelineAppStage extends cdk.Stage {
-
- constructor(scope: Construct, id: string, props?: cdk.StageProps) {
- super(scope, id, props);
-
- const lambdaStack = new MyLambdaStack(this, 'LambdaStack');
- }
-}
-----
-+
-Edit `lib/my-pipeline-stack.ts` to add the stage to our pipeline.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import { CodePipeline, CodePipelineSource, ShellStep } from 'aws-cdk-lib/pipelines';
-import { MyPipelineAppStage } from './my-pipeline-app-stage';
-
-export class MyPipelineStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: new ShellStep('Synth', {
- input: CodePipelineSource.gitHub('OWNER/REPO', 'main'),
- commands: ['npm ci', 'npm run build', 'npx cdk synth']
- })
- });
-
- pipeline.addStage(new MyPipelineAppStage(this, "test", {
- env: { account: "111111111111", region: "eu-west-1" }
- }));
- }
-}
-----
-
-JavaScript::
-Create the new file `lib/my-pipeline-lambda-stack.js` to hold our application stack containing a Lambda function.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const { Function, InlineCode, Runtime } = require('aws-cdk-lib/aws-lambda');
-
-class MyLambdaStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- new Function(this, 'LambdaFunction', {
- runtime: Runtime.NODEJS_18_X,
- handler: 'index.handler',
- code: new InlineCode('exports.handler = _ => "Hello, CDK";')
- });
- }
-}
-
-module.exports = { MyLambdaStack }
-----
-+
-Create the new file `lib/my-pipeline-app-stage.js` to hold our stage.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const { MyLambdaStack } = require('./my-pipeline-lambda-stack');
-
-class MyPipelineAppStage extends cdk.Stage {
-
- constructor(scope, id, props) {
- super(scope, id, props);
-
- const lambdaStack = new MyLambdaStack(this, 'LambdaStack');
- }
-}
-
-module.exports = { MyPipelineAppStage };
-----
-+
-Edit `lib/my-pipeline-stack.ts` to add the stage to our pipeline.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const { CodePipeline, CodePipelineSource, ShellStep } = require('aws-cdk-lib/pipelines');
-const { MyPipelineAppStage } = require('./my-pipeline-app-stage');
-
- class MyPipelineStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: new ShellStep('Synth', {
- input: CodePipelineSource.gitHub('OWNER/REPO', 'main'),
- commands: ['npm ci', 'npm run build', 'npx cdk synth']
- })
- });
-
- pipeline.addStage(new MyPipelineAppStage(this, "test", {
- env: { account: "111111111111", region: "eu-west-1" }
- }));
-
- }
-}
-
-module.exports = { MyPipelineStack }
-----
-
-Python::
-Create the new file `my_pipeline/my_pipeline_lambda_stack.py` to hold our application stack containing a Lambda function.
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-from aws_cdk.aws_lambda import Function, InlineCode, Runtime
-
-class MyLambdaStack(cdk.Stack):
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- Function(self, "LambdaFunction",
- runtime=Runtime.NODEJS_18_X,
- handler="index.handler",
- code=InlineCode("exports.handler = _ => 'Hello, CDK';")
- )
-----
-+
-Create the new file `my_pipeline/my_pipeline_app_stage.py` to hold our stage.
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-from my_pipeline.my_pipeline_lambda_stack import MyLambdaStack
-
-class MyPipelineAppStage(cdk.Stage):
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- lambdaStack = MyLambdaStack(self, "LambdaStack")
-----
-+
-Edit `my_pipeline/my-pipeline-stack.py` to add the stage to our pipeline.
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-from aws_cdk.pipelines import CodePipeline, CodePipelineSource, ShellStep
-from my_pipeline.my_pipeline_app_stage import MyPipelineAppStage
-
-class MyPipelineStack(cdk.Stack):
-
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- pipeline = CodePipeline(self, "Pipeline",
- pipeline_name="MyPipeline",
- synth=ShellStep("Synth",
- input=CodePipelineSource.git_hub("OWNER/REPO", "main"),
- commands=["npm install -g aws-cdk",
- "python -m pip install -r requirements.txt",
- "cdk synth"]))
-
- pipeline.add_stage(MyPipelineAppStage(self, "test",
- env=cdk.Environment(account="111111111111", region="eu-west-1")))
-----
-
-Java::
-Create the new file `src/main/java/com.myorg/MyPipelineLambdaStack.java` to hold our application stack containing a Lambda function.
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-
-import software.amazon.awscdk.services.lambda.Function;
-import software.amazon.awscdk.services.lambda.Runtime;
-import software.amazon.awscdk.services.lambda.InlineCode;
-
-public class MyPipelineLambdaStack extends Stack {
- public MyPipelineLambdaStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyPipelineLambdaStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- Function.Builder.create(this, "LambdaFunction")
- .runtime(Runtime.NODEJS_18_X)
- .handler("index.handler")
- .code(new InlineCode("exports.handler = _ => 'Hello, CDK';"))
- .build();
-
- }
-
-}
-----
-+
-Create the new file `src/main/java/com.myorg/MyPipelineAppStage.java` to hold our stage.
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.Stage;
-import software.amazon.awscdk.StageProps;
-
-public class MyPipelineAppStage extends Stage {
- public MyPipelineAppStage(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyPipelineAppStage(final Construct scope, final String id, final StageProps props) {
- super(scope, id, props);
-
- Stack lambdaStack = new MyPipelineLambdaStack(this, "LambdaStack");
- }
-
-}
-----
-+
-Edit `src/main/java/com.myorg/MyPipelineStack.java` to add the stage to our pipeline.
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import java.util.Arrays;
-import software.constructs.Construct;
-import software.amazon.awscdk.Environment;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.amazon.awscdk.StageProps;
-import software.amazon.awscdk.pipelines.CodePipeline;
-import software.amazon.awscdk.pipelines.CodePipelineSource;
-import software.amazon.awscdk.pipelines.ShellStep;
-
-public class MyPipelineStack extends Stack {
- public MyPipelineStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyPipelineStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- final CodePipeline pipeline = CodePipeline.Builder.create(this, "pipeline")
- .pipelineName("MyPipeline")
- .synth(ShellStep.Builder.create("Synth")
- .input(CodePipelineSource.gitHub("OWNER/REPO", "main"))
- .commands(Arrays.asList("npm install -g aws-cdk", "cdk synth"))
- .build())
- .build();
-
- pipeline.addStage(new MyPipelineAppStage(this, "test", StageProps.builder()
- .env(Environment.builder()
- .account("111111111111")
- .region("eu-west-1")
- .build())
- .build()));
- }
-}
-----
-
-C#::
-Create the new file `src/MyPipeline/MyPipelineLambdaStack.cs` to hold our application stack containing a Lambda function.
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-using Amazon.CDK.{aws}.Lambda;
-
-namespace MyPipeline
-{
- class MyPipelineLambdaStack : Stack
- {
- public MyPipelineLambdaStack(Construct scope, string id, StackProps props=null) : base(scope, id, props)
- {
- new Function(this, "LambdaFunction", new FunctionProps
- {
- Runtime = Runtime.NODEJS_18_X,
- Handler = "index.handler",
- Code = new InlineCode("exports.handler = _ => 'Hello, CDK';")
- });
- }
- }
-}
-----
-+
-Create the new file `src/MyPipeline/MyPipelineAppStage.cs` to hold our stage.
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-
-namespace MyPipeline
-{
- class MyPipelineAppStage : Stage
- {
- public MyPipelineAppStage(Construct scope, string id, StageProps props=null) : base(scope, id, props)
- {
- Stack lambdaStack = new MyPipelineLambdaStack(this, "LambdaStack");
- }
- }
-}
-----
-+
-Edit `src/MyPipeline/MyPipelineStack.cs` to add the stage to our pipeline.
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-using Amazon.CDK.Pipelines;
-
-namespace MyPipeline
-{
- public class MyPipelineStack : Stack
- {
- internal MyPipelineStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- var pipeline = new CodePipeline(this, "pipeline", new CodePipelineProps
- {
- PipelineName = "MyPipeline",
- Synth = new ShellStep("Synth", new ShellStepProps
- {
- Input = CodePipelineSource.GitHub("OWNER/REPO", "main"),
- Commands = new string[] { "npm install -g aws-cdk", "cdk synth" }
- })
- });
-
- pipeline.AddStage(new MyPipelineAppStage(this, "test", new StageProps
- {
- Env = new Environment
- {
- Account = "111111111111", Region = "eu-west-1"
- }
- }));
- }
- }
-}
-----
-====
-
-Every application stage added by `addStage()` results in the addition of a corresponding pipeline stage, represented by a `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.StageDeployment.html[StageDeployment]` instance returned by the `addStage()` call. You can add pre-deployment or post-deployment actions to the stage by calling its `addPre()` or `addPost()` method.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// import { ManualApprovalStep } from 'aws-cdk-lib/pipelines';
-
-const testingStage = pipeline.addStage(new MyPipelineAppStage(this, 'testing', {
- env: { account: '111111111111', region: 'eu-west-1' }
-}));
-
- testingStage.addPost(new ManualApprovalStep('approval'));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// const { ManualApprovalStep } = require('aws-cdk-lib/pipelines');
-
-const testingStage = pipeline.addStage(new MyPipelineAppStage(this, 'testing', {
- env: { account: '111111111111', region: 'eu-west-1' }
-}));
-
-testingStage.addPost(new ManualApprovalStep('approval'));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-# from aws_cdk.pipelines import ManualApprovalStep
-
-testing_stage = pipeline.add_stage(MyPipelineAppStage(self, "testing",
- env=cdk.Environment(account="111111111111", region="eu-west-1")))
-
-testing_stage.add_post(ManualApprovalStep('approval'))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// import software.amazon.awscdk.pipelines.StageDeployment;
-// import software.amazon.awscdk.pipelines.ManualApprovalStep;
-
-StageDeployment testingStage =
- pipeline.addStage(new MyPipelineAppStage(this, "test", StageProps.builder()
- .env(Environment.builder()
- .account("111111111111")
- .region("eu-west-1")
- .build())
- .build()));
-
-testingStage.addPost(new ManualApprovalStep("approval"));
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var testingStage = pipeline.AddStage(new MyPipelineAppStage(this, "test", new StageProps
-{
- Env = new Environment
- {
- Account = "111111111111", Region = "eu-west-1"
- }
-}));
-
-testingStage.AddPost(new ManualApprovalStep("approval"));
-----
-====
-
-You can add stages to a `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.Wave.html[Wave]` to deploy them in parallel, for example when deploying a stage to multiple accounts or Regions.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const wave = pipeline.addWave('wave');
-wave.addStage(new MyApplicationStage(this, 'MyAppEU', {
- env: { account: '111111111111', region: 'eu-west-1' }
-}));
-wave.addStage(new MyApplicationStage(this, 'MyAppUS', {
- env: { account: '111111111111', region: 'us-west-1' }
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const wave = pipeline.addWave('wave');
-wave.addStage(new MyApplicationStage(this, 'MyAppEU', {
- env: { account: '111111111111', region: 'eu-west-1' }
-}));
-wave.addStage(new MyApplicationStage(this, 'MyAppUS', {
- env: { account: '111111111111', region: 'us-west-1' }
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-wave = pipeline.add_wave("wave")
-wave.add_stage(MyApplicationStage(self, "MyAppEU",
- env=cdk.Environment(account="111111111111", region="eu-west-1")))
-wave.add_stage(MyApplicationStage(self, "MyAppUS",
- env=cdk.Environment(account="111111111111", region="us-west-1")))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// import software.amazon.awscdk.pipelines.Wave;
-final Wave wave = pipeline.addWave("wave");
-wave.addStage(new MyPipelineAppStage(this, "MyAppEU", StageProps.builder()
- .env(Environment.builder()
- .account("111111111111")
- .region("eu-west-1")
- .build())
- .build()));
-wave.addStage(new MyPipelineAppStage(this, "MyAppUS", StageProps.builder()
- .env(Environment.builder()
- .account("111111111111")
- .region("us-west-1")
- .build())
- .build()));
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var wave = pipeline.AddWave("wave");
-wave.AddStage(new MyPipelineAppStage(this, "MyAppEU", new StageProps
-{
- Env = new Environment
- {
- Account = "111111111111", Region = "eu-west-1"
- }
-}));
-wave.AddStage(new MyPipelineAppStage(this, "MyAppUS", new StageProps
-{
- Env = new Environment
- {
- Account = "111111111111", Region = "us-west-1"
- }
-}));
-----
-====
-
-[#cdk-pipeline-validation]
-== Testing deployments
-
-You can add steps to a CDK Pipeline to validate the deployments that you're performing. For example, you can use the CDK Pipeline library's `link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.ShellStep.html[ShellStep]` to perform tasks such as the following:
-
-* Trying to access a newly deployed Amazon API Gateway backed by a Lambda function
-* Checking a setting of a deployed resource by issuing an {aws} CLI command
-
-In its simplest form, adding validation actions looks like this:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// stage was returned by pipeline.addStage
-
-stage.addPost(new ShellStep("validate", {
- commands: ['../tests/validate.sh'],
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// stage was returned by pipeline.addStage
-
-stage.addPost(new ShellStep("validate", {
- commands: ['../tests/validate.sh'],
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-# stage was returned by pipeline.add_stage
-
-stage.add_post(ShellStep("validate",
- commands=[''../tests/validate.sh'']
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// stage was returned by pipeline.addStage
-
-stage.addPost(ShellStep.Builder.create("validate")
- .commands(Arrays.asList("'../tests/validate.sh'"))
- .build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-// stage was returned by pipeline.addStage
-
-stage.AddPost(new ShellStep("validate", new ShellStepProps
-{
- Commands = new string[] { "'../tests/validate.sh'" }
-}));
-----
-====
-
-Many {aws} CloudFormation deployments result in the generation of resources with unpredictable names. Because of this, CDK Pipelines provide a way to read {aws} CloudFormation outputs after a deployment. This makes it possible to pass (for example) the generated URL of a load balancer to a test action.
-
-To use outputs, expose the `CfnOutput` object you're interested in. Then, pass it in a step's `envFromCfnOutputs` property to make it available as an environment variable within that step.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// given a stack lbStack that exposes a load balancer construct as loadBalancer
-this.loadBalancerAddress = new cdk.CfnOutput(lbStack, 'LbAddress', {
- value: `https://${lbStack.loadBalancer.loadBalancerDnsName}/`
-});
-
-// pass the load balancer address to a shell step
-stage.addPost(new ShellStep("lbaddr", {
- envFromCfnOutputs: {lb_addr: lbStack.loadBalancerAddress},
- commands: ['echo $lb_addr']
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// given a stack lbStack that exposes a load balancer construct as loadBalancer
-this.loadBalancerAddress = new cdk.CfnOutput(lbStack, 'LbAddress', {
- value: `https://${lbStack.loadBalancer.loadBalancerDnsName}/`
-});
-
-// pass the load balancer address to a shell step
-stage.addPost(new ShellStep("lbaddr", {
- envFromCfnOutputs: {lb_addr: lbStack.loadBalancerAddress},
- commands: ['echo $lb_addr']
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-# given a stack lb_stack that exposes a load balancer construct as load_balancer
-self.load_balancer_address = cdk.CfnOutput(lb_stack, "LbAddress",
- value=f"https://{lb_stack.load_balancer.load_balancer_dns_name}/")
-
-# pass the load balancer address to a shell step
-stage.add_post(ShellStep("lbaddr",
- env_from_cfn_outputs={"lb_addr": lb_stack.load_balancer_address}
- commands=["echo $lb_addr"]))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// given a stack lbStack that exposes a load balancer construct as loadBalancer
-loadBalancerAddress = CfnOutput.Builder.create(lbStack, "LbAddress")
- .value(String.format("https://%s/",
- lbStack.loadBalancer.loadBalancerDnsName))
- .build();
-
-stage.addPost(ShellStep.Builder.create("lbaddr")
- .envFromCfnOutputs( // Map.of requires Java 9 or later
- java.util.Map.of("lbAddr", loadBalancerAddress))
- .commands(Arrays.asList("echo $lbAddr"))
- .build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-// given a stack lbStack that exposes a load balancer construct as loadBalancer
-loadBalancerAddress = new CfnOutput(lbStack, "LbAddress", new CfnOutputProps
-{
- Value = string.Format("https://{0}/", lbStack.loadBalancer.LoadBalancerDnsName)
-});
-
-stage.AddPost(new ShellStep("lbaddr", new ShellStepProps
-{
- EnvFromCfnOutputs = new Dictionary
- {
- { "lbAddr", loadBalancerAddress }
- },
- Commands = new string[] { "echo $lbAddr" }
-}));
-----
-====
-
-You can write simple validation tests right in the `ShellStep`, but this approach becomes unwieldy when the test is more than a few lines. For more complex tests, you can bring additional files (such as complete shell scripts, or programs in other languages) into the `ShellStep` via the `inputs` property. The inputs can be any step that has an output, including a source (such as a GitHub repo) or another `ShellStep`.
-
-Bringing in files from the source repository is appropriate if the files are directly usable in the test (for example, if they are themselves executable). In this example, we declare our GitHub repo as `source` (rather than instantiating it inline as part of the `CodePipeline`). Then, we pass this fileset to both the pipeline and the validation test.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const source = CodePipelineSource.gitHub('OWNER/REPO', 'main');
-
-const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: new ShellStep('Synth', {
- input: source,
- commands: ['npm ci', 'npm run build', 'npx cdk synth']
- })
-});
-
-const stage = pipeline.addStage(new MyPipelineAppStage(this, 'test', {
- env: { account: '111111111111', region: 'eu-west-1' }
-}));
-
-stage.addPost(new ShellStep('validate', {
- input: source,
- commands: ['sh ../tests/validate.sh']
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const source = CodePipelineSource.gitHub('OWNER/REPO', 'main');
-
-const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: new ShellStep('Synth', {
- input: source,
- commands: ['npm ci', 'npm run build', 'npx cdk synth']
- })
-});
-
-const stage = pipeline.addStage(new MyPipelineAppStage(this, 'test', {
- env: { account: '111111111111', region: 'eu-west-1' }
-}));
-
-stage.addPost(new ShellStep('validate', {
- input: source,
- commands: ['sh ../tests/validate.sh']
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-source = CodePipelineSource.git_hub("OWNER/REPO", "main")
-
-pipeline = CodePipeline(self, "Pipeline",
- pipeline_name="MyPipeline",
- synth=ShellStep("Synth",
- input=source,
- commands=["npm install -g aws-cdk",
- "python -m pip install -r requirements.txt",
- "cdk synth"]))
-
-stage = pipeline.add_stage(MyApplicationStage(self, "test",
- env=cdk.Environment(account="111111111111", region="eu-west-1")))
-
-stage.add_post(ShellStep("validate", input=source,
- commands=["sh ../tests/validate.sh"],
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-final CodePipelineSource source = CodePipelineSource.gitHub("OWNER/REPO", "main");
-
-final CodePipeline pipeline = CodePipeline.Builder.create(this, "pipeline")
- .pipelineName("MyPipeline")
- .synth(ShellStep.Builder.create("Synth")
- .input(source)
- .commands(Arrays.asList("npm install -g aws-cdk", "cdk synth"))
- .build())
- .build();
-
-final StageDeployment stage =
- pipeline.addStage(new MyPipelineAppStage(this, "test", StageProps.builder()
- .env(Environment.builder()
- .account("111111111111")
- .region("eu-west-1")
- .build())
- .build()));
-
-stage.addPost(ShellStep.Builder.create("validate")
- .input(source)
- .commands(Arrays.asList("sh ../tests/validate.sh"))
- .build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var source = CodePipelineSource.GitHub("OWNER/REPO", "main");
-
-var pipeline = new CodePipeline(this, "pipeline", new CodePipelineProps
-{
- PipelineName = "MyPipeline",
- Synth = new ShellStep("Synth", new ShellStepProps
- {
- Input = source,
- Commands = new string[] { "npm install -g aws-cdk", "cdk synth" }
- })
-});
-
-var stage = pipeline.AddStage(new MyPipelineAppStage(this, "test", new StageProps
-{
- Env = new Environment
- {
- Account = "111111111111", Region = "eu-west-1"
- }
-}));
-
-stage.AddPost(new ShellStep("validate", new ShellStepProps
-{
- Input = source,
- Commands = new string[] { "sh ../tests/validate.sh" }
-}));
-----
-====
-
-Getting the additional files from the synth step is appropriate if your tests need to be compiled, which is done as part of synthesis.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const synthStep = new ShellStep('Synth', {
- input: CodePipelineSource.gitHub('OWNER/REPO', 'main'),
- commands: ['npm ci', 'npm run build', 'npx cdk synth'],
-});
-
-const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: synthStep
-});
-
-const stage = pipeline.addStage(new MyPipelineAppStage(this, 'test', {
- env: { account: '111111111111', region: 'eu-west-1' }
-}));
-
-// run a script that was transpiled from TypeScript during synthesis
-stage.addPost(new ShellStep('validate', {
- input: synthStep,
- commands: ['node tests/validate.js']
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const synthStep = new ShellStep('Synth', {
- input: CodePipelineSource.gitHub('OWNER/REPO', 'main'),
- commands: ['npm ci', 'npm run build', 'npx cdk synth'],
-});
-
-const pipeline = new CodePipeline(this, 'Pipeline', {
- pipelineName: 'MyPipeline',
- synth: synthStep
-});
-
-const stage = pipeline.addStage(new MyPipelineAppStage(this, "test", {
- env: { account: "111111111111", region: "eu-west-1" }
-}));
-
-// run a script that was transpiled from TypeScript during synthesis
-stage.addPost(new ShellStep('validate', {
- input: synthStep,
- commands: ['node tests/validate.js']
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-synth_step = ShellStep("Synth",
- input=CodePipelineSource.git_hub("OWNER/REPO", "main"),
- commands=["npm install -g aws-cdk",
- "python -m pip install -r requirements.txt",
- "cdk synth"])
-
-pipeline = CodePipeline(self, "Pipeline",
- pipeline_name="MyPipeline",
- synth=synth_step)
-
-stage = pipeline.add_stage(MyApplicationStage(self, "test",
- env=cdk.Environment(account="111111111111", region="eu-west-1")))
-
-# run a script that was compiled during synthesis
-stage.add_post(ShellStep("validate",
- input=synth_step,
- commands=["node test/validate.js"],
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-final ShellStep synth = ShellStep.Builder.create("Synth")
- .input(CodePipelineSource.gitHub("OWNER/REPO", "main"))
- .commands(Arrays.asList("npm install -g aws-cdk", "cdk synth"))
- .build();
-
-final CodePipeline pipeline = CodePipeline.Builder.create(this, "pipeline")
- .pipelineName("MyPipeline")
- .synth(synth)
- .build();
-
-final StageDeployment stage =
- pipeline.addStage(new MyPipelineAppStage(this, "test", StageProps.builder()
- .env(Environment.builder()
- .account("111111111111")
- .region("eu-west-1")
- .build())
- .build()));
-
-stage.addPost(ShellStep.Builder.create("validate")
- .input(synth)
- .commands(Arrays.asList("node ./tests/validate.js"))
- .build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var synth = new ShellStep("Synth", new ShellStepProps
-{
- Input = CodePipelineSource.GitHub("OWNER/REPO", "main"),
- Commands = new string[] { "npm install -g aws-cdk", "cdk synth" }
-});
-
-var pipeline = new CodePipeline(this, "pipeline", new CodePipelineProps
-{
- PipelineName = "MyPipeline",
- Synth = synth
-});
-
-var stage = pipeline.AddStage(new MyPipelineAppStage(this, "test", new StageProps
-{
- Env = new Environment
- {
- Account = "111111111111", Region = "eu-west-1"
- }
-}));
-
-stage.AddPost(new ShellStep("validate", new ShellStepProps
-{
- Input = synth,
- Commands = new string[] { "node ./tests/validate.js" }
-}));
-----
-====
-
-[#cdk-pipeline-security]
-== Security notes
-
-Any form of continuous delivery has inherent security risks. Under the {aws} https://aws.amazon.com/compliance/shared-responsibility-model/[Shared Responsibility Model], you are responsible for the security of your information in the {aws} Cloud. The CDK Pipelines library gives you a head start by incorporating secure defaults and modeling best practices.
-
-However, by its very nature, a library that needs a high level of access to fulfill its intended purpose cannot assure complete security. There are many attack vectors outside of {aws} and your organization.
-
-In particular, keep in mind the following:
-
-* Be mindful of the software you depend on. Vet all third-party software you run in your pipeline, because it can change the infrastructure that gets deployed.
-* Use dependency locking to prevent accidental upgrades. CDK Pipelines respects `package-lock.json` and `yarn.lock` to make sure that your dependencies are the ones you expect.
-* CDK Pipelines runs on resources created in your own account, and the configuration of those resources is controlled by developers submitting code through the pipeline. Therefore, CDK Pipelines by itself cannot protect against malicious developers trying to bypass compliance checks. If your threat model includes developers writing CDK code, you should have external compliance mechanisms in place like https://aws.amazon.com/blogs/mt/proactively-keep-resources-secure-and-compliant-with-aws-cloudformation-hooks/[{aws} CloudFormation Hooks] (preventive) or https://aws.amazon.com/config/[{aws} Config] (reactive) that the {aws} CloudFormation Execution Role does not have permissions to disable.
-* Credentials for production environments should be short-lived. After bootstrapping and initial provisioning, there is no need for developers to have account credentials at all. Changes can be deployed through the pipeline. Reduce the possibility of credentials leaking by not needing them in the first place.
-
-[#cdk-pipeline-troubleshooting]
-== Troubleshooting
-
-The following issues are commonly encountered while getting started with CDK Pipelines.
-
-*Pipeline: Internal Failure*::
-+
-----
-CREATE_FAILED | {aws}::CodePipeline::Pipeline | Pipeline/Pipeline
-Internal Failure
-----
-+
-Check your GitHub access token. It might be missing, or might not have the permissions to access the repository.
-
-*Key: Policy contains a statement with one or more invalid principals*::
-+
-----
-CREATE_FAILED | {aws}::KMS::Key | Pipeline/Pipeline/ArtifactsBucketEncryptionKey
-Policy contains a statement with one or more invalid principals.
-----
-+
-One of the target environments has not been bootstrapped with the new bootstrap stack. Make sure all your target environments are bootstrapped.
-
-*Stack is in ROLLBACK_COMPLETE state and cannot be updated*::
-+
-----
-Stack is in ROLLBACK_COMPLETE state and cannot be updated. (Service:
-AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request
-ID: ...)
-----
-+
-The stack failed its previous deployment and is in a non-retryable state. Delete the stack from the {aws} CloudFormation console and retry the deployment.
\ No newline at end of file
diff --git a/v2/guide/create-multiple-stacks.adoc b/v2/guide/create-multiple-stacks.adoc
deleted file mode 100644
index 12f94f87..00000000
--- a/v2/guide/create-multiple-stacks.adoc
+++ /dev/null
@@ -1,593 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#stack-how-to-create-multiple-stacks]
-= Example: Create a CDK app with multiple stacks
-:info_titleabbrev: Example: CDK app with multiple stacks
-
-// Content start
-
-You can create an {aws} Cloud Development Kit ({aws} CDK) application containing multiple xref:stacks[stacks]. When you deploy the {aws} CDK app, each stack becomes its own {aws} CloudFormation template. You can also synthesize and deploy each stack individually using the {aws} CDK CLI `cdk deploy` command.
-
-In this example, we cover the following:
-
-* How to extend the `Stack` class to accept new properties or arguments.
-* How to use properties to determine which resources the stack contains and their configuration.
-* How to instantiate multiple stacks from this class.
-
-The example in this topic uses a Boolean property, named `encryptBucket` (Python: `encrypt_bucket`). It indicates whether an Amazon S3 bucket should be encrypted. If so, the stack enables encryption using a key managed by {aws} Key Management Service ({aws} KMS). The app creates two instances of this stack, one with encryption and one without.
-
-[#cdk-how-to-create-multiple-stacks-prereqs]
-== Prerequisites
-
-This example assumes that all xref:getting-started[getting started] steps have been completed.
-
-[#cdk-how-to-create-multiple-stacks-create]
-== Create a CDK project
-
-First, we create a CDK project using the CDK CLI:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir multistack
-cd multistack
-cdk init --language=typescript
-----
-
-JavaScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir multistack
-cd multistack
-cdk init --language=javascript
-----
-
-Python::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir multistack
-cd multistack
-cdk init --language=python
-source .venv/bin/activate # On Windows, run '.\venv\Scripts\activate' instead
-pip install -r requirements.txt
-----
-
-Java::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir multistack
-cd multistack
-cdk init --language=java
-----
-+
-You can import the resulting Maven project into your Java IDE.
-
-C#::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir multistack
-cd multistack
-cdk init --language=csharp
-----
-+
-You can open the file `src/Pipeline.sln` in Visual Studio.
-====
-
-[#cdk-how-to-create-multiple-stacks-extend-stackprops]
-== Add an optional parameter
-
-The `props` argument of the `Stack` constructor fulfills the interface `StackProps`. In this example, we want the stack to accept an additional property to tell us whether to encrypt the Amazon S3 bucket. To do this, we create an interface or class that includes the property. This allows the compiler to make sure that the property has a Boolean value and enables auto-completion for it in your IDE.
-
-We open our _stack file_ in our IDE or editor and add the new interface, class, or argument. New lines are highlighted in bold:
-
-====
-[role="tablist"]
-TypeScript::
-File: `lib/multistack-stack.ts`
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-
-interface MultiStackProps extends cdk.StackProps {
- encryptBucket?: boolean;
-}
-
-export class MultistackStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: MultiStackProps) {
- super(scope, id, props);
-
- // The code that defines our stack goes here
- }
-}
-----
-
-JavaScript::
-File: `lib/multistack-stack.js`
-+
-JavaScript doesn't have an interface feature; we don't need to add any code.
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-stack');
-
-class MultistackStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // The code that defines our stack goes here
- }
-}
-
-module.exports = { MultistackStack }
-----
-
-Python::
-File: `multistack/multistack_stack.py`
-+
-Python does not have an interface feature, so we'll extend our stack to accept the new property by adding a keyword argument.
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-
-class MultistackStack(cdk.Stack):
-
- # The Stack class doesn't know about our encrypt_bucket parameter,
- # so accept it separately and pass along any other keyword arguments.
- def __init__(self, scope: Construct, id: str, *, encrypt_bucket=False,
- **kwargs) -> None:
- super().__init__(scope, id, **kwargs)
-
- # The code that defines our stack goes here
-----
-
-Java::
-File: `src/main/java/com/myorg/MultistackStack.java`
-+
-It's more complicated than we really want to get into to extend a props type in Java. Instead, write the stack's constructor to accept an optional Boolean parameter. Because `props` is an optional argument, we'll write an additional constructor that lets you skip it. It will default to `false`.
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.constructs.Construct;
-
-import software.amazon.awscdk.services.s3.Bucket;
-
-public class MultistackStack extends Stack {
- // additional constructors to allow props and/or encryptBucket to be omitted
- public MultistackStack(final Construct scope, final String id, boolean encryptBucket) {
- this(scope, id, null, encryptBucket);
- }
-
- public MultistackStack(final Construct scope, final String id) {
- this(scope, id, null, false);
- }
-
- public MultistackStack(final Construct scope, final String id, final StackProps props,
- final boolean encryptBucket) {
- super(scope, id, props);
-
- // The code that defines our stack goes here
- }
-}
-----
-
-C#::
-File: `src/Multistack/MultistackStack.cs`
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using constructs;
-
-namespace Multistack
-{
-
-
- public class MultiStackProps : StackProps
- {
- public bool? EncryptBucket { get; set; }
- }
-
-
- public class MultistackStack : Stack
- {
- public MultistackStack(Construct scope, string id, MultiStackProps props) : base(scope, id, props)
- {
- // The code that defines our stack goes here
- }
- }
-}
-----
-====
-
-The new property is optional. If `encryptBucket` (Python: `encrypt_bucket`) is not present, its value is `undefined`, or the local equivalent. The bucket will be unencrypted by default.
-
-[#cdk-how-to-create-multiple-stacks-define-stack]
-== Define the stack class
-
-Next, we define our stack class, using our new property. New code is highlighted in bold:
-
-====
-[role="tablist"]
-TypeScript::
-File: `lib/multistack-stack.ts`
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from constructs;
-import * as s3 from 'aws-cdk-lib/aws-s3';
-
-interface MultistackProps extends cdk.StackProps {
- encryptBucket?: boolean;
-}
-
-export class MultistackStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: MultistackProps) {
- super(scope, id, props);
-
- // Add a Boolean property "encryptBucket" to the stack constructor.
- // If true, creates an encrypted bucket. Otherwise, the bucket is unencrypted.
- // Encrypted bucket uses KMS-managed keys (SSE-KMS).
- if (props && props.encryptBucket) {
- new s3.Bucket(this, "MyGroovyBucket", {
- encryption: s3.BucketEncryption.KMS_MANAGED,
- removalPolicy: cdk.RemovalPolicy.DESTROY
- });
- } else {
- new s3.Bucket(this, "MyGroovyBucket", {
- removalPolicy: cdk.RemovalPolicy.DESTROY});
- }
- }
-}
-----
-
-JavaScript::
-File: `lib/multistack-stack.js`
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const cdk = require('aws-cdk-lib');
-const s3 = require('aws-cdk-lib/aws-s3');
-
-class MultistackStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // Add a Boolean property "encryptBucket" to the stack constructor.
- // If true, creates an encrypted bucket. Otherwise, the bucket is unencrypted.
- // Encrypted bucket uses KMS-managed keys (SSE-KMS).
- if ( props && props.encryptBucket) {
- new s3.Bucket(this, "MyGroovyBucket", {
- encryption: s3.BucketEncryption.KMS_MANAGED,
- removalPolicy: cdk.RemovalPolicy.DESTROY
- });
- } else {
- new s3.Bucket(this, "MyGroovyBucket", {
- removalPolicy: cdk.RemovalPolicy.DESTROY});
- }
- }
-}
-
-module.exports = { MultistackStack }
-----
-
-Python::
-File: `multistack/multistack_stack.py`
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as cdk
-from constructs import Construct
-from aws_cdk import aws_s3 as s3
-
-class MultistackStack(cdk.Stack):
-
- # The Stack class doesn't know about our encrypt_bucket parameter,
- # so accept it separately and pass along any other keyword arguments.
- def __init__(self, scope: Construct, id: str, *, encrypt_bucket=False,
- **kwargs) -> None:
- super().__init__(scope, id, **kwargs)
-
- # Add a Boolean property "encryptBucket" to the stack constructor.
- # If true, creates an encrypted bucket. Otherwise, the bucket is unencrypted.
- # Encrypted bucket uses KMS-managed keys (SSE-KMS).
- if encrypt_bucket:
- s3.Bucket(self, "MyGroovyBucket",
- encryption=s3.BucketEncryption.KMS_MANAGED,
- removal_policy=cdk.RemovalPolicy.DESTROY)
- else:
- s3.Bucket(self, "MyGroovyBucket",
- removal_policy=cdk.RemovalPolicy.DESTROY)
-----
-
-Java::
-File: `src/main/java/com/myorg/MultistackStack.java`
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.constructs.Construct;
-import software.amazon.awscdk.RemovalPolicy;
-
-import software.amazon.awscdk.services.s3.Bucket;
-import software.amazon.awscdk.services.s3.BucketEncryption;
-
-public class MultistackStack extends Stack {
- // additional constructors to allow props and/or encryptBucket to be omitted
- public MultistackStack(final Construct scope, final String id,
- boolean encryptBucket) {
- this(scope, id, null, encryptBucket);
- }
-
- public MultistackStack(final Construct scope, final String id) {
- this(scope, id, null, false);
- }
-
- // main constructor
- public MultistackStack(final Construct scope, final String id,
- final StackProps props, final boolean encryptBucket) {
- super(scope, id, props);
-
- // Add a Boolean property "encryptBucket" to the stack constructor.
- // If true, creates an encrypted bucket. Otherwise, the bucket is
- // unencrypted. Encrypted bucket uses KMS-managed keys (SSE-KMS).
- if (encryptBucket) {
- Bucket.Builder.create(this, "MyGroovyBucket")
- .encryption(BucketEncryption.KMS_MANAGED)
- .removalPolicy(RemovalPolicy.DESTROY).build();
- } else {
- Bucket.Builder.create(this, "MyGroovyBucket")
- .removalPolicy(RemovalPolicy.DESTROY).build();
- }
- }
-}
-----
-
-C#::
-File: `src/Multistack/MultistackStack.cs`
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.{aws}.S3;
-
-namespace Multistack
-{
-
- public class MultiStackProps : StackProps
- {
- public bool? EncryptBucket { get; set; }
- }
-
- public class MultistackStack : Stack
- {
- public MultistackStack(Construct scope, string id, IMultiStackProps props = null) : base(scope, id, props)
- {
- // Add a Boolean property "EncryptBucket" to the stack constructor.
- // If true, creates an encrypted bucket. Otherwise, the bucket is unencrypted.
- // Encrypted bucket uses KMS-managed keys (SSE-KMS).
- if (props?.EncryptBucket ?? false)
- {
- new Bucket(this, "MyGroovyBucket", new BucketProps
- {
- Encryption = BucketEncryption.KMS_MANAGED,
- RemovalPolicy = RemovalPolicy.DESTROY
- });
- }
- else
- {
- new Bucket(this, "MyGroovyBucket", new BucketProps
- {
- RemovalPolicy = RemovalPolicy.DESTROY
- });
- }
- }
- }
-}
-----
-====
-
-[#stack-how-to-create-multiple-stacks-create-stacks]
-== Create two stack instances
-
-In our _application file_, we add the code to instantiate two separate stacks. We delete the existing `MultistackStack` definition and define our two stacks. New code is highlight in bold:
-
-====
-[role="tablist"]
-TypeScript::
-File: `bin/multistack.ts`
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-import 'source-map-support/register';
-import * as cdk from 'aws-cdk-lib';
-import { MultistackStack } from '../lib/multistack-stack';
-
-const app = new cdk.App();
-
-new MultistackStack(app, "MyWestCdkStack", {
- env: {region: "us-west-1"},
- encryptBucket: false
-});
-
-new MultistackStack(app, "MyEastCdkStack", {
- env: {region: "us-east-1"},
- encryptBucket: true
-});
-
-app.synth();
-----
-
-JavaScript::
-File: `bin/multistack.js`
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-const cdk = require('aws-cdk-lib');
-const { MultistackStack } = require('../lib/multistack-stack');
-
-const app = new cdk.App();
-
-new MultistackStack(app, "MyWestCdkStack", {
- env: {region: "us-west-1"},
- encryptBucket: false
-});
-
-new MultistackStack(app, "MyEastCdkStack", {
- env: {region: "us-east-1"},
- encryptBucket: true
-});
-
-app.synth();
-----
-
-Python::
-File: `./app.py`
-+
-[source,python,subs="verbatim,attributes"]
-----
-#!/usr/bin/env python3
-
-import aws_cdk as cdk
-
-from multistack.multistack_stack import MultistackStack
-
-app = cdk.App()
-MultistackStack(app, "MyWestCdkStack",
- env=cdk.Environment(region="us-west-1"),
- encrypt_bucket=False)
-
-MultistackStack(app, "MyEastCdkStack",
- env=cdk.Environment(region="us-east-1"),
- encrypt_bucket=True)
-
-app.synth()
-----
-
-Java::
-File: `src/main/java/com/myorg/MultistackApp.java`
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.Environment;
-import software.amazon.awscdk.StackProps;
-
-public class MultistackApp {
- public static void main(final String argv[]) {
- App app = new App();
-
- new MultistackStack(app, "MyWestCdkStack", StackProps.builder()
- .env(Environment.builder()
- .region("us-west-1")
- .build())
- .build(), false);
-
- new MultistackStack(app, "MyEastCdkStack", StackProps.builder()
- .env(Environment.builder()
- .region("us-east-1")
- .build())
- .build(), true);
-
- app.synth();
- }
-}
-----
-
-C#::
-File: src/Multistack/Program.cs
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-
-namespace Multistack
-{
- class Program
- {
- static void Main(string[] args)
- {
- var app = new App();
-
- new MultistackStack(app, "MyWestCdkStack", new MultiStackProps
- {
- Env = new Environment { Region = "us-west-1" },
- EncryptBucket = false
- });
-
- new MultistackStack(app, "MyEastCdkStack", new MultiStackProps
- {
- Env = new Environment { Region = "us-east-1" },
- EncryptBucket = true
- });
-
- app.Synth();
- }
- }
-}
-----
-====
-
-This code uses the new `encryptBucket` (Python: `encrypt_bucket`) property on the `MultistackStack` class to instantiate the following:
-
-* One stack with an encrypted Amazon S3 bucket in the `us-east-1` {aws} Region.
-* One stack with an unencrypted Amazon S3 bucket in the `us-west-1` {aws} Region.
-
-[#cdk-how-to-create-multiple-stacks-synth-deploy]
-== Synthesize and deploy the stack
-
-Next, we can deploy stacks from the app. First, we synthesize an {aws} CloudFormation template for `MyEastCdkStack`. This is the stack in `us-east-1` with the encrypted Amazon S3 bucket.
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk synth MyEastCdkStack
-----
-
-To deploy this stack to our {aws} environment, we can issue one of the following commands. The first command uses our default {aws} profile to obtain the credentials to deploy the stack. The second uses a profile that we specify. For `PROFILE_NAME`, we can substitute the name of an {aws} CLI profile that contains appropriate credentials for deploying to the `us-east-1` {aws} Region.
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy MyEastCdkStack
-----
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy MyEastCdkStack --profile=
-----
-
-[#cdk-how-to-create-multiple-stacks-destroy-stack]
-== Clean up
-
-To avoid charges for resources that we deployed, we destroy the stack using the following command:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk destroy MyEastCdkStack
-----
-
-The destroy operation fails if there is anything stored in the stack's bucket. There shouldn't be, since we only created the bucket. If we did put something in the bucket, we must delete the bucket contents before destroying the stack. We can use the {aws} Management Console or the {aws} CLI to delete the bucket contents.
\ No newline at end of file
diff --git a/v2/guide/customize-permissions-boundaries.adoc b/v2/guide/customize-permissions-boundaries.adoc
deleted file mode 100644
index 02f7f3c0..00000000
--- a/v2/guide/customize-permissions-boundaries.adoc
+++ /dev/null
@@ -1,54 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#customize-permissions-boundaries]
-= Create and apply permissions boundaries for the {aws} CDK
-:info_titleabbrev: Create and apply permissions boundaries
-:keywords: {aws} CDK, IAM, security, permissions, Permissions boundaries
-
-[abstract]
---
-A _permissions boundary_ is an {aws} Identity and Access Management (IAM) advanced feature that you can use to set the maximum permissions that an IAM entity, such as a user or role, can have. You can use permissions boundaries to restrict the actions that IAM entities can perform when using the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-A _permissions boundary_ is an {aws} Identity and Access Management (IAM) advanced feature that you can use to set the maximum permissions that an IAM entity, such as a user or role, can have. You can use permissions boundaries to restrict the actions that IAM entities can perform when using the {aws} Cloud Development Kit ({aws} CDK).
-
-To learn more about permissions boundaries, see link:https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html[Permissions boundaries for IAM entities] in the _IAM User Guide_.
-
-[#customize-permissions-boundaries-when]
-== When to use permissions boundaries with the {aws} CDK
-
-Consider applying permissions boundaries when you need to restrict developers in your organization from performing certain actions with the {aws} CDK. For example, if there are specific resources in your {aws} environment that you don't want developers to modify, you can create and apply a permissions boundary.
-
-[#customize-permissions-boundaries-how]
-== How to apply permissions boundaries with the {aws} CDK
-
-[#customize-permissions-boundaries-how-create]
-=== Create the permissions boundary
-
-First, you create the permissions boundary, using an {aws} managed policy or a customer managed policy to set the boundary for an IAM entity (user or role). This policy limits the maximum permissions for the user or role. For instructions on creating permissions boundaries, see link:https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html[Permissions boundaries for IAM entities] in the _IAM User Guide_.
-
-Permissions boundaries set the maximum permissions that an IAM entity can have, but don't grant permissions on their own. You must use permissions boundaries with IAM policies to effectively limit and grant the proper permissions for your organization. You must also prevent IAM entities from being able to escape the boundaries that you set. For an example, see link:https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html#access_policies_boundaries-delegate[Delegating responsibility to others using permissions boundaries] in the _IAM User Guide_.
-
-[#customize-permissions-boundaries-how-apply]
-=== Apply the permissions boundary during bootstrapping
-
-After creating the permissions boundary, you can enforce it for the {aws} CDK by applying it during bootstrapping.
-
-Use the xref:ref-cli-cmd-bootstrap-options-custom-permissions-boundary[`--custom-permissions-boundary`] option and specify the name of the permissions boundary to apply. The following is an example that applies a permissions boundary named `cdk-permissions-boundary`:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --custom-permissions-boundary
-----
-
-By default, the CDK uses the `CloudFormationExecutionRole` IAM role, defined in the bootstrap template, to receive permissions for performing deployments. By applying the custom permissions boundary during bootstrapping, the permissions boundary gets attached to this role. The permissions boundary will then set the maximum permissions that can be performed by developers in your organization when using the {aws} CDK. To learn more about this role, see xref:bootstrapping-env-roles[IAM roles created during bootstrapping].
-
-When you apply permissions boundaries in this way, they are applied to the specific environment that you bootstrap. To use the same permissions boundary across multiple environments, you must apply the permissions boundary for each environment during bootstrapping. You can also apply different permissions boundaries for different environments.
-
-[#customize-permissions-boundaries-learn]
-== Learn more
-
-For more information on permissions boundaries, see https://aws.amazon.com/blogs/security/when-and-where-to-use-iam-permissions-boundaries/[When and where to use IAM permissions boundaries] in the _{aws} Security Blog_.
\ No newline at end of file
diff --git a/v2/guide/customize-synth.adoc b/v2/guide/customize-synth.adoc
deleted file mode 100644
index 2642f0e8..00000000
--- a/v2/guide/customize-synth.adoc
+++ /dev/null
@@ -1,663 +0,0 @@
-include::attributes.txt[]
-
-[.topic]
-[#customize-synth]
-= Customize CDK stack synthesis
-:info_titleabbrev: Customize CDK synthesis
-:keywords: {aws} CDK, {aws} CloudFormation stack, synthesis, cdk synth, {aws} CloudFormation template, Customize
-
-[abstract]
---
-You can customize {aws} Cloud Development Kit ({aws} CDK) stack synthesis by modifying the default synthesizer, using other available built-in synthesizers, or create your own synthesizer.
---
-
-// Content start
-
-You can customize {aws} Cloud Development Kit ({aws} CDK) stack synthesis by modifying the default synthesizer, using other available built-in synthesizers, or creating your own synthesizer.
-
-The {aws} CDK includes the following built-in synthesizers that you can use to customize synthesis behavior:
-
-* link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.DefaultStackSynthesizer.html[`DefaultStackSynthesizer`] – If you don`'t specify a synthesizer, this one is used automatically. It supports cross-account deployments and deployments using the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines-readme.html[CDK Pipelines] construct. Its bootstrap contract requires an existing Amazon S3 bucket with a known name, an existing Amazon ECR repository with a known name, and five existing IAM roles with known names. The default bootstrapping template meets these requirements.
-* link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CliCredentialsStackSynthesizer.html[`CliCredentialsStackSynthesizer`] – This synthesizer's bootstrap contract requires an existing Amazon S3 bucket and existing Amazon ECR repository. It does not require any IAM roles. To perform deployments, this synthesizer relies on the permissions of the CDK CLI user and is recommend for organizations that want to restrict IAM deployment credentials. This synthesizer doesn't support cross-account deployments or CDK Pipelines.
-* link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.LegacyStackSynthesizer.html[`LegacyStackSynthesizer`] – This synthesizer emulates CDK v1 synthesis behavior. Its bootstrap contract requires an existing Amazon S3 bucket of an arbitrary name and expects the locations of assets to be passed in as CloudFormation stack parameters. If you use this synthesizer, you must use the CDK CLI to perform deployment.
-
-If none of these built-in synthesizers are appropriate for your use case, you can write your own synthesizer as a class that implements `IStackSynthesizer` or look at link:https://constructs.dev/search?q=synthesizer&cdk=aws-cdk[synthesizers] from the Construct Hub.
-
-[#bootstrapping-custom-synth-default]
-== Customize the `DefaultStackSynthesizer`
-
-The `DefaultStackSynthesizer` is the default synthesizer for the {aws} CDK. It is designed to allow cross-account deployments of CDK applications, as well as deploying CDK apps from a CI/CD system that does not have explicit support for the {aws} CDK, but supports regular CloudFormation deployments, such as {aws} CodePipeline. This synthesizer is the best option for most use cases.
-
-[#bootstrapping-custom-synth-default-contract]
-=== `DefaultStackSynthesizer` bootstrap contract
-
-`DefaultStackSynthesizer` requires the following bootstrap contract. These are the resources that must be created during bootstrapping:
-
-[cols="1,1,1,1", frame="all", options="header"]
-|===
-| Bootstrap resource
-| Description
-| Default expected resource name
-| Purpose
-
-|Amazon S3 bucket
-|Staging bucket
-|cdk-hnb659fds-assets--
-|Stores file assets.
-
-|Amazon ECR repository
-|Staging repository
-|cdk-hnb659fds-container-assets--
-|Stores and manages Docker image assets.
-
-|IAM role
-|Deploy role
-|cdk-hnb659fds-deploy-role--
-|Assumed by the CDK CLI and potentially CodePipeline to assume other roles and start the {aws} CloudFormation deployment.
-
-The trust policy of this role controls who can deploy with the {aws} CDK in this {aws} environment.
-
-|IAM role
-|{aws} CloudFormation execution role
-|cdk-hnb659fds-cfn-exec-role--
-|This role is used by {aws} CloudFormation to perform the deployment.
-
-The policies of this role control what operations the CDK deployment can perform.
-
-|IAM role
-|Lookup role
-|cdk-hnb659fds-lookup-role--
-|This role is used when the CDK CLI needs to perform environmental context lookups.
-
-The trust policy of this role controls who can look up information in the environment.
-
-|IAM role
-|File publishing role
-|cdk-hnb659fds-file-publishing-role--
-|This role is used to upload assets to the Amazon S3 staging bucket. It is assumed from the deploy role.
-
-|IAM role
-|Image publishing role
-|cdk-hnb659fds-image-publishing-role--
-|This role is used to upload Docker images to the Amazon ECR staging repository. It is assumed from the deploy role.
-
-|SSM parameter
-|Bootstrap version parameter
-|/cdk-bootstrap/hnb659fds/
-|The version of the bootstrap template. It is used by the bootstrap template and the CDK CLI to validate requirements.
-|===
-
-One way to customize CDK stack synthesis, is by modifying the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.DefaultStackSynthesizer.html[`DefaultStackSynthesizer`]. You can customize this synthesizer for a single CDK stack using the `synthesizer` property of your `Stack` instance. You can also modify `DefaultStackSynthesizer` for all stacks in your CDK app using the `defaultStackSynthesizer` property of your `App` instance.
-
-[#bootstrapping-custom-synth-qualifiers]
-=== Change the qualifier
-
-The _qualifier_ is added to the name of resources created during bootstrapping. By default, this value is `hnb659fds`. When you modify the qualifier during bootstrapping, you need to customize CDK stack synthesis to use the same qualifier.
-
-To change the qualifier, configure the `qualifier` property of `DefaultStackSynthesizer` or configure the qualifier as a context key in your CDK project`'s `cdk.json` file.
-
-The following is an example of configuring the `qualifier` property of the `DefaultStackSynthesizer`:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new DefaultStackSynthesizer({
- qualifier: 'MYQUALIFIER',
- }),
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new DefaultStackSynthesizer({
- qualifier: 'MYQUALIFIER',
- }),
-})
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-MyStack(self, "MyStack",
- synthesizer=DefaultStackSynthesizer(
- qualifier="MYQUALIFIER"
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", StackProps.builder()
- .synthesizer(DefaultStackSynthesizer.Builder.create()
- .qualifier("MYQUALIFIER")
- .build())
- .build();
-)
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-new MyStack(app, "MyStack", new StackProps
-{
- Synthesizer = new DefaultStackSynthesizer(new DefaultStackSynthesizerProps
- {
- Qualifier = "MYQUALIFIER"
- })
-});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-func NewMyStack(scope constructs.Construct, id string, props *MyStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- synth := awscdk.NewDefaultStackSynthesizer(&awscdk.DefaultStackSynthesizerProps{
- Qualifier: jsii.String("MYQUALIFIER"),
- })
-
- stack.SetSynthesizer(synth)
-
- return stack
-}
-----
-====
-
-The following is an example of configuring the qualifier as a context key in `cdk.json`:
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "app": "...",
- "context": {
- "@aws-cdk/core:bootstrapQualifier": "MYQUALIFIER"
- }
-}
-----
-
-[#bootstrapping-custom-synth-names]
-=== Change resource names
-
-All of the other `DefaultStackSynthesizer` properties relate to the names of the resources in the bootstrap template. You only need to provide any of these properties if you modified the bootstrap template and changed the resource names or naming scheme.
-
-All properties accept the special placeholders `${Qualifier}`, `${AWS::Partition}`, `${AWS::AccountId}`, and `${AWS::Region}`. These placeholders are replaced with the values of the `qualifier` parameter and the {aws} partition, account ID, and {aws} Region values for the stack's environment, respectively.
-
-The following example shows the most commonly used properties for `DefaultStackSynthesizer` along with their default values, as if you were instantiating the synthesizer. For a complete list, see link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.DefaultStackSynthesizerProps.html#properties[`DefaultStackSynthesizerProps`]:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript]
-----
-new DefaultStackSynthesizer({
- // Name of the S3 bucket for file assets
- fileAssetsBucketName: 'cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}',
- bucketPrefix: '',
-
- // Name of the ECR repository for Docker image assets
- imageAssetsRepositoryName: 'cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}',
- dockerTagPrefix: '',
-
- // ARN of the role assumed by the CLI and Pipeline to deploy here
- deployRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}',
- deployRoleExternalId: '',
-
- // ARN of the role used for file asset publishing (assumed from the CLI role)
- fileAssetPublishingRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}',
- fileAssetPublishingExternalId: '',
-
- // ARN of the role used for Docker asset publishing (assumed from the CLI role)
- imageAssetPublishingRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}',
- imageAssetPublishingExternalId: '',
-
- // ARN of the role passed to CloudFormation to execute the deployments
- cloudFormationExecutionRole: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}',
-
- // ARN of the role used to look up context information in an environment
- lookupRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-lookup-role-${AWS::AccountId}-${AWS::Region}',
- lookupRoleExternalId: '',
-
- // Name of the SSM parameter which describes the bootstrap stack version number
- bootstrapStackVersionSsmParameter: '/cdk-bootstrap/${Qualifier}/version',
-
- // Add a rule to every template which verifies the required bootstrap stack version
- generateBootstrapVersionRule: true,
-
-})
-----
-
-JavaScript::
-+
-[source,javascript]
-----
-new DefaultStackSynthesizer({
- // Name of the S3 bucket for file assets
- fileAssetsBucketName: 'cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}',
- bucketPrefix: '',
-
- // Name of the ECR repository for Docker image assets
- imageAssetsRepositoryName: 'cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}',
- dockerTagPrefix: '',
-
- // ARN of the role assumed by the CLI and Pipeline to deploy here
- deployRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}',
- deployRoleExternalId: '',
-
- // ARN of the role used for file asset publishing (assumed from the CLI role)
- fileAssetPublishingRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}',
- fileAssetPublishingExternalId: '',
-
- // ARN of the role used for Docker asset publishing (assumed from the CLI role)
- imageAssetPublishingRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}',
- imageAssetPublishingExternalId: '',
-
- // ARN of the role passed to CloudFormation to execute the deployments
- cloudFormationExecutionRole: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}',
-
- // ARN of the role used to look up context information in an environment
- lookupRoleArn: 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-lookup-role-${AWS::AccountId}-${AWS::Region}',
- lookupRoleExternalId: '',
-
- // Name of the SSM parameter which describes the bootstrap stack version number
- bootstrapStackVersionSsmParameter: '/cdk-bootstrap/${Qualifier}/version',
-
- // Add a rule to every template which verifies the required bootstrap stack version
- generateBootstrapVersionRule: true,
-})
-----
-
-Python::
-+
-[source,python]
-----
-DefaultStackSynthesizer(
- # Name of the S3 bucket for file assets
- file_assets_bucket_name="cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}",
- bucket_prefix="",
-
- # Name of the ECR repository for Docker image assets
- image_assets_repository_name="cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}",
- docker_tag_prefix="",
-
- # ARN of the role assumed by the CLI and Pipeline to deploy here
- deploy_role_arn="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}",
- deploy_role_external_id="",
-
- # ARN of the role used for file asset publishing (assumed from the CLI role)
- file_asset_publishing_role_arn="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}",
- file_asset_publishing_external_id="",
-
- # ARN of the role used for Docker asset publishing (assumed from the CLI role)
- image_asset_publishing_role_arn="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}",
- image_asset_publishing_external_id="",
-
- # ARN of the role passed to CloudFormation to execute the deployments
- cloud_formation_execution_role="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
-
- # ARN of the role used to look up context information in an environment
- lookup_role_arn="arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-lookup-role-${AWS::AccountId}-${AWS::Region}",
- lookup_role_external_id="",
-
- # Name of the SSM parameter which describes the bootstrap stack version number
- bootstrap_stack_version_ssm_parameter="/cdk-bootstrap/${Qualifier}/version",
-
- # Add a rule to every template which verifies the required bootstrap stack version
- generate_bootstrap_version_rule=True,
-)
-----
-
-Java::
-+
-[source,java]
-----
-DefaultStackSynthesizer.Builder.create()
- // Name of the S3 bucket for file assets
- .fileAssetsBucketName("cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}")
- .bucketPrefix('')
-
- // Name of the ECR repository for Docker image assets
- .imageAssetsRepositoryName("cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}")
- .dockerTagPrefix('')
-
- // ARN of the role assumed by the CLI and Pipeline to deploy here
- .deployRoleArn("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}")
- .deployRoleExternalId("")
-
- // ARN of the role used for file asset publishing (assumed from the CLI role)
- .fileAssetPublishingRoleArn("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}")
- .fileAssetPublishingExternalId("")
-
- // ARN of the role used for Docker asset publishing (assumed from the CLI role)
- .imageAssetPublishingRoleArn("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}")
- .imageAssetPublishingExternalId("")
-
- // ARN of the role passed to CloudFormation to execute the deployments
- .cloudFormationExecutionRole("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}")
-
- .lookupRoleArn("arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-lookup-role-${AWS::AccountId}-${AWS::Region}")
- .lookupRoleExternalId("")
-
- // Name of the SSM parameter which describes the bootstrap stack version number
- .bootstrapStackVersionSsmParameter("/cdk-bootstrap/${Qualifier}/version")
-
- // Add a rule to every template which verifies the required bootstrap stack version
- .generateBootstrapVersionRule(true)
-.build()
-----
-
-C#::
-+
-[source,csharp]
-----
-new DefaultStackSynthesizer(new DefaultStackSynthesizerProps
-{
- // Name of the S3 bucket for file assets
- FileAssetsBucketName = "cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}",
- BucketPrefix = "",
-
- // Name of the ECR repository for Docker image assets
- ImageAssetsRepositoryName = "cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}",
- DockerTagPrefix = "",
-
- // ARN of the role assumed by the CLI and Pipeline to deploy here
- DeployRoleArn = "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}",
- DeployRoleExternalId = "",
-
- // ARN of the role used for file asset publishing (assumed from the CLI role)
- FileAssetPublishingRoleArn = "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}",
- FileAssetPublishingExternalId = "",
-
- // ARN of the role used for Docker asset publishing (assumed from the CLI role)
- ImageAssetPublishingRoleArn = "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}",
- ImageAssetPublishingExternalId = "",
-
- // ARN of the role passed to CloudFormation to execute the deployments
- CloudFormationExecutionRole = "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
-
- LookupRoleArn = "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${Qualifier}-lookup-role-${AWS::AccountId}-${AWS::Region}",
- LookupRoleExternalId = "",
-
- // Name of the SSM parameter which describes the bootstrap stack version number
- BootstrapStackVersionSsmParameter = "/cdk-bootstrap/${Qualifier}/version",
-
- // Add a rule to every template which verifies the required bootstrap stack version
- GenerateBootstrapVersionRule = true,
-})
-----
-====
-
-[#bootstrapping-custom-synth-cli]
-== Use `CliCredentialsStackSynthesizer`
-
-To modify the security credentials used to provide permissions during CDK deployments, you can customize synthesis by using link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CliCredentialsStackSynthesizer.html[`CliCredentialsStackSynthesizer`]. This synthesizer works with the default {aws} resources that are created during bootstrapping to store assets, such as the Amazon S3 bucket and Amazon ECR repository. Instead of using the default IAM roles created by the CDK during bootstrapping, it uses the security credentials of the actor initiating deployment. Therefore, the security credentials of the actor must have valid permissions to perform all deployment actions. The following diagram illustrates the deployment process when using this synthesizer:
-
-image::./images/CliCredentialsStackSynthesizer-deploy-process_cdk_flowchart.png["Deployment process using the CLICredentialsStackSynthesizer.",scaledwidth=100%]
-
-When using `CliCredentialsStackSynthesizer`:
-
-* By default, CloudFormation performs API calls in your account using the permissions of the actor. Therefore, the current identity must have permission to make necessary changes to the {aws} resources in the CloudFormation stack, along with the permissions to perform necessary CloudFormation operations, such as `CreateStack` or `UpdateStack`. Deployment capabilities will be limited to the permissions of the actor.
-* Asset publishing and CloudFormation deployments will be done using the current IAM identity. This identity must have sufficient permissions to both read from and write to the asset bucket and repository.
-* Lookups are performed using the current IAM identity, and lookups are subject to its policies.
-
-When using this synthesizer, you can use a separate CloudFormation execution role by specifying it using the xref:ref-cli-cmd-options-role-arn[`--role-arn`] option with any CDK CLI command.
-
-[#bootstrapping-custom-synth-cli-contract]
-=== `CliCredentialsStackSynthesizer` bootstrap contract
-
-`CliCredentialsStackSynthesizer` requires the following bootstrap contract. These are the resources that must be created during bootstrapping:
-
-[cols="1,1,1,1", frame="all", options="header"]
-|===
-| Bootstrap resource
-| Description
-| Default expected resource name
-| Purpose
-
-|Amazon S3 bucket
-|Staging bucket
-|cdk-hnb659fds-assets--
-|Stores file assets.
-
-|Amazon ECR repository
-|Staging repository
-|cdk-hnb659fds-container-assets--
-|Stores and manages Docker image assets.
-|===
-
-The string `hnb659fds` in the resource name is called the _qualifier_. Its default value has no special significance. You can have multiple copies of the bootstrap resources in a single environment as long as they have a different qualifier. Having multiple copies can be useful for keeping assets of different applications in the same environment separated.
-
-You can deploy the default bootstrap template to satisfy ``CliCredentialsStackSynthesizer``'s bootstrap contract. The default bootstrap template will create IAM roles, but this synthesizer will not use them. You can also customize the bootstrap template to remove the IAM roles.
-
-[#bootstrapping-custom-synth-cli-modify]
-=== Modify `CliCredentialsStackSynthesizer`
-
-If you change the qualifier or any of the default bootstrap resource names during bootstrapping, you have to modify the synthesizer to use the same names. You can modify the synthesizer for a single stack or for all stacks in your app. The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new CliCredentialsStackSynthesizer({
- qualifier: 'MYQUALIFIER',
- }),
-});
-----
-
-JavaScript::
-+
-[source,javascript]
-----
-new MyStack(this, 'MyStack', {
- synthesizer: new CliCredentialsStackSynthesizer({
- qualifier: 'MYQUALIFIER',
- }),
-})
-----
-
-Python::
-+
-[source,python]
-----
-MyStack(self, "MyStack",
- synthesizer=CliCredentialsStackSynthesizer(
- qualifier="MYQUALIFIER"
-))
-----
-
-Java::
-+
-[source,java]
-----
-new MyStack(app, "MyStack", StackProps.builder()
- .synthesizer(CliCredentialsStackSynthesizer.Builder.create()
- .qualifier("MYQUALIFIER")
- .build())
- .build();
-)
-----
-
-C#::
-+
-[source,csharp]
-----
-new MyStack(app, "MyStack", new StackProps
-{
- Synthesizer = new CliCredentialsStackSynthesizer(new CliCredentialsStackSynthesizerProps
- {
- Qualifier = "MYQUALIFIER"
- })
-});
-----
-====
-
-The following example shows the most commonly used properties for `CliCredentialsStackSynthesizer` along with their default values. For a complete list, see link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CliCredentialsStackSynthesizerProps.html[`CliCredentialsStackSynthesizerProps`]:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript]
-----
-new CliCredentialsStackSynthesizer({
- // Value for '${Qualifier}' in the resource names
- qualifier: 'hnb659fds',
-
- // Name of the S3 bucket for file assets
- fileAssetsBucketName: 'cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}',
- bucketPrefix: '',
-
- // Name of the ECR repository for Docker image assets
- imageAssetsRepositoryName: 'cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}',
- dockerTagPrefix: '',
-})
-----
-
-JavaScript::
-+
-[source,javascript]
-----
-new CliCredentialsStackSynthesizer({
- // Value for '${Qualifier}' in the resource names
- qualifier: 'hnb659fds',
-
- // Name of the S3 bucket for file assets
- fileAssetsBucketName: 'cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}',
- bucketPrefix: '',
-
- // Name of the ECR repository for Docker image assets
- imageAssetsRepositoryName: 'cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}',
- dockerTagPrefix: '',
-})
-----
-
-Python::
-+
-[source,python]
-----
-CliCredentialsStackSynthesizer(
- # Value for '${Qualifier}' in the resource names
- qualifier="hnb659fds",
-
- # Name of the S3 bucket for file assets
- file_assets_bucket_name="cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}",
- bucket_prefix="",
-
- # Name of the ECR repository for Docker image assets
- image_assets_repository_name="cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}",
- docker_tag_prefix="",
-)
-----
-
-Java::
-+
-[source,java]
-----
-CliCredentialsStackSynthesizer.Builder.create()
- // Value for '${Qualifier}' in the resource names
- .qualifier("hnb659fds")
-
- // Name of the S3 bucket for file assets
- .fileAssetsBucketName("cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}")
- .bucketPrefix('')
-
- // Name of the ECR repository for Docker image assets
- .imageAssetsRepositoryName("cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}")
- .dockerTagPrefix('')
-.build()
-----
-
-C#::
-+
-[source,csharp]
-----
-new CliCredentialsStackSynthesizer(new CliCredentialsStackSynthesizerProps
-{
-
- // Value for '${Qualifier}' in the resource names
- Qualifier = "hnb659fds",
-
- // Name of the S3 bucket for file assets
- FileAssetsBucketName = "cdk-${Qualifier}-assets-${AWS::AccountId}-${AWS::Region}",
- BucketPrefix = "",
-
- // Name of the ECR repository for Docker image assets
- ImageAssetsRepositoryName = "cdk-${Qualifier}-container-assets-${AWS::AccountId}-${AWS::Region}",
- DockerTagPrefix = "",
-})
-----
-====
-
-[#bootstrapping-custom-synth-legacy]
-== Use `LegacyStackSynthesizer`
-
-The `LegacyStackSynthesizer` emulates the behavior of CDK v1 deployments. The security credentials of the actor performing deployment will be used to establish permissions. File assets will be uploaded to a bucket that must be created using a {aws} CloudFormation stack named `CDKToolkit`. The CDK CLI will create an unmanaged Amazon ECR repository named `aws-cdk/assets` to store Docker image assets. You will be responsible to clean up and manage this repository. Stacks synthesized using the `LegacyStackSynthesizer` can only be deployed using the CDK CLI.
-
-You can use the `LegacyStackSynthesizer` if you are migrating from CDK v1 to CDK v2, and are unable to re-bootstrap your environments. For new projects, we recommend that you don't use `LegacyStackSynthesizer`.
-
-[#bootstrapping-custom-synth-legacy-contract]
-=== `LegacyStackSynthesizer` bootstrap contract
-
-`LegacyStackSynthesizer` requires the following bootstrap contract. These are the resources that must be created during bootstrapping:
-
-[cols="1,1,1,1", frame="all", options="header"]
-|===
-| Bootstrap resource
-| Description
-| Default expected resource name
-| Purpose
-
-|Amazon S3 bucket
-|Staging bucket
-|cdk-hnb659fds-assets--
-|Stores file assets.
-
-|CloudFormation output
-|Bucket name output
-|Stack – `CDKToolkit`
-
-Output name – `BucketName`
-|
-
-A CloudFormation output describing the name of the staging bucket
-|===
-
-The `LegacyStackSynthesizer` does not assume the existence of an Amazon S3 bucket with a fixed name. Instead, the synthesized CloudFormation template will contain three CloudFormation parameters for each file asset. These parameters will store the Amazon S3 bucket name, Amazon S3 object key, and artifact hash for each file asset.
-
-[noloc]``Docker`` image assets will be published to an Amazon ECR repository named ``aws-cdk/assets``. This name can be changed per asset. The repositories will be created if they do not exist.
-
-A CloudFormation stack must exist with the default name ``CDKToolkit``. This stack must have a CloudFormation export named `BucketName` that refers to the staging bucket.
-
-The default bootstrap template satisfies the `LegacyStackSynthesizer` bootstrap contract. However, only the Amazon S3 bucket from the bootstrap resources of the bootstrap template will be used. You can customize the bootstrap template to remove the Amazon ECR, IAM, and SSM bootstrap resources.
-
-[[bootstrapping-custom-synth-legacy-deploy,bootstrapping-custom-synth-legacy-deploy.title]]
-=== `LegacyStackSynthesizer` deployment process
-
-When you use this synthesizer, the following process is performed during deployment:
-
-
-
-* The CDK [noloc]``CLI`` looks for a CloudFormation stack named `CDKToolkit` in your environment. From this stack, the CDK [noloc]``CLI`` reads the CloudFormation output named ``BucketName``. You can use the `--toolkit-stack-name` option with `cdk deploy` to specify a different stack name.
-* The security credentials of the actor initiating deployment will be used to establish permissions for deployment. Therefore, the actor must have sufficient permissions to perform all deployment actions. This includes reading and writing to the Amazon S3 staging bucket, creating and writing to the Amazon ECR repository, starting and monitoring {aws} CloudFormation deployments, and performing any API calls necessary for deployment.
-* If necessary, and if permissions are valid, file assets will be published to the Amazon S3 staging bucket.
-* If necessary, and if permissions are valid, [noloc]``Docker`` image assets are published to the repository named by the `repositoryName` property of the asset. The default value is `'aws-cdk/assets'` if you don`'t provide a repository name.
-* If permissions are valid, the {aws} CloudFormation deployment is performed. The locations of the Amazon S3 staging bucket and keys are passed as CloudFormation parameters.
\ No newline at end of file
diff --git a/v2/guide/define-iam-l2.adoc b/v2/guide/define-iam-l2.adoc
deleted file mode 100644
index 67264b63..00000000
--- a/v2/guide/define-iam-l2.adoc
+++ /dev/null
@@ -1,475 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#define-iam-l2]
-= Define permissions for L2 constructs with the {aws} CDK
-:info_titleabbrev: Define permissions for L2 constructs
-:keywords: {aws} CDK, {aws} Construct Library, {aws} CloudFormation, IAM, Permissions, Roles, Policies,
-
-[abstract]
---
-Define {aws} Identity and Access Management (IAM) roles and policies for L2 constructs when using the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-
-Define {aws} Identity and Access Management (IAM) roles and policies for L2 constructs when using the {aws} Cloud Development Kit ({aws} CDK).
-
-[#define-iam-l2-grant]
-== Use grant methods to define permissions
-
-When you define your infrastructure using L2 constructs from the {aws} Construct Library, you can use the provided _grant methods_ to specify the permissions your resources will require. The {aws} CDK will automatically create the IAM roles needed for all {aws} resources that require them.
-
-The following is an example that defines permissions between an {aws} Lambda function and Amazon Simple Storage Service (Amazon S3) bucket. Here, the `grantRead` method of the Bucket L2 construct is used to define these permissions:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import * as s3 from 'aws-cdk-lib/aws-s3';
-import * as lambda from 'aws-cdk-lib/aws-lambda';
-import * as kms from 'aws-cdk-lib/aws-kms';
-
-export class CdkDemoStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- const key = new kms.Key(this, 'BucketKey');
- const bucket = new s3.Bucket(this, 'Bucket', {
- encryptionKey: key,
- });
- const handler = new lambda.Function(this, 'Handler', {
- runtime: lambda.Runtime.NODEJS_20_X,
- handler: 'index.handler',
- code: lambda.Code.fromAsset('lambda'),
- });
-
- // Define permissions between function and S3 bucket using grantRead method
- bucket.grantRead(handler);
-
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Stack, Duration } = require('aws-cdk-lib');
-const s3 = require('aws-cdk-lib/aws-s3');
-const lambda = require('aws-cdk-lib/aws-lambda');
-const kms = require('aws-cdk-lib/aws-kms');
-
-class CdkDemoStack extends Stack {
-
- constructor(scope, id, props) {
- super(scope, id, props);
-
- const key = new kms.Key(this, 'BucketKey');
- const bucket = new s3.Bucket(this, 'Bucket', {
- encryptionKey: key,
- });
- const handler = new lambda.Function(this, 'Handler', {
- runtime: lambda.Runtime.NODEJS_20_X,
- handler: 'index.handler',
- code: lambda.Code.fromAsset('lambda'),
- });
-
- // Define permissions between function and S3 bucket using grantRead method
- bucket.grantRead(handler);
-
- }
-}
-
-// ...
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import (
- Stack,
- aws_s3 as s3,
- aws_lambda as _lambda,
- aws_kms as kms,
-)
-from constructs import Construct
-
-class CdkDemoStack(Stack):
-
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- key = kms.Key(self, 'BucketKey')
- bucket = s3.Bucket(self, 'Bucket')
- handler = _lambda.Function(
- self,
- 'Handler',
- runtime = _lambda.Runtime.NODEJS_20_X,
- handler = 'index.handler',
- code = _lambda.Code.from_asset('lambda'),
- )
-
- # Define permissions between function and S3 bucket using grantRead method
- bucket.grantRead(handler)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.core.App;
-import software.amazon.awscdk.core.Stack;
-import software.amazon.awscdk.core.StackProps;
-import software.amazon.awscdk.services.kms.Key;
-import software.amazon.awscdk.services.kms.KeyProps;
-import software.amazon.awscdk.services.s3.Bucket;
-import software.amazon.awscdk.services.s3.BucketProps;
-import software.amazon.awscdk.services.lambda.Function;
-import software.amazon.awscdk.services.lambda.FunctionProps;
-import software.amazon.awscdk.services.lambda.Runtime;
-import software.amazon.awscdk.services.lambda.Code;
-import software.constructs.Construct;
-
-public class CdkDemoStack extends Stack {
- public CdkDemoStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public CdkDemoStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- Key key = new Key(this, "BucketKey", KeyProps.builder().build());
-
- Bucket bucket = new Bucket(this, "Bucket", BucketProps.builder()
- .encryptionKey(key)
- .build());
-
- Function handler = new Function(this, "Handler", FunctionProps.builder()
- .runtime(Runtime.NODEJS_20_X)
- .handler("index.handler")
- .code(Code.fromAsset("lambda"))
- .build());
-
- // Define permissions between function and S3 bucket using grantRead method
- bucket.grantRead(handler);
- }
-
- public static void main(final String[] args) {
- App app = new App();
-
- new CdkDemoStack(app, "CdkDemoStack");
-
- app.synth();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Amazon.CDK.{aws}.KMS;
-using Amazon.CDK.{aws}.S3;
-using Amazon.CDK.{aws}.Lambda;
-
-namespace CdkDemo
-{
- public class CdkDemoStack : Stack
- {
- internal CdkDemoStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- var key = new Key(this, "BucketKey");
-
- var bucket = new Bucket(this, "Bucket", new BucketProps
- {
- EncryptionKey = key
- });
-
- var handler = new Function(this, "Handler", new FunctionProps
- {
- Runtime = Runtime.NODEJS_20_X,
- Handler = "index.handler",
- Code = Code.FromAsset("lambda")
- });
-
- // Define permissions between function and S3 bucket using grantRead method
- bucket.GrantRead(handler);
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/awskms"
- "github.com/aws/aws-cdk-go/awscdk/v2/awss3"
- "github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-// ...
-func NewCdkDemoStack(scope constructs.Construct, id string, props *CdkDemoStackProps) awscdk.Stack {
- stack := awscdk.NewStack(scope, &id, &props.StackProps)
- key := awskms.NewKey(stack, jsii.String("BucketKey"), nil)
- bucket := awss3.NewBucket(stack, jsii.String("Bucket"), &awss3.BucketProps{
- EncryptionKey: key,
- })
- handler := awslambda.NewFunction(stack, jsii.String("Handler"), &awslambda.FunctionProps{
- Runtime: awslambda.Runtime_NODEJS_20_X(),
- Handler: jsii.String("index.handler"),
- Code: awslambda.Code_FromAsset(jsii.String("lambda"), &awss3assets.AssetOptions{}),
- })
- bucket.GrantRead(handler)
- return stack
-}
-// ...
-----
-====
-
-When you use grant methods of L2 constructs to define permissions between resources, the {aws} CDK will create roles with least privilege policies based on the method you specify. As a security best practice, we recommend that you use the method that applies only the permissions that you require. For example, if you only need to grant permissions for a Lambda function to read from an Amazon S3 bucket, use the `grantRead` method instead of `grantReadWrite`.
-
-For each method that you use, the CDK creates a unique IAM role for the specified resources. If necessary, you can also directly modify the policy that will be attached to the role. The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { aws_iam as iam } from 'aws-cdk-lib';
-
-handler.addToRolePolicy(new iam.PolicyStatement({
- actions: ['s3:GetObject', 's3:List*'],
- resources: [
- bucket.bucketArn,
- bucket.arnForObjects('*'),
- ]
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const iam = require('aws-cdk-lib/aws-iam');
-
-handler.addToRolePolicy(new iam.PolicyStatement({
- actions: ['s3:GetObject', 's3:List*'],
- resources: [
- bucket.bucketArn,
- bucket.arnForObjects('*'),
- ]
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import aws_iam as iam
-
-handler.add_to_role_policy(iam.PolicyStatement(
- actions=['s3:GetObject', 's3:List*'],
- resources=[
- bucket.bucket_arn,
- bucket.arn_for_objects('*'),
- ]
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.iam.PolicyStatement;
-import software.amazon.awscdk.services.iam.PolicyStatementProps;
-
-handler.addToRolePolicy(PolicyStatement.Builder.create()
- .actions(Arrays.asList("s3:GetObject", "s3:List*"))
- .resources(Arrays.asList(
- bucket.getBucketArn(),
- bucket.arnForObjects("*")
- ))
- .build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.IAM;
-using Amazon.CDK.{aws}.S3;
-using Amazon.CDK.{aws}.Lambda;
-
-handler.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps
-{
- Actions = new[] { "s3:GetObject", "s3:List*" },
- Resources = new[] { bucket.BucketArn, bucket.ArnForObjects("*") }
-}));
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- // ...
- "github.com/aws/aws-cdk-go/awscdk/v2/awsiam"
- // ...
-)
-
-// ...
-
-func NewCdkDemoStack(scope constructs.Construct, id string, props *CdkDemoStackProps) awscdk.Stack {
- // ...
-
- handler.AddToRolePolicy(awsiam.NewPolicyStatement(&awsiam.PolicyStatementProps{
- Actions: jsii.Strings("s3:GetObject", "s3:List*"),
- Resources: jsii.Strings(bucket.BucketArn(), bucket.ArnForObjects("*")),
- }))
-
- // ...
-}
-----
-====
-
-However, we recommend that you use the `grant` methods when available.
-
-[#define-iam-l2-manual]
-== Manually create and use IAM roles
-
-If you prefer not to use the CDK `grant` methods to create and manage permissions, you must manually create and configure them. You can create IAM roles using the {aws} Management Console, {aws} CLI, or {aws} SDKs. Then, you can pass them into your CDK application manually or use the _role customization_ feature.
-
-[#define-iam-l2-manual-role]
-=== Reference and manage all roles manually
-
-Constructs that require a role have an optional `role` property that you can use to pass in a role object.
-
-*To reference a role manually*::
-+
-. Use `Role.fromRoleName()` to reference your pre-existing role. The following is an example:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const existingRole = Role.fromRoleName(stack, 'Role', 'my-pre-existing-role', {
- mutable: false // Prevent CDK from attempting to add policies to this role
-})
-----
-+
-. Pass the pre-existing role when defining your resource. The following is an example:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const handler = new lambda.Function(stack, 'Handler', { runtime: lambda.Runtime.NODEJS_20_XZ, handler:
- 'index.handler', code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), // Pass in pre-existing role
- role: existingRole, });
-----
-
-[#define-iam-l2-manual-customization]
-=== Use the role customization feature
-
-The {aws} CDK _role customization_ feature generates a report of roles and policies in your CDK app. You can use this feature to generate a report. Then you can substitute pre-created roles for them.
-
-*To use the role customization feature*::
-+
-. Add `Role.customizeRoles()` somewhere towards the top of your CDK application. The following is an example:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const stack = new Stack(app, 'LambdaStack');
-
-// Add this to use the role customization feature
-iam.Role.customizeRoles(stack);
-
-// Define your resources using L2 constructs
-const key = new kms.Key(stack, 'BucketKey');
-const bucket = new s3.Bucket(stack, 'Bucket', {
- encryptionKey: key,
-});
-const handler = new lambda.Function(stack, 'Handler', {
- runtime: lambda.Runtime.NODEJS_16_X,
- handler: 'index.handler',
- code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
-});
-
-// The grantRead() is still important. Even though it actually doesn't mutate
-// any policies, it indicates the need for them.
-bucket.grantRead(handler);
-----
-+
-. When you synthesize your application, the CDK will throw an error, indicating that you need to provide the pre-created role name to `Role.customizeRoles()`. The following is an example of the generated report:
-+
-----
- (LambdaStack/Handler/ServiceRole)
-
-AssumeRole Policy:
-[
- {
- "Action": "sts:AssumeRole",
- "Effect": "Allow",
- "Principal": {
- "Service": "lambda.amazonaws.com"
- }
- }
-]
-
-Managed Policy ARNs:
-[
- "arn:(PARTITION):iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
-]
-
-Managed Policies Statements:
-NONE
-
-Identity Policy Statements:
-[
- {
- "Action": [
- "s3:GetObject*",
- "s3:GetBucket*",
- "s3:List*"
- ],
- "Effect": "Allow",
- "Resource": [
- "(LambdaStack/Bucket/Resource.Arn)",
- "(LambdaStack/Bucket/Resource.Arn)/*"
- ]
- }
-]
-----
-+
-. Once the role is created, you can pass it into your application for the resource that it applies to. For example, if the name of the role created for `LambdaStack/Handler/ServiceRole` is `lambda-service-role`, you would update your CDK app as follows:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const stack = new Stack(app, 'LambdaStack');
-
-// Add this to pass in the role
-iam.Role.customizeRoles(stack, {
- usePrecreatedRoles: {
- 'LambdaStack/Handler/ServiceRole': 'lambda-service-role',
- },
-});
-----
-+
-The CDK will now use the pre-created role name anywhere that the role is referenced in the CDK application. It will also continue to generate the report so that any future policy changes can be referenced.
-+
-You will notice that the reference to the Amazon S3 bucket ARN in the report is rendered as (`LambdaStack/Bucket/Resource.Arn`) instead of the actual ARN of the bucket. This is because the bucket ARN is a deploy time value that is not known at synthesis (the bucket hasn`'t been created yet). This is another example of why we recommend allowing CDK to manage IAM roles and permissions by using the provided `grant` methods. In order to create the role with the initial policy, the admin will have to create the policy with broader permissions (for example, `arn:aws:s3:::*`).
\ No newline at end of file
diff --git a/v2/guide/deploy-troubleshoot.adoc b/v2/guide/deploy-troubleshoot.adoc
deleted file mode 100644
index 0025efc3..00000000
--- a/v2/guide/deploy-troubleshoot.adoc
+++ /dev/null
@@ -1,66 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#deploy-troubleshoot]
-= Troubleshoot {aws} CDK deployments
-:info_titleabbrev: Troubleshoot CDK deployments
-:keywords: {aws} CDK, Deploy, Troubleshoot
-
-[abstract]
---
-Troubleshoot common issues when deploying {aws} Cloud Development Kit ({aws} CDK) applications.
---
-
-// Content start
-
-Troubleshoot common issues when deploying {aws} Cloud Development Kit ({aws} CDK) applications.
-
-[#deploy-troubleshoot-sp]
-== Incorrect service principals are being created at deployment
-
-When deploying CDK applications that contain {aws} Identity and Access Management (IAM) roles with service principals, you find that incorrect domains for the service principals are being created.
-
-The following is a basic example of creating an IAM role that can be assumed by Amazon CloudWatch Logs using its service principal:
-
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import * as iam from 'aws-cdk-lib/aws-iam';
-import { Construct } from 'constructs';
-
-export class MyCdkProjectStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Create an IAM role for CloudWatch Logs to assume
- const cloudWatchLogsRole = new iam.Role(this, 'CloudWatchLogsRole', {
- assumedBy: new iam.ServicePrincipal('logs.amazonaws.com'), // This is for CloudWatch Logs
- managedPolicies: [
- iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSCloudWatchLogsFullAccess')
- ]
- });
-
- // You can then use this role in other constructs or configurations where CloudWatch Logs needs to assume a role
- }
-}
-----
-
-When you deploy this stack, a service principal named `logs.amazonaws.com` should be created. In most cases, {aws} services use the following naming for service principals: `.amazonaws.com`.
-
-[#deploy-troubleshoot-sp-causes]
-=== Common causes
-
-If you are using a version of the {aws} CDK older than v2.150.0, you may encounter this bug. In older {aws} CDK versions, the naming of service principals were not standardized, which could lead to the creation of service principals with incorrect domains.
-
-In {aws} CDK v2.51.0, a fix was implemented by standardizing all automatically created service principals to use `.amazonaws.com` when possible. This fix was available by allowing the `@aws-cdk/aws-iam:standardizedServicePrincipals` feature flag.
-
-Starting in {aws} CDK v2.150.0, this became default behavior.
-
-[#deploy-troubleshoot-sp-resolution]
-=== Resolution
-
-Upgrade to {aws} CDK v2.150.0 or newer.
-
-If you are unable to upgrade to {aws} CDK v2.150.0 or newer, you must upgrade to at least v2.51.0 or newer. Then, allow the following feature flag in your `cdk.json` file: `@aws-cdk/aws-iam:standardizedServicePrincipals`.
\ No newline at end of file
diff --git a/v2/guide/disaster-recovery-resiliency.adoc b/v2/guide/disaster-recovery-resiliency.adoc
deleted file mode 100644
index da0443dd..00000000
--- a/v2/guide/disaster-recovery-resiliency.adoc
+++ /dev/null
@@ -1,25 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#disaster-recovery-resiliency]
-= Resilience for the {aws} Cloud Development Kit ({aws} CDK)
-:info_titleabbrev: Resilience
-
-[abstract]
---
-Provides information about resilience for the {aws} CDK.
---
-
-// Content start
-
-The Amazon Web Services ({aws}) global infrastructure is built around {aws} Regions and Availability Zones.
-
-{aws} Regions provide multiple physically separated and isolated Availability Zones, which are connected with low-latency, high-throughput, and highly redundant networking.
-
-With Availability Zones, you can design and operate applications and databases that automatically fail over between Availability Zones without interruption. Availability Zones are more highly available, fault tolerant, and scalable than traditional single or multiple data center infrastructures.
-
-For more information about {aws} Regions and Availability Zones, see link:https://aws.amazon.com/about-aws/global-infrastructure/[{aws} Global Infrastructure].
-
-The {aws} CDK follows the link:https://aws.amazon.com/compliance/shared-responsibility-model/[shared responsibility model] through the specific Amazon Web Services ({aws}) services it supports. For {aws} service security information, see the link:https://docs.aws.amazon.com/security/?id=docs_gateway#aws-security[{aws} service security documentation page] and https://aws.amazon.com/compliance/services-in-scope/[{aws} services that are in scope of {aws} compliance efforts by compliance program].
\ No newline at end of file
diff --git a/v2/guide/doc-history.adoc b/v2/guide/doc-history.adoc
deleted file mode 100644
index 24203114..00000000
--- a/v2/guide/doc-history.adoc
+++ /dev/null
@@ -1,73 +0,0 @@
-include::attributes.txt[]
-
-[.topic]
-[#doc-history]
-= {aws} CDK Developer Guide history
-:info_titleabbrev: Document history
-:info_abstract: {aws} CDK Developer Guide history
-
-[abstract]
---
-{aws} CDK Developer Guide history
---
-
-// Content start
-
-See link:https://github.com/awslabs/aws-cdk/releases[Releases] for information about {aws} CDK releases. The {aws} CDK is updated approximately once a week. Maintenance versions may be released between weekly releases to address critical issues. Each release includes a matched {aws} CDK Toolkit (CDK CLI), {aws} Construct Library, and API Reference. Updates to this Guide generally do not synchronize with {aws} CDK releases.
-
-[NOTE]
-====
-The table below represents significant documentation milestones. We fix errors and improve content on an ongoing basis.
-====
-
-[.updates]
-== Updates
-
-[.update,date="2025-03-27"]
-=== Document bootstrap template versions v26 and v27
-
-For more information, see link:https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping-env.html#bootstrap-template-history[Bootstrap template version history].
-
-[.update,date="2025-03-21"]
-=== Add documentation for building and deploying container image assets
-
-When you build container image assets with the {aws} CDK, Docker is utilized by default to perform these actions. If you want to use a different container management tool, you can replace Docker. For more information, see https://docs.aws.amazon.com/cdk/v2/guide/build-containers.html[Build and deploy container image assets in CDK apps].
-
-[.update,date="2024-02-02"]
-=== Add documentation for CDK Migrate feature
-
-Use the {aws} CDK CLI `cdk migrate` command to migrate deployed {aws} resources, deployed {aws} CloudFormation stacks, and local {aws} CloudFormation templates to {aws} CDK. For more information, see https://docs.aws.amazon.com/cdk/v2/guide/migrate.html[Migrate to {aws} CDK].
-
-[.update,date="2023-03-23"]
-=== IAM best practices updates
-
-Updated guide to align with the IAM best practices. For more information, see https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html[Security best practices in IAM].
-
-[.update,date="2022-04-20"]
-=== Document `cdk.json`
-
-Add documentation of `cdk.json` configuration values.
-
-[.update,date="2022-04-07"]
-=== Dependency management
-
-Add topic on managing dependencies with the {aws} CDK.
-
-[.update,date="2022-03-09"]
-=== Remove double-braces from Java examples
-
-Replace this anti-pattern with Java 9 `Map.of` throughout.
-
-[.update,date="2021-12-04"]
-=== {aws} CDK v2 release
-
-Version 2 of the {aws} CDK Developer Guide is released.
-
-See https://github.com/awslabs/aws-cdk/releases[Releases] for information about {aws} CDK releases. The {aws} CDK is updated approximately once a week. Maintenance versions may be released between weekly releases to address critical issues. Each release includes a matched {aws} CDK Toolkit (CDK CLI), {aws} Construct Library, and API Reference. Updates to this Guide generally do not synchronize with {aws} CDK releases.
-
-[.level]
-== {blank}
-
-[.update-history]
-|===
-|===
\ No newline at end of file
diff --git a/v2/guide/ecs_example.adoc b/v2/guide/ecs_example.adoc
deleted file mode 100644
index e85c5ea3..00000000
--- a/v2/guide/ecs_example.adoc
+++ /dev/null
@@ -1,333 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#ecs-example]
-= Example: Create an {aws} Fargate service using the {aws} CDK
-:info_titleabbrev: Example: Create a Fargate service
-
-[abstract]
---
-Learn how to create an {aws} Fargate service.
---
-
-// Content start
-
-In this example, we show you how to create an {aws} Fargate service running on an Amazon Elastic Container Service (Amazon ECS) cluster that's fronted by an internet-facing Application Load Balancer from an image on Amazon ECR.
-
-Amazon ECS is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers on a cluster. You can host your cluster on serverless infrastructure that's managed by Amazon ECS by launching your services or tasks using the Fargate launch type. For more control, you can host your tasks on a cluster of Amazon Elastic Compute Cloud (Amazon EC2) instances that you manage by using the Amazon EC2 launch type.
-
-In this example, we launch some services using the Fargate launch type. If you've used the {aws} Management Console to create a Fargate service, you know that there are many steps to follow to accomplish that task. {aws} has several tutorials and documentation topics that walk you through creating a Fargate service, including:
-
-* link:https://aws.amazon.com/getting-started/tutorials/deploy-docker-containers[How to Deploy Docker Containers - {aws}]
-* link:https://docs.aws.amazon.com/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html[Setting Up with Amazon ECS]
-* link:https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_GetStarted.html[Getting Started with Amazon ECS Using Fargate]
-
-This example creates a similar Fargate service using the {aws} CDK.
-
-The Amazon ECS construct used in this example helps you use {aws} services by providing the following benefits:
-
-* Automatically configures a load balancer.
-* Automatically opens a security group for load balancers. This enables load balancers to communicate with instances without having to explicitly create a security group.
-* Automatically orders dependency between the service and the load balancer attaching to a target group, where the {aws} CDK enforces the correct order of creating the listener before an instance is created.
-* Automatically configures user data on automatically scaling groups. This creates the correct configuration to associate a cluster to AMIs.
-* Validates parameter combinations early. This exposes {aws} CloudFormation issues earlier, thus saving deployment time. For example, depending on the task, it's easy to improperly configure the memory settings. Previously, we would not encounter an error until we deployed our app. But now the {aws} CDK can detect a misconfiguration and emit an error when we synthesize our app.
-* Automatically adds permissions for Amazon Elastic Container Registry (Amazon ECR) if we use an image from Amazon ECR.
-* Automatically scales. The {aws} CDK supplies a method so we can auto scale instances when we use an Amazon EC2 cluster. This happens automatically when we use an instance in a Fargate cluster.
-+
-In addition, the {aws} CDK prevents an instance from being deleted when automatic scaling tries to stop an instance, but either a task is running or is scheduled on that instance.
-+
-Previously, we had to create a Lambda function to have this functionality.
-* Provides asset support, so that we can deploy a source from our machine to Amazon ECS in one step. Previously, to use an application source, we had to perform several manual steps, such as uploading to Amazon ECR and creating a Docker image.
-
-[IMPORTANT]
-====
-
-The `ApplicationLoadBalancedFargateService` constructs we'll be using includes numerous {aws} components, some of which have non-trivial costs if left provisioned in our {aws} account, even if we don't use them. Be sure to clean up (`cdk destroy`) if you follow along with this example.
-
-====
-
-[#ecs-example-initialize]
-== Create a CDK project
-
-We start by creating a CDK project. This is a directory that stores our {aws} CDK code, including our CDK app.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir MyEcsConstruct
-cd MyEcsConstruct
-cdk init --language typescript
-----
-
-JavaScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir MyEcsConstruct
-cd MyEcsConstruct
-cdk init --language javascript
-----
-
-Python::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir MyEcsConstruct
-cd MyEcsConstruct
-cdk init --language python
-source .venv/bin/activate # On Windows, run '.\venv\Scripts\activate' instead
-pip install -r requirements.txt
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-mkdir MyEcsConstruct
-cd MyEcsConstruct
-cdk init --language java
-----
-+
-We may now import the Maven project into our IDE.
-
-C#::
-+
-[source,none,subs="verbatim,attributes"]
-----
-mkdir MyEcsConstruct
-cd MyEcsConstruct
-cdk init --language csharp
-----
-+
-We may now open `src/MyEcsConstruct.sln` in Visual Studio.
-====
-
-Next, we run the app and confirm that it creates an empty stack.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth
-----
-
-[#ecs-example-create-fargate-service]
-== Create a Fargate service
-
-There are two different ways that we can run our container tasks with Amazon ECS:
-
-* Use the `Fargate` launch type, where Amazon ECS manages the physical machines that oour containers are running on for us.
-* Use the `EC2` launch type, where we do the managing, such as specifying automatic scaling.
-
-For this example, we'll create a Fargate service running on an Amazon ECS cluster, fronted by an internet-facing Application Load Balancer.
-
-We add the following {aws} Construct Library module imports to our _stack file_:
-
-====
-[role="tablist"]
-TypeScript::
-File: `lib/my_ecs_construct-stack.ts`
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as ec2 from "aws-cdk-lib/aws-ec2";
-import * as ecs from "aws-cdk-lib/aws-ecs";
-import * as ecs_patterns from "aws-cdk-lib/aws-ecs-patterns";
-----
-
-JavaScript::
-File: `lib/my_ecs_construct-stack.js`
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const ec2 = require("aws-cdk-lib/aws-ec2");
-const ecs = require("aws-cdk-lib/aws-ecs");
-const ecs_patterns = require("aws-cdk-lib/aws-ecs-patterns");
-----
-
-Python::
-File: `my_ecs_construct/my_ecs_construct_stack.py`
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import (aws_ec2 as ec2, aws_ecs as ecs,
- aws_ecs_patterns as ecs_patterns)
-----
-
-Java::
-File: `src/main/java/com/myorg/MyEcsConstructStack.java`
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.ec2.*;
-import software.amazon.awscdk.services.ecs.*;
-import software.amazon.awscdk.services.ecs.patterns.*;
-----
-
-C#::
-File: `src/MyEcsConstruct/MyEcsConstructStack.cs`
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.EC2;
-using Amazon.CDK.{aws}.ECS;
-using Amazon.CDK.{aws}.ECS.Patterns;
-----
-====
-
-Within our stack, we add the following code:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
- const vpc = new ec2.Vpc(this, "MyVpc", {
- maxAzs: 3 // Default is all AZs in region
- });
-
- const cluster = new ecs.Cluster(this, "MyCluster", {
- vpc: vpc
- });
-
- // Create a load-balanced Fargate service and make it public
- new ecs_patterns.ApplicationLoadBalancedFargateService(this, "MyFargateService", {
- cluster: cluster, // Required
- cpu: 512, // Default is 256
- desiredCount: 6, // Default is 1
- taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample") },
- memoryLimitMiB: 2048, // Default is 512
- publicLoadBalancer: true // Default is true
- });
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
- const vpc = new ec2.Vpc(this, "MyVpc", {
- maxAzs: 3 // Default is all AZs in region
- });
-
- const cluster = new ecs.Cluster(this, "MyCluster", {
- vpc: vpc
- });
-
- // Create a load-balanced Fargate service and make it public
- new ecs_patterns.ApplicationLoadBalancedFargateService(this, "MyFargateService", {
- cluster: cluster, // Required
- cpu: 512, // Default is 256
- desiredCount: 6, // Default is 1
- taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample") },
- memoryLimitMiB: 2048, // Default is 512
- publicLoadBalancer: true // Default is true
- });
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
- vpc = ec2.Vpc(self, "MyVpc", max_azs=3) # default is all AZs in region
-
- cluster = ecs.Cluster(self, "MyCluster", vpc=vpc)
-
- ecs_patterns.ApplicationLoadBalancedFargateService(self, "MyFargateService",
- cluster=cluster, # Required
- cpu=512, # Default is 256
- desired_count=6, # Default is 1
- task_image_options=ecs_patterns.ApplicationLoadBalancedTaskImageOptions(
- image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")),
- memory_limit_mib=2048, # Default is 512
- public_load_balancer=True) # Default is True
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
- Vpc vpc = Vpc.Builder.create(this, "MyVpc")
- .maxAzs(3) // Default is all AZs in region
- .build();
-
- Cluster cluster = Cluster.Builder.create(this, "MyCluster")
- .vpc(vpc).build();
-
- // Create a load-balanced Fargate service and make it public
- ApplicationLoadBalancedFargateService.Builder.create(this, "MyFargateService")
- .cluster(cluster) // Required
- .cpu(512) // Default is 256
- .desiredCount(6) // Default is 1
- .taskImageOptions(
- ApplicationLoadBalancedTaskImageOptions.builder()
- .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
- .build())
- .memoryLimitMiB(2048) // Default is 512
- .publicLoadBalancer(true) // Default is true
- .build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
- var vpc = new Vpc(this, "MyVpc", new VpcProps
- {
- MaxAzs = 3 // Default is all AZs in region
- });
-
- var cluster = new Cluster(this, "MyCluster", new ClusterProps
- {
- Vpc = vpc
- });
-
- // Create a load-balanced Fargate service and make it public
- new ApplicationLoadBalancedFargateService(this, "MyFargateService",
- new ApplicationLoadBalancedFargateServiceProps
- {
- Cluster = cluster, // Required
- DesiredCount = 6, // Default is 1
- TaskImageOptions = new ApplicationLoadBalancedTaskImageOptions
- {
- Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
- },
- MemoryLimitMiB = 2048, // Default is 256
- PublicLoadBalancer = true // Default is true
- }
- );
-----
-====
-
-Next, we validate our code by running the following to synthesize our stack:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth
-----
-
-The stack is hundreds of lines, so we won't show it here. The stack should contain one default instance, a private subnet and a public subnet for the three Availability Zones, and a security group.
-
-To deploy the stack, we run the following:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk deploy
-----
-
-{aws} CloudFormation displays information about the dozens of steps that it takes as it deploys our app.
-
-Once deployment completes, we have successfully created a Fargate powered Amazon ECS service to run a Docker image.
-
-[#ecs-example-destroy]
-== Clean up
-
-As a general maintenance best practice, and to minimize unnecessary costs, we delete our stack when complete:
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk destroy
-----
\ No newline at end of file
diff --git a/v2/guide/environments.adoc b/v2/guide/environments.adoc
deleted file mode 100644
index f7adc76f..00000000
--- a/v2/guide/environments.adoc
+++ /dev/null
@@ -1,93 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-:https---docs-aws-amazon-com-general-latest-gr-rande-html-regional-endpoints: https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints
-:https---aws-amazon-com-about-aws-global-infrastructure-regions-az-: https://aws.amazon.com/about-aws/global-infrastructure/regions_az/
-
-[.topic]
-:info_titleabbrev: Environments
-:keywords: {aws} CDK, {aws} Cloud Development Kit ({aws} CDK), environment, env, {aws} account, {aws} Region
-
-[#environments]
-= Environments for the {aws} CDK
-
-[abstract]
---
-An environment consists of the {aws} account and {aws} Region that you deploy an {aws} Cloud Development Kit ({aws} CDK) stack to.
---
-
-// Content start
-
-An environment consists of the {aws} account and {aws} Region that you deploy an {aws} Cloud Development Kit ({aws} CDK) stack to.
-
-*{aws} account*::
-When you create an {aws} account, you receive an account ID. This ID is a 12-digit number, such as **012345678901**, that uniquely identifies your account. To learn more, see https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-identifiers.html[View {aws} account identifiers] in the _{aws} Account Management Reference Guide_.
-
-*{aws} Region*::
-{aws} Regions are named by using a combination of geographical location and a number that represents an Availability Zone in the Region. For example, *[.noloc]`us-east-1`* represents an Availability Zone in the US East (N. Virginia) Region. To learn more about {aws} Regions, see https://aws.amazon.com/about-aws/global-infrastructure/regions_az/[Regions and Availability Zones]. For a list of Region codes, see https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints[Regional endpoints] in the _{aws} General Reference_ Reference Guide.
-
-The {aws} CDK can determine environments from your credentials and configuration files. These files can be created and managed with the {aws} Command Line Interface ({aws} CLI). The following is a basic example of these files:
-
-*Credentials file*::
-+
-[source,toml,subs="verbatim,attributes"]
-----
-[default]
-aws_access_key_id=ASIAIOSFODNN7EXAMPLE
-aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
-aws_session_token = IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZVERYLONGSTRINGEXAMPLE
-
-[user1]
-aws_access_key_id=ASIAI44QH8DHBEXAMPLE
-aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY
-aws_session_token = fcZib3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZVERYLONGSTRINGEXAMPLE
-----
-
-*Configuration file*::
-+
-[source,toml,subs="verbatim,attributes"]
-----
-[default]
-region=us-west-2
-output=json
-
-[profile user1]
-region=us-east-1
-output=text
-----
-
-You can pass environment information from these files in your CDK code through environment variables that are provided by the CDK. When you run a CDK CLI command, such as `cdk deploy`, you then provide the profile from your credentials and configuration files to gather environment information from.
-
-The following is an example of specifying these environment variables in your CDK code:
-
-[source,javascript,subs="verbatim,attributes"]
-----
-new MyDevStack(app, 'dev', {
- env: {
- account: process.env.CDK_DEFAULT_ACCOUNT,
- region: process.env.CDK_DEFAULT_REGION
-}});
-----
-
-The following is an example of passing values associated with the `user1` profile from your credentials and configuration files to the CDK CLI using the `--profile` option. Values from these files will be passed to your environment variables:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk deploy --profile
-----
-
-Instead of using values from the credentials and configuration files, you can also hard-code environment values in your CDK code. The following is an example:
-
-[source,javascript,subs="verbatim,attributes"]
-----
-const envEU = { account: '238383838383', region: 'eu-west-1' };
-const envUSA = { account: '837873873873', region: 'us-west-2' };
-
-new MyFirstStack(app, 'first-stack-us', { env: envUSA });
-new MyFirstStack(app, 'first-stack-eu', { env: envEU });
-----
-
-[#environments-learn]
-== Learn more
-
-To get started with using environments with the {aws} CDK, see xref:configure-env[Configure environments to use with the {aws} CDK].
\ No newline at end of file
diff --git a/v2/guide/feature-flags.adoc b/v2/guide/feature-flags.adoc
deleted file mode 100644
index edcaab8d..00000000
--- a/v2/guide/feature-flags.adoc
+++ /dev/null
@@ -1,70 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-:https---github-com-aws-aws-cdk-blob-main-packages-aws-cdk-lib-cx-api-FEATURE-FLAGS-md: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md
-
-[.topic]
-:info_titleabbrev: Feature flags
-:keywords: {aws} CDK, Feature flags
-
-[#featureflags]
-= {aws} CDK feature flags
-
-[abstract]
---
-The {aws} CDK uses _feature flags_ to enable potentially breaking behaviors in a release. Flags are stored as xref:context[Context values and the {aws} CDK] values in `cdk.json` (or `~/.cdk.json`). They are not removed by the `cdk context --reset` or `cdk context --clear` commands.
---
-
-// Content start
-
-The {aws} CDK uses _feature flags_ to enable potentially breaking behaviors in a release. Flags are stored as xref:context[Context values and the {aws} CDK] values in `cdk.json` (or `~/.cdk.json`). They are not removed by the `cdk context --reset` or `cdk context --clear` commands.
-
-Feature flags are disabled by default. Existing projects that do not specify the flag will continue to work as before with later {aws} CDK releases. New projects created using `cdk init` include flags enabling all features available in the release that created the project. Edit `cdk.json` to disable any flags for which you prefer the earlier behavior. You can also add flags to enable new behaviors after upgrading the {aws} CDK.
-
-A list of all current feature flags can be found on the {aws} CDK GitHub repository in {https---github-com-aws-aws-cdk-blob-main-packages-aws-cdk-lib-cx-api-FEATURE-FLAGS-md}[FEATURE_FLAGS.md]. See the `CHANGELOG` in a given release for a description of any new feature flags added in that release.
-
-[[featureflags-disabling,featureflags-disabling.title]]
-== Reverting to v1 behavior
-
-In CDK v2, the defaults for some feature flags have been changed with respect to v1. You can set these back to `false` to revert to specific {aws} CDK v1 behavior. Use the `cdk diff` command to inspect the changes to your synthesized template to see if any of these flags are needed.
-
-
-
-`@aws-cdk/core:newStyleStackSynthesis`::
-Use the new stack synthesis method, which assumes bootstrap resources with well-known names. Requires xref:bootstrapping[modern bootstrapping], but in turn allows CI/CD via xref:cdk-pipeline[CDK Pipelines] and cross-account deployments out of the box.
-
-
-`@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId`::
-If your application uses multiple Amazon API Gateway API keys and associates them to usage plans.
-
-
-`@aws-cdk/aws-rds:lowercaseDbIdentifier`::
-If your application uses Amazon RDS database instance or database clusters, and explicitly specifies the identifier for these.
-
-
-`@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021`::
-If your application uses the TLS_V1_2_2019 security policy with Amazon CloudFront distributions. CDK v2 uses security policy TLSv1.2_2021 by default.
-
-
-`@aws-cdk/core:stackRelativeExports`::
-If your application uses multiple stacks and you refer to resources from one stack in another, this determines whether absolute or relative path is used to construct {aws} CloudFormation exports.
-
-
-`@aws-cdk/aws-lambda:recognizeVersionProps`::
-If set to ``false``, the CDK includes metadata when detecting whether a Lambda function has changed. This can cause deployment failures when only the metadata has changed, since duplicate versions are not allowed. There is no need to revert this flag if you've made at least one change to all Lambda Functions in your application.
-
-The syntax for reverting these flags in `cdk.json` is shown here.
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "context": {
- "@aws-cdk/core:newStyleStackSynthesis": false,
- "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": false,
- "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": false,
- "@aws-cdk/aws-rds:lowercaseDbIdentifier": false,
- "@aws-cdk/core:stackRelativeExports": false,
- "@aws-cdk/aws-lambda:recognizeVersionProps": false
- }
-}
-----
\ No newline at end of file
diff --git a/v2/guide/get-cfn-val.adoc b/v2/guide/get-cfn-val.adoc
deleted file mode 100644
index 89e64d8f..00000000
--- a/v2/guide/get-cfn-val.adoc
+++ /dev/null
@@ -1,358 +0,0 @@
-include::attributes.txt[]
-
-// Attribues
-[.topic]
-[#get-cfn-param]
-= Use CloudFormation parameters to get a CloudFormation value
-:info_titleabbrev: Use CloudFormation parameters
-
-// Content start
-
-Use {aws} CloudFormation parameters within {aws} Cloud Development Kit ({aws} CDK) applications to input custom values into your synthesized CloudFormation templates at deployment.
-
-For an introduction, see xref:parameters[Parameters and the {aws} CDK].
-
-[#parameters-define]
-== Define parameters in your CDK app
-
-Use the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnParameter.html[`CfnParameter`] class to define a parameter. You'll want to specify at least a type and a description for most parameters, though both are technically optional. The description appears when the user is prompted to enter the parameter's value in the {aws} CloudFormation console. For more information on the available types, see link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#parameters-section-structure-properties-type[Types].
-
-[NOTE]
-====
-
-You can define parameters in any scope. However, we recommend defining parameters at the stack level so that their logical ID doesn't change when you refactor your code.
-
-====
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const uploadBucketName = new CfnParameter(this, "uploadBucketName", {
- type: "String",
- description: "The name of the Amazon S3 bucket where uploaded files will be stored."});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const uploadBucketName = new CfnParameter(this, "uploadBucketName", {
- type: "String",
- description: "The name of the Amazon S3 bucket where uploaded files will be stored."});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-upload_bucket_name = CfnParameter(self, "uploadBucketName", type="String",
- description="The name of the Amazon S3 bucket where uploaded files will be stored.")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-CfnParameter uploadBucketName = CfnParameter.Builder.create(this, "uploadBucketName")
- .type("String")
- .description("The name of the Amazon S3 bucket where uploaded files will be stored")
- .build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var uploadBucketName = new CfnParameter(this, "uploadBucketName", new CfnParameterProps
-{
- Type = "String",
- Description = "The name of the Amazon S3 bucket where uploaded files will be stored"
-});
-----
-====
-
-
-[#parameters-use,]
-== Use parameters
-
-A `CfnParameter` instance exposes its value to your CDK app via a xref:tokens[token]. Like all tokens, the parameter's token is resolved at synthesis time. But it resolves to a reference to the parameter defined in the {aws} CloudFormation template (which will be resolved at deploy time), rather than to a concrete value.
-
-You can retrieve the token as an instance of the `Token` class, or in string, string list, or numeric encoding. Your choice depends on the kind of value required by the class or method that you want to use the parameter with.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[cols="1,1", options="header"]
-|===
-| Property
-| kind of value
-
-|`value`
-|`Token` class instance
-
-|`valueAsList`
-|The token represented as a string list
-
-|`valueAsNumber`
-|The token represented as a number
-
-|`valueAsString`
-|The token represented as a string
-|===
-
-JavaScript::
-+
-[cols="1,1", options="header"]
-|===
-| Property
-| kind of value
-
-|`value`
-|`Token` class instance
-
-|`valueAsList`
-|The token represented as a string list
-
-|`valueAsNumber`
-|The token represented as a number
-
-|`valueAsString`
-|The token represented as a string
-|===
-
-Python::
-+
-[cols="1,1", options="header"]
-|===
-| Property
-| kind of value
-
-|`value`
-|`Token` class instance
-
-|`value_as_list`
-|The token represented as a string list
-
-|`value_as_number`
-|The token represented as a number
-
-|`value_as_string`
-|The token represented as a string
-|===
-
-Java::
-+
-[cols="1,1", options="header"]
-|===
-| Property
-| kind of value
-
-|`getValue()`
-|`Token` class instance
-
-|`getValueAsList()`
-|The token represented as a string list
-
-|`getValueAsNumber()`
-|The token represented as a number
-
-|`getValueAsString()`
-|The token represented as a string
-|===
-
-C#::
-+
-[cols="1,1", options="header"]
-|===
-| Property
-| kind of value
-
-|`Value`
-|`Token` class instance
-
-|`ValueAsList`
-|The token represented as a string list
-
-|`ValueAsNumber`
-|The token represented as a number
-
-|`ValueAsString`
-|The token represented as a string
-|===
-====
-
-For example, to use a parameter in a `Bucket` definition:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new Bucket(this, "amzn-s3-demo-bucket",
- { bucketName: uploadBucketName.valueAsString});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new Bucket(this, "amzn-s3-demo-bucket",
- { bucketName: uploadBucketName.valueAsString});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-bucket = Bucket(self, "amzn-s3-demo-bucket",
- bucket_name=upload_bucket_name.value_as_string)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-Bucket bucket = Bucket.Builder.create(this, "amzn-s3-demo-bucket")
- .bucketName(uploadBucketName.getValueAsString())
- .build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var bucket = new Bucket(this, "amzn-s3-demo-bucket")
-{
- BucketName = uploadBucketName.ValueAsString
-};
-----
-====
-
-[#parameters-deploy]
-== Deploy CDK apps containing parameters
-
-When you deploy a generated {aws} CloudFormation template through the {aws} CloudFormation console, you will be prompted to provide the values for each parameter.
-
-You can also provide parameter values using the CDK CLI `cdk deploy` command, or by specifying parameter values in your CDK project's stack file.
-
-[#parameters-deploy-cli]
-=== Provide parameter values with [.noloc]``cdk deploy``
-
-When you deploy using the CDK CLI `cdk deploy` command, you can provide parameter values at deployment with the `--parameters` option.
-
-The following is an example of the `cdk deploy` command structure:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy --parameters :=
-----
-
-If your CDK app contains a single stack, you don't have to provide the stack logical ID argument or the `stack-name` value in the `--parameters` option. The CDK CLI will automatically find and provide these values. The following is an example that specifies an `uploadbucket` value for the `uploadBucketName` parameter of the single stack in our CDK app:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy --parameters =
-----
-
-[#parameters-deploy-cli-multi-stack]
-=== Provide parameter values with cdk deploy for multi-stack applications
-
-The following is an example CDK application in TypeScript that contains two CDK stacks. Each stack contains an Amazon S3 bucket instance and a parameter to set the Amazon S3 bucket name:
-
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import * as s3 from 'aws-cdk-lib/aws-s3';
-
-// Define the CDK app
-const app = new cdk.App();
-
-// First stack
-export class MyFirstStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Set a default parameter name
- const bucketNameParam = new cdk.CfnParameter(this, 'bucketNameParam', {
- type: 'String',
- default: 'myfirststackdefaultbucketname'
- });
-
- // Define an S3 bucket
- new s3.Bucket(this, 'MyFirstBucket', {
- bucketName: bucketNameParam.valueAsString
- });
- }
-}
-
-// Second stack
-export class MySecondStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Set a default parameter name
- const bucketNameParam = new cdk.CfnParameter(this, 'bucketNameParam', {
- type: 'String',
- default: 'mysecondstackdefaultbucketname'
- });
-
- // Define an S3 bucket
- new s3.Bucket(this, 'MySecondBucket', {
- bucketName: bucketNameParam.valueAsString
- });
- }
-}
-
-// Instantiate the stacks
-new MyFirstStack(app, 'MyFirstStack', {
- stackName: 'MyFirstDeployedStack',
-});
-
-new MySecondStack(app, 'MySecondStack', {
- stackName: 'MySecondDeployedStack',
-});
-----
-
-For CDK apps that contain multiple stacks, you can do the following:
-
-* *Deploy one stack with parameters* – To deploy a single stack from a multi-stack application, provide the stack logical ID as an argument.
-+
-The following is an example that deploys `MySecondStack` with `mynewbucketname` as the parameter value for `bucketNameParam`:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy --parameters =''
-----
-* *Deploy all stacks and specify parameter values for each stack* – Provide the `'*'` wildcard or the `--all` option to deploy all stacks. Provide the `--parameters` option multiple times in a single command to specify parameter values for each stack. The following is an example:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy <'*'> --parameters :='' --parameters :=''
-----
-* *Deploy all stacks and specify parameter values for a single stack* – Provide the `'*'` wildcard or the `--all` option to deploy all stacks. Then, specify the stack to define the parameter for in the `--parameters` option. The following are examples that deploys all stacks in a CDK app and specifies a parameter value for the `MySecondDeployedStack` {aws} CloudFormation stack. All other stacks will deploy and use the default parameter value:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy <'*'> --parameters :=''
-$ cdk deploy <--all> --parameters :=''
-----
-
-[#parameters-deploy-cli-nested-stack]
-=== Provide parameter values with `cdk deploy` for applications with nested stacks
-
-The CDK CLI behavior when working with applications containing nested stacks is similar to multi-stack applications. The main difference is, if you want to deploy all nested stacks, use the `'\\**'` wildcard. The `'*'` wildcard deploys all stacks but will not deploy nested stacks. The `'**'` wildcard deploys all stacks, including nested stacks.
-
-The following is an example that deploys nested stacks while specifying the parameter value for one nested stack:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy '**' --parameters :=''
-----
-
-For more information on `cdk deploy` command options, see xref:ref-cli-cmd-deploy[cdk deploy].
\ No newline at end of file
diff --git a/v2/guide/get-context-var.adoc b/v2/guide/get-context-var.adoc
deleted file mode 100644
index b5fefdb6..00000000
--- a/v2/guide/get-context-var.adoc
+++ /dev/null
@@ -1,129 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[[get-context-var,get-context-var.title]]
-= Save and retrieve context variable values
-:info_titleabbrev: Get context value
-
-// Content start
-
-You can specify context variables with the {aws} Cloud Development Kit ({aws} CDK) CLI or in the `cdk.json` file. Then, use the `TryGetContext` method to retrieve values.
-
-[#develop-context-specify]
-== Specify context variables
-
-You can specify a context variable either as part of an {aws} CDK CLI command, or in `cdk.json`.
-
-To create a command line context variable, use the `--context` (`-c`) option, as shown in the following example.
-
-[source,none,subs="verbatim,attributes"]
-----
-cdk synth -c bucket_name=mygroovybucket
-----
-
-To specify the same context variable and value in the `cdk.json` file, use the following code.
-
-[source,json,subs="verbatim,attributes"]
-----
-{
- "context": {
- "bucket_name": "myotherbucket"
- }
-}
-----
-
-If you specify a context variable using both the {aws} CDK CLI and `cdk.json` file, the {aws} CDK CLI value takes precedence.
-
-[#develop-context-retrieve]
-== Retrieve context variable values
-
-To get the value of a context variable in your app, use the `TryGetContext` method in the context of a construct. (That is, when `this`, or `self` in Python, is an instance of some construct.)
-
-In this example, we retrieve the value of the `bucket_name` context variable. If the requested value is not defined, `TryGetContext` returns `undefined` (`None` in Python; `null` in Java and C#; `nil` in Go) rather than raising an exception.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket_name = this.node.tryGetContext('bucket_name');
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket_name = this.node.tryGetContext('bucket_name');
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-bucket_name = self.node.try_get_context("bucket_name")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-String bucketName = (String)this.getNode().tryGetContext("bucket_name");
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var bucketName = this.Node.TryGetContext("bucket_name");
-----
-====
-
-Outside the context of a construct, you can access the context variable from the app object, like this.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const app = new cdk.App();
-const bucket_name = app.node.tryGetContext('bucket_name')
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const app = new cdk.App();
-const bucket_name = app.node.tryGetContext('bucket_name');
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-app = cdk.App()
-bucket_name = app.node.try_get_context("bucket_name")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-App app = App();
-String bucketName = (String)app.getNode().tryGetContext("bucket_name");
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-app = App();
-var bucketName = app.Node.TryGetContext("bucket_name");
-----
-====
-
-For more details on working with context variables, see xref:context[Context values and the {aws} CDK].
\ No newline at end of file
diff --git a/v2/guide/get-env-var.adoc b/v2/guide/get-env-var.adoc
deleted file mode 100644
index a7275254..00000000
--- a/v2/guide/get-env-var.adoc
+++ /dev/null
@@ -1,79 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#get-env-var]
-= Get a value from an environment variable
-:info_titleabbrev: Get environment value
-
-// Content start
-
-To get the value of an environment variable, use code like the following. This code gets the value of the environment variable `amzn-s3-demo-bucket`.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-
-// Sets bucket_name to undefined if environment variable not set
-var bucket_name = process.env.amzn-s3-demo-bucket;
-
-// Sets bucket_name to a default if env var doesn't exist
-var bucket_name = process.env.amzn-s3-demo-bucket || "DefaultName";
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-
-// Sets bucket_name to undefined if environment variable not set
-var bucket_name = process.env.amzn-s3-demo-bucket;
-
-// Sets bucket_name to a default if env var doesn't exist
-var bucket_name = process.env.amzn-s3-demo-bucket || "DefaultName";
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import os
-
-# Raises KeyError if environment variable doesn't exist
-bucket_name = os.environ["amzn-s3-demo-bucket"]
-
-# Sets bucket_name to None if environment variable doesn't exist
-bucket_name = os.getenv("amzn-s3-demo-bucket")
-
-# Sets bucket_name to a default if env var doesn't exist
-bucket_name = os.getenv("amzn-s3-demo-bucket", "DefaultName")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// Sets bucketName to null if environment variable doesn't exist
-String bucketName = System.getenv("amzn-s3-demo-bucket");
-
-// Sets bucketName to a default if env var doesn't exist
-String bucketName = System.getenv("amzn-s3-demo-bucket");
-if (bucketName == null) bucketName = "DefaultName";
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using System;
-
-// Sets bucket name to null if environment variable doesn't exist
-string bucketName = Environment.GetEnvironmentVariable("amzn-s3-demo-bucket");
-
-// Sets bucket_name to a default if env var doesn't exist
-string bucketName = Environment.GetEnvironmentVariable("amzn-s3-demo-bucket") ?? "DefaultName";
-----
-====
\ No newline at end of file
diff --git a/v2/guide/get-sm-val.adoc b/v2/guide/get-sm-val.adoc
deleted file mode 100644
index a3168b7a..00000000
--- a/v2/guide/get-sm-val.adoc
+++ /dev/null
@@ -1,133 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#get-secrets-manager-value]
-= Get a value from {aws} Secrets Manager
-:info_titleabbrev: Get Secrets Manager value
-
-// Content start
-
-To use values from {aws} Secrets Manager in your {aws} CDK app, use the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html#static-fromwbrsecretwbrattributesscope-id-attrs[`fromSecretAttributes()`] method. It represents a value that is retrieved from Secrets Manager and used at {aws} CloudFormation deployment time. The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as sm from "aws-cdk-lib/aws-secretsmanager";
-
-export class SecretsManagerStack extends cdk.Stack {
- constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- const secret = sm.Secret.fromSecretAttributes(this, "ImportedSecret", {
- secretCompleteArn:
- "arn:aws:secretsmanager:::secret:-"
- // If the secret is encrypted using a KMS-hosted CMK, either import or reference that key:
- // encryptionKey: ...
- }
- );
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const sm = require("aws-cdk-lib/aws-secretsmanager");
-
-class SecretsManagerStack extends cdk.Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- const secret = sm.Secret.fromSecretAttributes(this, "ImportedSecret", {
- secretCompleteArn:
- "arn:aws:secretsmanager:::secret:-"
- // If the secret is encrypted using a KMS-hosted CMK, either import or reference that key:
- // encryptionKey: ...
- });
- }
-}
-
-module.exports = { SecretsManagerStack }
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_secretsmanager as sm
-
-class SecretsManagerStack(cdk.Stack):
- def __init__(self, scope: cdk.App, id: str, **kwargs):
- super().__init__(scope, name, **kwargs)
-
- secret = sm.Secret.from_secret_attributes(self, "ImportedSecret",
- secret_complete_arn="arn:aws:secretsmanager:::secret:-",
- # If the secret is encrypted using a KMS-hosted CMK, either import or reference that key:
- # encryption_key=....
- )
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.secretsmanager.Secret;
-import software.amazon.awscdk.services.secretsmanager.SecretAttributes;
-
-public class SecretsManagerStack extends Stack {
- public SecretsManagerStack(App scope, String id) {
- this(scope, id, null);
- }
-
- public SecretsManagerStack(App scope, String id, StackProps props) {
- super(scope, id, props);
-
- Secret secret = (Secret)Secret.fromSecretAttributes(this, "ImportedSecret", SecretAttributes.builder()
- .secretCompleteArn("arn:aws:secretsmanager:::secret:-")
- // If the secret is encrypted using a KMS-hosted CMK, either import or reference that key:
- // .encryptionKey(...)
- .build());
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.SecretsManager;
-
-public class SecretsManagerStack : Stack
-{
- public SecretsManagerStack(App scope, string id, StackProps props) : base(scope, id, props) {
-
- var secret = Secret.FromSecretAttributes(this, "ImportedSecret", new SecretAttributes {
- SecretCompleteArn = "arn:aws:secretsmanager:::secret:-"
- // If the secret is encrypted using a KMS-hosted CMK, either import or reference that key:
- // encryptionKey = ...,
- });
- }
-}
-----
-====
-
-[TIP]
-====
-
-Use the {aws} CLI link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html[`create-secret`] CLI command to create a secret from the command line, such as when testing:
-
-[source,none,subs="verbatim,attributes"]
-----
-aws secretsmanager create-secret --name ImportedSecret --secret-string mygroovybucket
-----
-
-The command returns an ARN that you can use with the preceding example.
-
-====
-
-Once you have created a `Secret` instance, you can get the secret's value from the instance's `secretValue` attribute. The value is represented by a link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html[`SecretValue`] instance, a special type of xref:tokens[Tokens and the {aws} CDK]. Because it's a token, it has meaning only after resolution. Your CDK app does not need to access its actual value. Instead, the app can pass the `SecretValue` instance (or its string or numeric representation) to whatever CDK method needs the value.
\ No newline at end of file
diff --git a/v2/guide/get-ssm-val.adoc b/v2/guide/get-ssm-val.adoc
deleted file mode 100644
index ba6f62e2..00000000
--- a/v2/guide/get-ssm-val.adoc
+++ /dev/null
@@ -1,201 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[[get-ssm-value,get-ssm-value.title]]
-= Get a value from the Systems Manager Parameter Store
-:info_titleabbrev: Get SSM value
-
-// Content start
-
-The {aws} Cloud Development Kit ({aws} CDK) can retrieve the value of {aws} Systems Manager Parameter Store attributes. During synthesis, the {aws} CDK produces a xref:tokens[token] that is resolved by {aws} CloudFormation during deployment.
-
-The {aws} CDK supports retrieving both plain and secure values. You may request a specific version of either kind of value. For plain values, you may omit the version from your request to retrieve the latest version. For secure values, you must specify the version when requesting the value of the secure attribute.
-
-[NOTE]
-====
-
-This topic shows how to read attributes from the {aws} Systems Manager Parameter Store. You can also read secrets from the {aws} Secrets Manager (see xref:get-secrets-manager-value[Get a value from {aws} Secrets Manager]).
-
-====
-
-[#ssm-read-at-deploy]
-== Read Systems Manager values at deployment time
-
-To read values from the Systems Manager Parameter Store, use the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm.StringParameter.html#static-valuewbrforwbrstringwbrparameterscope-parametername-version[`valueForStringParameter`] and link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm.StringParameter.html#static-valuewbrforwbrsecurewbrstringwbrparameterscope-parametername-version[`valueForSecureStringParameter`] methods. Choose a method based on whether the attribute you want is a plain string or a secure string value. These methods return xref:tokens[tokens], not the actual value. The value is resolved by {aws} CloudFormation during deployment. The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as ssm from 'aws-cdk-lib/aws-ssm';
-
-// Get latest version or specified version of plain string attribute
-const latestStringToken = ssm.StringParameter.valueForStringParameter(
- this, 'my-plain-parameter-name'); // latest version
-const versionOfStringToken = ssm.StringParameter.valueForStringParameter(
- this, 'my-plain-parameter-name', 1); // version 1
-
-// Get specified version of secure string attribute
-const secureStringToken = ssm.StringParameter.valueForSecureStringParameter(
- this, 'my-secure-parameter-name', 1); // must specify version
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const ssm = require('aws-cdk-lib/aws-ssm');
-
-// Get latest version or specified version of plain string attribute
-const latestStringToken = ssm.StringParameter.valueForStringParameter(
- this, 'my-plain-parameter-name'); // latest version
-const versionOfStringToken = ssm.StringParameter.valueForStringParameter(
- this, 'my-plain-parameter-name', 1); // version 1
-
-// Get specified version of secure string attribute
-const secureStringToken = ssm.StringParameter.valueForSecureStringParameter(
- this, 'my-secure-parameter-name', 1); // must specify version
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_ssm as ssm
-
-# Get latest version or specified version of plain string attribute
-latest_string_token = ssm.StringParameter.value_for_string_parameter(
- self, "my-plain-parameter-name")
-latest_string_token = ssm.StringParameter.value_for_string_parameter(
- self, "my-plain-parameter-name", 1)
-
-# Get specified version of secure string attribute
-secure_string_token = ssm.StringParameter.value_for_secure_string_parameter(
- self, "my-secure-parameter-name", 1) # must specify version
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.ssm.StringParameter;
-
-//Get latest version or specified version of plain string attribute
-String latestStringToken = StringParameter.valueForStringParameter(
- this, "my-plain-parameter-name"); // latest version
-String versionOfStringToken = StringParameter.valueForStringParameter(
- this, "my-plain-parameter-name", 1); // version 1
-
-//Get specified version of secure string attribute
-String secureStringToken = StringParameter.valueForSecureStringParameter(
- this, "my-secure-parameter-name", 1); // must specify version
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.SSM;
-
-// Get latest version or specified version of plain string attribute
-var latestStringToken = StringParameter.ValueForStringParameter(
- this, "my-plain-parameter-name"); // latest version
-var versionOfStringToken = StringParameter.ValueForStringParameter(
- this, "my-plain-parameter-name", 1); // version 1
-
-// Get specified version of secure string attribute
-var secureStringToken = StringParameter.ValueForSecureStringParameter(
- this, "my-secure-parameter-name", 1); // must specify version
-----
-====
-
-A link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#template-parameters-dynamic-patterns-resources[limited number of {aws} services] currently support this feature.
-
-[#ssm-read-at-synth]
-== Read Systems Manager values at synthesis time
-
-At times, it's useful to provide a parameter at synthesis time. By doing this, the {aws} CloudFormation template will always use the same value instead of resolving the value during deployment.
-
-To read a value from the Systems Manager Parameter Store at synthesis time, use the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm.StringParameter.html#static-valuewbrfromwbrlookupscope-parametername[`valueFromLookup`] method (Python: `value_from_lookup`). This method returns the actual value of the parameter as a xref:context[Context values and the {aws} CDK] value. If the value is not already cached in `cdk.json` or passed on the command line, it is retrieved from the current {aws} account. For this reason, the stack _must_ be synthesized with explicit {aws} environment information.
-
-The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as ssm from 'aws-cdk-lib/aws-ssm';
-
-const stringValue = ssm.StringParameter.valueFromLookup(this, 'my-plain-parameter-name');
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const ssm = require('aws-cdk-lib/aws-ssm');
-
-const stringValue = ssm.StringParameter.valueFromLookup(this, 'my-plain-parameter-name');
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_ssm as ssm
-
-string_value = ssm.StringParameter.value_from_lookup(self, "my-plain-parameter-name")
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.ssm.StringParameter;
-
-String stringValue = StringParameter.valueFromLookup(this, "my-plain-parameter-name");
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.SSM;
-
-var stringValue = StringParameter.ValueFromLookup(this, "my-plain-parameter-name");
-----
-====
-
-Only plain Systems Manager strings may be retrieved. Secure strings cannot be retrieved. The latest version will always be returned. Specific versions cannot be requested.
-
-[IMPORTANT]
-====
-
-The retrieved value will end up in your synthesized {aws} CloudFormation template. This might be a security risk, depending on who has access to your {aws} CloudFormation templates and what kind of value it is. Generally, don't use this feature for passwords, keys, or other values you want to keep private.
-
-====
-
-[#ssm-write]
-== Write values to Systems Manager
-
-You can use the {aws} CLI, the {aws} Management Console, or an {aws} SDK to set Systems Manager parameter values. The following examples use the link:https://docs.aws.amazon.com/cli/latest/reference/ssm/put-parameter.html[`ssm put-parameter`] CLI command.
-
-[source,none,subs="verbatim,attributes"]
-----
-aws ssm put-parameter --name "parameter-name" --type "String" --value "parameter-value"
-aws ssm put-parameter --name "secure-parameter-name" --type "SecureString" --value "secure-parameter-value"
-----
-
-When updating an SSM value that already exists, also include the `--overwrite` option.
-
-[source,none,subs="verbatim,attributes"]
-----
-aws ssm put-parameter --overwrite --name "parameter-name" --type "String" --value "parameter-value"
-aws ssm put-parameter --overwrite --name "secure-parameter-name" --type "SecureString" --value "secure-parameter-value"
-----
\ No newline at end of file
diff --git a/v2/guide/getting-started.adoc b/v2/guide/getting-started.adoc
deleted file mode 100644
index f4e56de6..00000000
--- a/v2/guide/getting-started.adoc
+++ /dev/null
@@ -1,99 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#getting-started]
-= Getting started with the {aws} CDK
-:info_titleabbrev: Getting started
-:info_abstract: Get started with the {aws} Cloud Development Kit ({aws} CDK) by installing and configuring the {aws} CDK Command Line Interface ({aws} CDK CLI). Then, use the CDK CLI to create your first CDK app, bootstrap your {aws} environment, and deploy your application.
-:keywords: {aws} CDK, {aws} Cloud Development Kit ({aws} CDK), {aws} services, infrastructure as code, IaC
-
-[abstract]
---
-Get started with the {aws} Cloud Development Kit ({aws} CDK) by installing and configuring the {aws} CDK Command Line Interface ({aws} CDK CLI). Then, use the CDK CLI to create your first CDK app, bootstrap your {aws} environment, and deploy your application.
---
-
-// Content start
-
-Get started with the {aws} Cloud Development Kit ({aws} CDK) by installing and configuring the {aws} CDK Command Line Interface ({aws} CDK CLI). Then, use the CDK CLI to create your first CDK app, bootstrap your {aws} environment, and deploy your application.
-
-[#getting-started-prerequisites]
-== Prerequisites
-
-Before getting started with the {aws} CDK, complete all prerequisites. These prerequisites are required for those that are new to {aws} or new to programming. For instructions, see xref:prerequisites[{aws} CDK prerequisites].
-
-We recommend that you have a basic understanding of what the {aws} CDK is. For more information, see xref:home[What is the {aws} CDK?] and xref:core-concepts[Learn {aws} CDK core concepts].
-
-[#getting-started-install]
-== Install the {aws} CDK CLI
-
-Use the [.noloc]`Node` Package Manager to install the CDK CLI. We recommend that you install it globally using the following command:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ npm install -g aws-cdk
-----
-
-To install a specific version of the CDK CLI, use the following command structure:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ npm install -g aws-cdk@X.YY.Z
-----
-
-If you want to use multiple versions of the {aws} CDK, consider installing a matching version of the CDK CLI in individual CDK projects. To do this, remove the `-g` option from the `npm install` command. Then, use `npx aws-cdk` to invoke the CDK CLI. This will run a local version if it exists. Otherwise, the globally installed version will be used.
-
-[#getting-started-install-troubleshoot]
-*Troubleshoot a CDK CLI installation*::
-+
-If you get a permission error, and have administrator access on your system, run the following:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ sudo npm install -g aws-cdk
-----
-+
-If you receive an error message, try uninstalling the CDK CLI by running the following:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ npm uninstall -g aws-cdk
-----
-+
-Then, repeat steps to reinstall the CDK CLI.
-
-[#getting-started-install-verify]
-== Verify a successful CDK CLI installation
-
-Run the following command to verify a successful installation. The {aws} CDK CLI should output the version number:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk --version
-----
-
-[#getting-started-configure]
-== Configure the {aws} CDK CLI
-
-After installing the CDK CLI, you can start using it to develop applications on your local machine. To interact with {aws}, such as deploying applications, you must have security credentials configured on your local machine with permissions to perform any actions that you initiate.
-
-To configure security credentials on your local machine, you use the {aws} CLI. How you configure security credentials depends on how you manage users. For instructions, see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-authentication.html[Authentication and access credentials] in the _{aws} Command Line Interface User Guide_.
-
-The CDK CLI will automatically use the security credentials that you configure with the {aws} CLI. For example, if you are an IAM Identity Center user, you can use the `aws configure sso` command to configure security credentials. If you are an IAM user, you can use the `aws configure` command. The {aws} CLI will guide you through configuring security credentials on your local machine and save the necessary information in your `config` and `credentials` files. Then, when you use the CDK CLI, such as deploying an application with `cdk deploy`, the CDK CLI will use your configured security credentials.
-
-Just like the {aws} CLI, the CDK CLI will use your `default` profile by default. You can specify a profile using the CDK CLI xref:ref-cli-cmd-options-profile[`--profile`] option. For more information on using security credentials with the CDK CLI, see xref:configure-access[Configure security credentials for the {aws} CDK CLI].
-
-[#getting-started-tools]
-== (Optional) Install additional {aws} CDK tools
-
-The https://aws.amazon.com/visualstudiocode/[{aws} Toolkit for Visual Studio Code] is an open source plug-in for [.noloc]`Visual Studio Code` that helps you create, debug, and deploy applications on {aws}. The toolkit provides an integrated experience for developing {aws} CDK applications. It includes the {aws} CDK Explorer feature to list your {aws} CDK projects and browse the various components of the CDK application. For instructions, see the following:
-
-* https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/setup-toolkit.html[Installing the {aws} Toolkit for Visual Studio Code].
-* https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/cdk-explorer.html[{aws} CDK for VS Code].
-
-[#getting-started-app]
-== Create your first CDK app
-
-You're now ready to get started with using the {aws} CDK by creating your first CDK app. For instructions, see xref:hello-world[Tutorial: Create your first {aws} CDK app].
-
-include::hello-world.adoc[leveloffset=+1]
\ No newline at end of file
diff --git a/v2/guide/hello-world.adoc b/v2/guide/hello-world.adoc
deleted file mode 100644
index 2692f155..00000000
--- a/v2/guide/hello-world.adoc
+++ /dev/null
@@ -1,1665 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#hello-world]
-= Tutorial: Create your first {aws} CDK app
-:info_titleabbrev: Create your first CDK app
-:info_abstract: Get started with the {aws} Cloud Development Kit ({aws} CDK) by using the {aws} CDK Command Line Interface ({aws} CDK CLI) to develop your first \
- CDK app, bootstrap your {aws} environment, and deploy your application on {aws}.
-:keywords: {aws} CDK, {aws} Cloud Development Kit ({aws} CDK), CDK app, {aws}, {aws} CloudFormation, Infrastructure as code, IaC
-
-[abstract]
---
-Get started with the {aws} Cloud Development Kit ({aws} CDK) by using the {aws} CDK Command Line Interface ({aws} CDK CLI) to develop your first CDK app, bootstrap your {aws} environment, and deploy your application on {aws}.
---
-
-// Content start
-Get started with using the {aws} Cloud Development Kit ({aws} CDK) by using the {aws} CDK Command Line Interface ({aws} CDK CLI) to develop your first CDK app, bootstrap your {aws} environment, and deploy your application on {aws}.
-
-[#hello-world-prerequisites]
-== Prerequisites
-
-Before starting this tutorial, complete all set up steps in xref:getting-started[Getting started with the {aws} CDK].
-
-[#hello-world-about,hello-world-about.title]
-== About this tutorial
-
-In this tutorial, you will create and deploy a simple application on {aws} using the {aws} CDK. The application consists of an https://docs.aws.amazon.com/lambda/latest/dg/welcome.html[{aws} Lambda function] that returns a `Hello World!` message when invoked. The function will be invoked through a https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html[Lambda function URL] that serves as a dedicated HTTP(S) endpoint for your Lambda function.
-
-Through this tutorial, you will perform the following:
-
-* *Create your project* – Create a CDK project using the CDK CLI `cdk init` command.
-* *Configure your {aws} environment* – Configure the {aws} environment that you will deploy your application into.
-* *Bootstrap your {aws} environment* – Prepare your {aws} environment for deployment by bootstrapping it using the CDK CLI `cdk bootstrap` command.
-* *Develop your app* – Use constructs from the {aws} Construct Library to define your Lambda function and Lambda function URL resources.
-* *Prepare your app for deployment* – Use the CDK CLI to build your app and synthesize an {aws} CloudFormation template.
-* *Deploy your app* – Use the CDK CLI `cdk deploy` command to deploy your application and provision your {aws} resources.
-* *Interact with your application* – Interact with your deployed Lambda function on {aws} by invoking it and receiving a response.
-* *Modify your app* – Modify your Lambda function and deploy to implement your changes.
-* *Delete your app* – Delete all resources that you created by using the CDK CLI `cdk destroy` command.
-
-
-[#hello-world-create]
-== Step 1: Create your CDK project
-
-In this step, you create a new CDK project. A CDK project should be in its own directory, with its own local module dependencies.
-
-*To create a CDK project*::
-+
-. From a starting directory of your choice, create and navigate to a directory named `hello-cdk`:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ mkdir hello-cdk && cd hello-cdk
-----
-+
-IMPORTANT: Be sure to name your project directory `hello-cdk`, _exactly as shown here_. The CDK CLI uses this directory name to name things within your CDK code. If you use a different directory name, you will run into issues during this tutorial.
-
-. From the `hello-cdk` directory, initialize a new CDK project using the CDK CLI``cdk init`` command. Specify the `app` template and your preferred programming language with the `--language` option:
-+
-====
-[role="tablist"]
-TypeScript::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk init app --language typescript
-----
-
-JavaScript::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk init app --language javascript
-----
-
-Python::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk init app --language python
-----
-+
-After the app has been created, also enter the following two commands. These activate the app's Python virtual environment and installs the {aws} CDK core dependencies.
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ source .venv/bin/activate # On Windows, run `.\venv\Scripts\activate` instead
-$ python -m pip install -r requirements.txt
-----
-
-Java::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk init app --language java
-----
-+
-If you are using an IDE, you can now open or import the project. In [.noloc]``Eclipse``, for example, choose *File* > *Import* > *Maven* > **Existing Maven Projects**. Make sure that the project settings are set to use Java 8 (1.8).
-
-C#::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk init app --language csharp
-----
-+
-If you are using Visual Studio, open the solution file in the `src` directory.
-
-Go::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk init app --language go
-----
-+
-After the app has been created, also enter the following command to install the {aws} Construct Library modules that the app requires.
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ go get
-----
-====
-
-The `cdk init` command creates a structure of files and folders within the `hello-cdk` directory to help organize the source code for your CDK app. This structure of files and folders is called your CDK _project_. Take a moment to explore your CDK project.
-
-If you have [.noloc]`Git` installed, each project you create using `cdk init` is also initialized as a [.noloc]``Git`` repository.
-
-During project initialization, the CDK CLI creates a CDK app containing a single CDK stack. The CDK app instance is created using the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.App.html[`App`] construct. The following is a portion of this code from your CDK application file:
-
-====
-[role="tablist"]
-TypeScript::
-Located in `bin/hello-cdk.ts`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-import 'source-map-support/register';
-import * as cdk from 'aws-cdk-lib';
-import { HelloCdkStack } from '../lib/hello-cdk-stack';
-
-const app = new cdk.App();
-new HelloCdkStack(app, 'HelloCdkStack', {
-});
-----
-
-JavaScript::
-Located in `bin/hello-cdk.js`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-
-const cdk = require('aws-cdk-lib');
-const { HelloCdkStack } = require('../lib/hello-cdk-stack');
-
-const app = new cdk.App();
-new HelloCdkStack(app, 'HelloCdkStack', {
-});
-----
-
-Python::
-Located in `app.py`:
-+
-[source,python,subs="verbatim,attributes"]
-----
-#!/usr/bin/env python3
-import os
-
-import aws_cdk as cdk
-
-from hello_cdk.hello_cdk_stack import HelloCdkStack
-
-app = cdk.App()
-HelloCdkStack(app, "HelloCdkStack",)
-
-app.synth()
-----
-
-Java::
-Located in `src/main/java/.../HelloCdkApp.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.Environment;
-import software.amazon.awscdk.StackProps;
-
-import java.util.Arrays;
-
-public class HelloCdkApp {
- public static void main(final String[] args) {
- App app = new App();
-
- new HelloCdkStack(app, "HelloCdkStack", StackProps.builder()
- .build());
-
- app.synth();
- }
-}
-----
-
-C#::
-Located in `src/HelloCdk/Program.cs`:
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HelloCdk
-{
- sealed class Program
- {
- public static void Main(string[] args)
- {
- var app = new App();
- new HelloCdkStack(app, "HelloCdkStack", new StackProps
- {});
- app.Synth();
- }
- }
-}
-----
-
-Go::
-Located in `hello-cdk.go`:
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-// ...
-
-func main() {
- defer jsii.Close()
-
- app := awscdk.NewApp(nil)
-
- NewHelloCdkStack(app, "HelloCdkStack", &HelloCdkStackProps{
- awscdk.StackProps{
- Env: env(),
- },
- })
-
- app.Synth(nil)
-}
-
-// ...
-----
-====
-
-The CDK stack is created using the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html[`Stack`] construct. The following is a portion of this code from your CDK stack file:
-
-====
-[role="tablist"]
-TypeScript::
-Located in `lib/hello-cdk-stack.ts`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-
-export class HelloCdkStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Define your constructs here
-
- }
-}
-----
-
-JavaScript::
-Located in `lib/hello-cdk-stack.js`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Stack } = require('aws-cdk-lib');
-
-class HelloCdkStack extends Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // Define your constructs here
-
- }
-}
-
-module.exports = { HelloCdkStack }
-----
-
-Python::
-Located in `hello_cdk/hello_cdk_stack.py`:
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import (
- Stack,
-)
-from constructs import Construct
-
-class HelloCdkStack(Stack):
-
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- # Define your constructs here
-----
-
-Java::
-Located in `src/main/java/.../HelloCdkStack.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-
-public class HelloCdkStack extends Stack {
- public HelloCdkStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public HelloCdkStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- // Define your constructs here
- }
-}
-----
-
-C#::
-Located in `src/HelloCdk/HelloCdkStack.cs`:
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-
-namespace HelloCdk
-{
- public class HelloCdkStack : Stack
- {
- internal HelloCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- // Define your constructs here
- }
- }
-}
-----
-
-Go::
-Located in `hello-cdk.go`:
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-type HelloCdkStackProps struct {
- awscdk.StackProps
-}
-
-func NewHelloCdkStack(scope constructs.Construct, id string, props *HelloCdkStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- return stack
-}
-
-// ...
-----
-====
-
-[#hello-world-configure]
-== Step 2: Configure your {aws} environment
-
-In this step, you configure the {aws} environment for your CDK stack. By doing this, you specify which environment your CDK stack will be deployed to.
-
-First, determine the {aws} environment that you want to use. An {aws} environment consists of an {aws} account and {aws} Region.
-
-When you use the {aws} CLI to configure security credentials on your local machine, you can then use the {aws} CLI to obtain {aws} environment information for a specific profile.
-
-*To use the {aws} CLI to obtain your {aws} account ID*::
-+
-. Run the following {aws} CLI command to get the {aws} account ID for your `default` profile:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ aws sts get-caller-identity --query "Account" --output text
-----
-+
-. If you prefer to use a named profile, provide the name of your profile using the `--profile` option:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ aws sts get-caller-identity --profile your-profile-name --query "Account" --output text
-----
-
-*To use the {aws} CLI to obtain your {aws} Region*::
-+
-. Run the following {aws} CLI command to get the Region that you configured for your `default` profile:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ aws configure get region
-----
-+
-. If you prefer to use a named profile, provide the name of your profile using the `--profile` option:
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ aws configure get region --profile your-profile-name
-----
-
-Next, you will configure the {aws} environment for your CDK stack by modifying the `HelloCdkStack` instance in your __application file__. For this tutorial, you will hard code your {aws} environment information. This is recommended for production environments. For information on other ways to configure environments, see xref:configure-env[Configure environments to use with the {aws} CDK].
-
-*To configure the environment for your CDK stack*::
-+
-. In your _application file_, use the `env` property of the `Stack` construct to configure your environment. The following is an example:
-+
-====
-[role="tablist"]
-TypeScript:::
-Located in `bin/hello-cdk.ts`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-import 'source-map-support/register';
-import * as cdk from 'aws-cdk-lib';
-import { HelloCdkStack } from '../lib/hello-cdk-stack';
-
-const app = new cdk.App();
-new HelloCdkStack(app, 'HelloCdkStack', {
- env: { account: '123456789012', region: 'us-east-1' },
-});
-----
-
-JavaScript:::
-Located in `bin/hello-cdk.js`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-
-const cdk = require('aws-cdk-lib');
-const { HelloCdkStack } = require('../lib/hello-cdk-stack');
-
-const app = new cdk.App();
-new HelloCdkStack(app, 'HelloCdkStack', {
- env: { account: '123456789012', region: 'us-east-1' },
-});
-----
-
-Python:::
-Located in `app.py`:
-+
-[source,python,subs="verbatim,attributes"]
-----
-#!/usr/bin/env python3
-import os
-
-import aws_cdk as cdk
-
-from hello_cdk.hello_cdk_stack import HelloCdkStack
-
-app = cdk.App()
-HelloCdkStack(app, "HelloCdkStack",
- env=cdk.Environment(account='123456789012', region='us-east-1'),
- )
-
-app.synth()
-----
-
-Java:::
-Located in `src/main/java/.../HelloCdkApp.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.Environment;
-import software.amazon.awscdk.StackProps;
-
-import java.util.Arrays;
-
-public class HelloCdkApp {
- public static void main(final String[] args) {
- App app = new App();
-
- new HelloCdkStack(app, "HelloCdkStack", StackProps.builder()
- .env(Environment.builder()
- .account("123456789012")
- .region("us-east-1")
- .build())
-
- .build());
-
- app.synth();
- }
-}
-----
-
-C#:::
-Located in `src/HelloCdk/Program.cs`:
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HelloCdk
-{
- sealed class Program
- {
- public static void Main(string[] args)
- {
- var app = new App();
- new HelloCdkStack(app, "HelloCdkStack", new StackProps
- {
- Env = new Amazon.CDK.Environment
- {
- Account = "123456789012",
- Region = "us-east-1",
- }
- });
- app.Synth();
- }
- }
-}
-----
-
-Go:::
-Located in `hello-cdk.go`:
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-// ...
-
-func main() {
- defer jsii.Close()
-
- app := awscdk.NewApp(nil)
-
- NewHelloCdkStack(app, "HelloCdkStack", &HelloCdkStackProps{
- awscdk.StackProps{
- Env: env(),
- },
- })
-
- app.Synth(nil)
-}
-
-func env() *awscdk.Environment {
- return &awscdk.Environment{
- Account: jsii.String("123456789012"),
- Region: jsii.String("us-east-1"),
- }
-}
-----
-====
-
-[#hello-world-bootstrap]
-== Step 3: Bootstrap your {aws} environment
-
-In this step, you bootstrap the {aws} environment that you configured in the previous step. This prepares your environment for CDK deployments.
-
-To bootstrap your environment, run the following from the root of your CDK project:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk bootstrap
-----
-
-By bootstrapping from the root of your CDK project, you don't have to provide any additional information. The CDK CLI obtains environment information from your project. When you bootstrap outside of a CDK project, you must provide environment information with the `cdk bootstrap` command. For more information, see xref:bootstrapping-env[Bootstrap your environment for use with the {aws} CDK].
-
-[#hello-world-build]
-== Step 4: Build your CDK app
-
-In most programming environments, you build or compile code after making changes. This isn't necessary with the {aws} CDK since the CDK CLI will automatically perform this step. However, you can still build manually when you want to catch syntax and type errors. The following is an example:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ npm run build
-
-> hello-cdk@0.1.0 build
-> tsc
-----
-
-JavaScript::
-No build step is necessary.
-
-Python::
-No build step is necessary.
-
-Java::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ mvn compile -q
-----
-+
-Or press `Control-B` in Eclipse (other Java IDEs may vary)
-
-C#::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ dotnet build src
-----
-+
-Or press F6 in Visual Studio
-
-Go::
-+
-[source,bash,subs="verbatim,attributes"]
-----
-$ go build
-----
-====
-
-[#hello-world-list]
-== Step 5: List the CDK stacks in your app
-
-At this point, you should have a CDK app containing a single CDK stack. To verify, use the CDK CLI `cdk list` command to display your stacks. The output should display a single stack named `HelloCdkStack`:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk list
-HelloCdkStack
-----
-
-If you don't see this output, verify that you are in the correct working directory of your project and try again. If you still don't see your stack, repeat xref:hello-world-create[Step 1: Create your CDK project] and try again.
-
-[#hello-world-function]
-== Step 6: Define your Lambda function
-
-In this step, you import the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html[`aws_lambda`] module from the {aws} Construct Library and use the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html[`Function`] L2 construct.
-
-Modify your CDK stack file as follows:
-
-====
-[role="tablist"]
-TypeScript::
-Located in `lib/hello-cdk-stack.ts`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-// Import the Lambda module
-import * as lambda from 'aws-cdk-lib/aws-lambda';
-
-export class HelloCdkStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Define the Lambda function resource
- const myFunction = new lambda.Function(this, "HelloWorldFunction", {
- runtime: lambda.Runtime.NODEJS_20_X, // Provide any supported Node.js runtime
- handler: "index.handler",
- code: lambda.Code.fromInline(`
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello World!'),
- };
- };
- `),
- });
- }
-}
-----
-
-JavaScript::
-Located in `lib/hello-cdk-stack.js`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Stack } = require('aws-cdk-lib');
-// Import the Lambda module
-const lambda = require('aws-cdk-lib/aws-lambda');
-
-class HelloCdkStack extends Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // Define the Lambda function resource
- const myFunction = new lambda.Function(this, "HelloWorldFunction", {
- runtime: lambda.Runtime.NODEJS_20_X, // Provide any supported Node.js runtime
- handler: "index.handler",
- code: lambda.Code.fromInline(`
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello World!'),
- };
- };
- `),
- });
-
- }
-}
-
-module.exports = { HelloCdkStack }
-----
-
-Python::
-Located in `hello_cdk/hello_cdk_stack.py`:
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import (
- Stack,
- aws_lambda as _lambda, # Import the Lambda module
-)
-from constructs import Construct
-
-class HelloCdkStack(Stack):
-
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- # Define the Lambda function resource
- my_function = _lambda.Function(
- self, "HelloWorldFunction",
- runtime = _lambda.Runtime.NODEJS_20_X, # Provide any supported Node.js runtime
- handler = "index.handler",
- code = _lambda.Code.from_inline(
- """
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello World!'),
- };
- };
- """
- ),
- )
-----
-
-Java::
-Located in `src/main/java/.../HelloCdkStack.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-// Import Lambda function
-import software.amazon.awscdk.services.lambda.Code;
-import software.amazon.awscdk.services.lambda.Function;
-import software.amazon.awscdk.services.lambda.Runtime;
-
-public class HelloCdkStack extends Stack {
- public HelloCdkStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public HelloCdkStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- // Define the Lambda function resource
- Function myFunction = Function.Builder.create(this, "HelloWorldFunction")
- .runtime(Runtime.NODEJS_20_X) // Provide any supported Node.js runtime
- .handler("index.handler")
- .code(Code.fromInline(
- "exports.handler = async function(event) {" +
- " return {" +
- " statusCode: 200," +
- " body: JSON.stringify('Hello World!')" +
- " };" +
- "};"))
- .build();
-
- }
-}
-----
-
-C#::
-Located in `src/main/java/.../HelloCdkStack.java`:
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-// Import the Lambda module
-using Amazon.CDK.{aws}.Lambda;
-
-namespace HelloCdk
-{
- public class HelloCdkStack : Stack
- {
- internal HelloCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- // Define the Lambda function resource
- var myFunction = new Function(this, "HelloWorldFunction", new FunctionProps
- {
- Runtime = Runtime.NODEJS_20_X, // Provide any supported Node.js runtime
- Handler = "index.handler",
- Code = Code.FromInline(@"
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello World!'),
- };
- };
- "),
- });
- }
- }
-}
-----
-
-Go::
-Located in `hello-cdk.go`:
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
- // Import the Lambda module
- "github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
-)
-
-type HelloCdkStackProps struct {
- awscdk.StackProps
-}
-
-func NewHelloCdkStack(scope constructs.Construct, id string, props *HelloCdkStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- // Define the Lambda function resource
- myFunction := awslambda.NewFunction(stack, jsii.String("HelloWorldFunction"), &awslambda.FunctionProps{
- Runtime: awslambda.Runtime_NODEJS_20_X(), // Provide any supported Node.js runtime
- Handler: jsii.String("index.handler"),
- Code: awslambda.Code_FromInline(jsii.String(`
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello World!'),
- };
- };
- `)),
- })
-
- return stack
-}
-
-// ...
-----
-====
-
-Let's take a closer look at the `Function` construct. Like all constructs, the `Function` class takes three parameters:
-
-* *scope* – Defines your `Stack` instance as the parent of the `Function` construct. All constructs that define {aws} resources are created within the scope of a stack. You can define constructs inside of constructs, creating a hierarchy (tree). Here, and in most cases, the scope is `this` (`self` in Python).
-* *Id* – The construct ID of the `Function` within your {aws} CDK app. This ID, plus a hash based on the function's location within the stack, uniquely identifies the function during deployment. The {aws} CDK also references this ID when you update the construct in your app and re-deploy to update the deployed resource. Here, your construct ID is ``HelloWorldFunction``. Functions can also have a name, specified with the `functionName` property. This is different from the construct ID.
-* *props* – A bundle of values that define properties of the function. Here you define the `runtime`, `handler`, and `code` properties.
-+
-Props are represented differently in the languages supported by the {aws} CDK.
-+
-** In TypeScript and JavaScript, `props` is a single argument and you pass in an object containing the desired properties.
-** In Python, props are passed as keyword arguments.
-** In Java, a Builder is provided to pass the props. There are two: one for ``FunctionProps``, and a second for `Function` to let you build the construct and its props object in one step. This code uses the latter.
-** In C#, you instantiate a `FunctionProps` object using an object initializer and pass it as the third parameter.
-+
-
-If a construct's props are optional, you can omit the `props` parameter entirely.
-
-All constructs take these same three arguments, so it's easy to stay oriented as you learn about new ones. And as you might expect, you can subclass any construct to extend it to suit your needs, or if you want to change its defaults.
-
-[#hello-world-url]
-== Step 7: Define your Lambda function URL
-
-In this step, you use the `addFunctionUrl` helper method of the `Function` construct to define a Lambda function URL. To output the value of this URL at deployment, you will create an {aws} CloudFormation output using the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnOutput.html[`CfnOutput`] construct.
-
-Add the following to your CDK stack file:
-
-====
-[role="tablist"]
-TypeScript::
-Located in `lib/hello-cdk-stack.ts`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// ...
-
-export class HelloCdkStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Define the Lambda function resource
- // ...
-
- // Define the Lambda function URL resource
- const myFunctionUrl = myFunction.addFunctionUrl({
- authType: lambda.FunctionUrlAuthType.NONE,
- });
-
- // Define a CloudFormation output for your URL
- new cdk.CfnOutput(this, "myFunctionUrlOutput", {
- value: myFunctionUrl.url,
- })
-
- }
-}
-----
-
-JavaScript::
-Located in `lib/hello-cdk-stack.js`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Stack, CfnOutput } = require('aws-cdk-lib'); // Import CfnOutput
-
-class HelloCdkStack extends Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // Define the Lambda function resource
- // ...
-
- // Define the Lambda function URL resource
- const myFunctionUrl = myFunction.addFunctionUrl({
- authType: lambda.FunctionUrlAuthType.NONE,
- });
-
- // Define a CloudFormation output for your URL
- new CfnOutput(this, "myFunctionUrlOutput", {
- value: myFunctionUrl.url,
- })
-
- }
-}
-
-module.exports = { HelloCdkStack }
-----
-
-Python::
-Located in `hello_cdk/hello_cdk_stack.py`:
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import (
- # ...
- CfnOutput # Import CfnOutput
-)
-from constructs import Construct
-
-class HelloCdkStack(Stack):
-
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- # Define the Lambda function resource
- # ...
-
- # Define the Lambda function URL resource
- my_function_url = my_function.add_function_url(
- auth_type = _lambda.FunctionUrlAuthType.NONE,
- )
-
- # Define a CloudFormation output for your URL
- CfnOutput(self, "myFunctionUrlOutput", value=my_function_url.url)
-----
-
-Java::
-Located in `src/main/java/.../HelloCdkStack.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-// ...
-// Import Lambda function URL
-import software.amazon.awscdk.services.lambda.FunctionUrl;
-import software.amazon.awscdk.services.lambda.FunctionUrlAuthType;
-import software.amazon.awscdk.services.lambda.FunctionUrlOptions;
-// Import CfnOutput
-import software.amazon.awscdk.CfnOutput;
-
-public class HelloCdkStack extends Stack {
- public HelloCdkStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public HelloCdkStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- // Define the Lambda function resource
- // ...
-
- // Define the Lambda function URL resource
- FunctionUrl myFunctionUrl = myFunction.addFunctionUrl(FunctionUrlOptions.builder()
- .authType(FunctionUrlAuthType.NONE)
- .build());
-
- // Define a CloudFormation output for your URL
- CfnOutput.Builder.create(this, "myFunctionUrlOutput")
- .value(myFunctionUrl.getUrl())
- .build();
- }
-}
-----
-
-C#::
-Located in `src/main/java/.../HelloCdkStack.java`:
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-// ...
-
-namespace HelloCdk
-{
- public class HelloCdkStack : Stack
- {
- internal HelloCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- // Define the Lambda function resource
- // ...
-
- // Define the Lambda function URL resource
- var myFunctionUrl = myFunction.AddFunctionUrl(new FunctionUrlOptions
- {
- AuthType = FunctionUrlAuthType.NONE
- });
-
- // Define a CloudFormation output for your URL
- new CfnOutput(this, "myFunctionUrlOutput", new CfnOutputProps
- {
- Value = myFunctionUrl.Url
- });
- }
- }
-}
-----
-
-Go::
-Located in `hello-cdk.go`:
-+
-[source,go,subs="verbatim,attributes"]
-----
-// ...
-
-func NewHelloCdkStack(scope constructs.Construct, id string, props *HelloCdkStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- // Define the Lambda function resource
- // ...
-
- // Define the Lambda function URL resource
- myFunctionUrl := myFunction.AddFunctionUrl(&awslambda.FunctionUrlOptions{
- AuthType: awslambda.FunctionUrlAuthType_NONE,
- })
-
- // Define a CloudFormation output for your URL
- awscdk.NewCfnOutput(stack, jsii.String("myFunctionUrlOutput"), &awscdk.CfnOutputProps{
- Value: myFunctionUrl.Url(),
- })
-
- return stack
-}
-
-// ...
-----
-====
-
-
-[WARNING]
-====
-
-To keep this tutorial simple, your Lambda function URL is defined without authentication. When deployed, this creates a publicly accessible endpoint that can be used to invoke your function. When you are done with this tutorial, follow xref:hello-world-delete[Step 12: Delete your application] to delete these resources.
-
-====
-
-[#hello-world-synth]
-== Step 8: Synthesize a CloudFormation template
-
-In this step, you prepare for deployment by synthesizing a CloudFormation template with the CDK CLI `cdk synth` command. This command performs basic validation of your CDK code, runs your CDK app, and generates a CloudFormation template from your CDK stack.
-
-If your app contains more than one stack, you must specify which stacks to synthesize. Since your app contains a single stack, the CDK CLI automatically detects the stack to synthesize.
-
-If you don't synthesize a template, the CDK CLI will automatically perform this step when you deploy. However, we recommend that you run this step before each deployment to check for synthesis errors.
-
-Before synthesizing a template, you can optionally build your application to catch syntax and type errors. For instructions, see xref:hello-world-build[Step 4: Build your CDK app].
-
-To synthesize a CloudFormation template, run the following from the root of your project:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk synth
-----
-
-[NOTE]
-====
-
-If you receive an error like the following, verify that you are in the `hello-cdk` directory and try again:
-
-----
---app is required either in command-line, in cdk.json or in ~/.cdk.json
-----
-
-====
-
-If successful, the CDK CLI will output a `YAML`–formatted CloudFormation template to `stdout` and save a `JSON`–formatted template in the `cdk.out` directory of your project.
-
-The following is an example output of the CloudFormation template:
-
-[#hello-world-synth-template]
-.{aws} CloudFormation template
-[%collapsible]
-====
-
-[source,yaml,subs="verbatim,attributes"]
-----
-Resources:
- HelloWorldFunctionServiceRole:
- Type: {aws}::IAM::Role
- Properties:
- AssumeRolePolicyDocument:
- Statement:
- - Action: sts:AssumeRole
- Effect: Allow
- Principal:
- Service: lambda.amazonaws.com
- Version: "2012-10-17"
- ManagedPolicyArns:
- - Fn::Join:
- - ""
- - - "arn:"
- - Ref: {aws}::Partition
- - :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
- Metadata:
- aws:cdk:path: HelloCdkStack/HelloWorldFunction/ServiceRole/Resource
- HelloWorldFunction:
- Type: {aws}::Lambda::Function
- Properties:
- Code:
- ZipFile: "
-
- \ exports.handler = async function(event) {
-
- \ return {
-
- \ statusCode: 200,
-
- \ body: JSON.stringify('Hello World!'),
-
- \ };
-
- \ };
-
- \ "
- Handler: index.handler
- Role:
- Fn::GetAtt:
- - HelloWorldFunctionServiceRole
- - Arn
- Runtime: nodejs20.x
- DependsOn:
- - HelloWorldFunctionServiceRole
- Metadata:
- aws:cdk:path: HelloCdkStack/HelloWorldFunction/Resource
- HelloWorldFunctionFunctionUrl:
- Type: {aws}::Lambda::Url
- Properties:
- AuthType: NONE
- TargetFunctionArn:
- Fn::GetAtt:
- - HelloWorldFunction
- - Arn
- Metadata:
- aws:cdk:path: HelloCdkStack/HelloWorldFunction/FunctionUrl/Resource
- HelloWorldFunctioninvokefunctionurl:
- Type: {aws}::Lambda::Permission
- Properties:
- Action: lambda:InvokeFunctionUrl
- FunctionName:
- Fn::GetAtt:
- - HelloWorldFunction
- - Arn
- FunctionUrlAuthType: NONE
- Principal: "*"
- Metadata:
- aws:cdk:path: HelloCdkStack/HelloWorldFunction/invoke-function-url
- CDKMetadata:
- Type: {aws}::CDK::Metadata
- Properties:
- Analytics: v2:deflate64:
- Metadata:
- aws:cdk:path: HelloCdkStack/CDKMetadata/Default
- Condition: CDKMetadataAvailable
-Outputs:
- myFunctionUrlOutput:
- Value:
- Fn::GetAtt:
- - HelloWorldFunctionFunctionUrl
- - FunctionUrl
-Parameters:
- BootstrapVersion:
- Type: {aws}::SSM::Parameter::Value
- Default: /cdk-bootstrap//version
- Description: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]
-Rules:
- CheckBootstrapVersion:
- Assertions:
- - Assert:
- Fn::Not:
- - Fn::Contains:
- - - "1"
- - "2"
- - "3"
- - "4"
- - "5"
- - Ref: BootstrapVersion
- AssertDescription: CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.
-----
-====
-
-[NOTE]
-====
-
-Every generated template contains an `{aws}::CDK::Metadata` resource by default. The {aws} CDK team uses this metadata to gain insight into {aws} CDK usage and find ways to improve it. For details, including how to opt out of version reporting, see xref:version-reporting[Version reporting].
-
-====
-
-By defining a single L2 construct, the {aws} CDK creates an extensive CloudFormation template containing your Lambda resources, along with the permissions and glue logic required for your resources to interact within your application.
-
-[#hello-world-deploy]
-== Step 9: Deploy your CDK stack
-
-In this step, you use the CDK CLI `cdk deploy` command to deploy your CDK stack. This command retrieves your generated CloudFormation template and deploys it through {aws} CloudFormation, which provisions your resources as part of a CloudFormation stack.
-
-From the root of your project, run the following. Confirm changes if prompted:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk deploy
-
-✨ Synthesis time: 2.69s
-
-HelloCdkStack: start: Building :current_account-current_region
-HelloCdkStack: success: Built :current_account-current_region
-HelloCdkStack: start: Publishing :current_account-current_region
-HelloCdkStack: success: Published :current_account-current_region
-This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
-Please confirm you intend to make the following modifications:
-
-IAM Statement Changes
-┌───┬───────────────────────────────────────┬────────┬──────────────────────────┬──────────────────────────────┬───────────┐
-│ │ Resource │ Effect │ Action │ Principal │ Condition │
-├───┼───────────────────────────────────────┼────────┼──────────────────────────┼──────────────────────────────┼───────────┤
-│ + │ ${HelloWorldFunction.Arn} │ Allow │ lambda:InvokeFunctionUrl │ * │ │
-├───┼───────────────────────────────────────┼────────┼──────────────────────────┼──────────────────────────────┼───────────┤
-│ + │ ${HelloWorldFunction/ServiceRole.Arn} │ Allow │ sts:AssumeRole │ Service:lambda.amazonaws.com │ │
-└───┴───────────────────────────────────────┴────────┴──────────────────────────┴──────────────────────────────┴───────────┘
-IAM Policy Changes
-┌───┬───────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────┐
-│ │ Resource │ Managed Policy ARN │
-├───┼───────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────┤
-│ + │ ${HelloWorldFunction/ServiceRole} │ arn:${{aws}::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole │
-└───┴───────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────┘
-(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)
-
-Do you wish to deploy these changes (y/n)? y
-----
-
-Similar to `cdk synth`, you don't have to specify the {aws} CDK stack since the app contains a single stack.
-
-During deployment, the CDK CLI displays progress information as your stack is deployed. When complete, you can go to the https://console.aws.amazon.com/cloudformation/home[{aws} CloudFormation console] to view your `HelloCdkStack` stack. You can also go to the Lambda console to view your `HelloWorldFunction` resource.
-
-When deployment completes, the CDK CLI will output your endpoint URL. Copy this URL for the next step. The following is an example:
-
-[source,none,subs="verbatim,attributes"]
-----
-...
-HelloCdkStack: deploying... [1/1]
-HelloCdkStack: creating CloudFormation changeset...
-
- ✅ HelloCdkStack
-
-✨ Deployment time: 41.65s
-
-Outputs:
-HelloCdkStack.myFunctionUrlOutput = https://.lambda-url..on.aws/
-Stack ARN:
-arn:aws:cloudformation::stack/HelloCdkStack/
-
-✨ Total time: 44.34s
-----
-
-[#hello-world-interact]
-== Step 10: Interact with your application on {aws}
-
-In this step, you interact with your application on {aws} by invoking your Lambda function through the function URL. When you access the URL, your Lambda function returns the `Hello World!` message.
-
-To invoke your function, access the function URL through your browser or from the command line. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ curl https://.lambda-url..on.aws/
-"Hello World!"%
-----
-
-[#hello-world-modify]
-== Step 11: Modify your application
-
-In this step, you modify the message that the Lambda function returns when invoked. You perform a diff using the CDK CLI `cdk diff` command to preview your changes and deploy to update your application. You then interact with your application on {aws} to see your new message.
-
-Modify the `myFunction` instance in your CDK stack file as follows:
-
-====
-[role="tablist"]
-TypeScript::
-Located in `lib/hello-cdk-stack.ts`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// ...
-
-export class HelloCdkStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // Modify the Lambda function resource
- const myFunction = new lambda.Function(this, "HelloWorldFunction", {
- runtime: lambda.Runtime.NODEJS_20_X, // Provide any supported Node.js runtime
- handler: "index.handler",
- code: lambda.Code.fromInline(`
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello CDK!'),
- };
- };
- `),
- });
-
- // ...
- }
-}
-----
-
-JavaScript::
-Located in `lib/hello-cdk-stack.js`:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// ...
-
-class HelloCdkStack extends Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // Modify the Lambda function resource
- const myFunction = new lambda.Function(this, "HelloWorldFunction", {
- runtime: lambda.Runtime.NODEJS_20_X, // Provide any supported Node.js runtime
- handler: "index.handler",
- code: lambda.Code.fromInline(`
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello CDK!'),
- };
- };
- `),
- });
-
- // ...
-
- }
-}
-
-module.exports = { HelloCdkStack }
-----
-
-Python::
-Located in `hello_cdk/hello_cdk_stack.py`:
-+
-[source,python,subs="verbatim,attributes"]
-----
-# ...
-
-class HelloCdkStack(Stack):
-
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- # Modify the Lambda function resource
- my_function = _lambda.Function(
- self, "HelloWorldFunction",
- runtime = _lambda.Runtime.NODEJS_20_X, # Provide any supported Node.js runtime
- handler = "index.handler",
- code = _lambda.Code.from_inline(
- """
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello CDK!'),
- };
- };
- """
- ),
- )
-
- # ...
-----
-
-Java::
-Located in `src/main/java/.../HelloCdkStack.java`:
-+
-[source,java,subs="verbatim,attributes"]
-----
-// ...
-
-public class HelloCdkStack extends Stack {
- public HelloCdkStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public HelloCdkStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- // Modify the Lambda function resource
- Function myFunction = Function.Builder.create(this, "HelloWorldFunction")
- .runtime(Runtime.NODEJS_20_X) // Provide any supported Node.js runtime
- .handler("index.handler")
- .code(Code.fromInline(
- "exports.handler = async function(event) {" +
- " return {" +
- " statusCode: 200," +
- " body: JSON.stringify('Hello CDK!')" +
- " };" +
- "};"))
- .build();
-
- // ...
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-// ...
-
-namespace HelloCdk
-{
- public class HelloCdkStack : Stack
- {
- internal HelloCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- // Modify the Lambda function resource
- var myFunction = new Function(this, "HelloWorldFunction", new FunctionProps
- {
- Runtime = Runtime.NODEJS_20_X, // Provide any supported Node.js runtime
- Handler = "index.handler",
- Code = Code.FromInline(@"
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello CDK!'),
- };
- };
- "),
- });
-
- // ...
- }
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-// ...
-
-type HelloCdkStackProps struct {
- awscdk.StackProps
-}
-
-func NewHelloCdkStack(scope constructs.Construct, id string, props *HelloCdkStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- // Modify the Lambda function resource
- myFunction := awslambda.NewFunction(stack, jsii.String("HelloWorldFunction"), &awslambda.FunctionProps{
- Runtime: awslambda.Runtime_NODEJS_20_X(), // Provide any supported Node.js runtime
- Handler: jsii.String("index.handler"),
- Code: awslambda.Code_FromInline(jsii.String(`
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello CDK!'),
- };
- };
- `)),
- })
-
-// ...
-
-}
-----
-====
-
-Currently, your code changes have not made any direct updates to your deployed Lambda resource. Your code defines the desired state of your resource. To modify your deployed resource, you will use the CDK CLI to synthesize the desired state into a new {aws} CloudFormation template. Then, you will deploy your new CloudFormation template as a change set. Change sets make only the necessary changes to reach your new desired state.
-
-To preview your changes, run the `cdk diff` command. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk diff
-Stack HelloCdkStack
-Hold on while we create a read-only change set to get a diff with accurate replacement information (use --no-change-set to use a less accurate but faster template-only diff)
-Resources
-[~] {aws}::Lambda::Function HelloWorldFunction HelloWorldFunction
- └─ [~] Code
- └─ [~] .ZipFile:
- ├─ [-]
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello World!'),
- };
- };
-
- └─ [+]
- exports.handler = async function(event) {
- return {
- statusCode: 200,
- body: JSON.stringify('Hello CDK!'),
- };
- };
-
-
-✨ Number of stacks with differences: 1
-----
-
-To create this diff, the CDK CLI queries your {aws} account account for the latest {aws} CloudFormation template for the `HelloCdkStack` stack. Then, it compares the latest template with the template it just synthesized from your app.
-
-To implement your changes, run the `cdk deploy` command. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk deploy
-
-✨ Synthesis time: 2.12s
-
-HelloCdkStack: start: Building :current_account-current_region
-HelloCdkStack: success: Built :current_account-current_region
-HelloCdkStack: start: Publishing :current_account-current_region
-HelloCdkStack: success: Published :current_account-current_region
-HelloCdkStack: deploying... [1/1]
-HelloCdkStack: creating CloudFormation changeset...
-
- ✅ HelloCdkStack
-
-✨ Deployment time: 26.96s
-
-Outputs:
-HelloCdkStack.myFunctionUrlOutput = https://.lambda-url..on.aws/
-Stack ARN:
-arn:aws:cloudformation::stack/HelloCdkStack/
-
-✨ Total time: 29.07s
-----
-
-To interact with your application, repeat xref:hello-world-interact[Step 10: Interact with your application on {aws}]. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ curl https://.lambda-url..on.aws/
-"Hello CDK!"%
-----
-
-[#hello-world-delete]
-== Step 12: Delete your application
-
-In this step, you use the CDK CLI `cdk destroy` command to delete your application. This command deletes the CloudFormation stack associated with your CDK stack, which includes the resources you created.
-
-To delete your application, run the `cdk destroy` command and confirm your request to delete the application. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk destroy
-Are you sure you want to delete: HelloCdkStack (y/n)? y
-HelloCdkStack: destroying... [1/1]
-
- ✅ HelloCdkStack: destroyed
-----
-
-[#hello-world-next-steps]
-== Next steps
-
-Congratulations! You've completed this tutorial and have used the {aws} CDK to successfully create, modify, and delete resources in the {aws} Cloud. You're now ready to begin using the {aws} CDK.
-
-To learn more about using the {aws} CDK in your preferred programming language, see xref:work-with[Work with the {aws} CDK library].
-
-For additional resources, see the following:
-
-* Try the https://cdkworkshop.com/[CDK Workshop] for a more in-depth tour involving a more complex project.
-* See the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html[API reference] to begin exploring the CDK constructs available for your favorite {aws} services.
-* Visit https://constructs.dev/search?q=&cdk=aws-cdk&cdkver=2&sort=downloadsDesc&offset=0[Construct Hub] to discover constructs created by {aws} and others.
-* Explore https://github.com/aws-samples/aws-cdk-examples[Examples] of using the {aws} CDK.
-
-The {aws} CDK is an open-source project. To contribute, see to https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md[Contributing to the {aws} Cloud Development Kit ({aws} CDK)].
\ No newline at end of file
diff --git a/v2/guide/home.adoc b/v2/guide/home.adoc
deleted file mode 100644
index baf8a28f..00000000
--- a/v2/guide/home.adoc
+++ /dev/null
@@ -1,338 +0,0 @@
-include::attributes.txt[]
-
-// Page attributes
-[.topic]
-[#home]
-= What is the {aws} CDK?
-:info_titleabbrev: What is the {aws} CDK?
-:keywords: {aws} CDK, Developer tool, {aws}, Infrastructure as code, IaC, constructs, {aws} CloudFormation, serverless, modern applications
-
-[abstract]
---
-The {aws} Cloud Development Kit ({aws} CDK) is an open-source software development framework for defining cloud infrastructure in code and provisioning it through {aws} CloudFormation.
---
-
-// Content start
-
-The {aws} Cloud Development Kit ({aws} CDK) is an open-source software development framework for defining cloud infrastructure in code and provisioning it through {aws} CloudFormation.
-
-The {aws} CDK consists of two primary parts:
-
-* *xref:constructs[{aws} CDK Construct Library]* – A collection of pre-written modular and reusable pieces of code, called constructs, that you can use, modify, and integrate to develop your infrastructure quickly. The goal of the {aws} CDK Construct Library is to reduce the complexity required to define and integrate {aws} services together when building applications on {aws}.
-
-* *xref:cli[{aws} CDK Command Line Interface ({aws} CDK CLI)]* – A command line tool for interacting with CDK apps. Use the CDK CLI to create, manage, and deploy your {aws} CDK projects. The CDK CLI is also referred to as the CDK Toolkit.
-
-The {aws} CDK supports TypeScript, JavaScript, Python, Java, C#/.Net, and [.noloc]`Go`. You can use any of these supported programming languages to define reusable cloud components known as xref:constructs[constructs]. You compose these together into xref:stacks[stacks] and xref:apps[apps]. Then, you deploy your CDK applications to {aws} CloudFormation to provision or update your resources.
-
-image::./images/AppStacks.png["CDK app and process overview"]
-
-[#home-benefits]
-== Benefits of the {aws} CDK
-
-Use the {aws} CDK to develop reliable, scalable, cost-effective applications in the cloud with the considerable expressive power of a programming language. This approach yields many benefits, including:
-
-[#home-benefits-iac]
-*Develop and manage your infrastructure as code (IaC)*::
-Practice _infrastructure as code_ to create, deploy, and maintain infrastructure in a programmatic, descriptive, and declarative way. With IaC, you treat infrastructure the same way developers treat code. This results in a scalable and structured approach to managing infrastructure. To learn more about IaC, see https://docs.aws.amazon.com/whitepapers/latest/introduction-devops-aws/infrastructure-as-code.html[Infrastructure as code] in the _Introduction to DevOps on {aws} Whitepaper_.
-+
-With the {aws} CDK, you can put your infrastructure, application code, and configuration all in one place, ensuring that you have a complete, cloud-deployable system at every milestone. Employ software engineering best practices such as code reviews, unit tests, and source control to make your infrastructure more robust.
-
-[#home-benefits-languages]
-*Define your cloud infrastructure using general-purpose programming languages*::
-With the {aws} CDK, you can use any of the following programming languages to define your cloud infrastructure: TypeScript, JavaScript, Python, Java, C#/.Net, and [.noloc]`Go`. Choose your preferred language and use programming elements like parameters, conditionals, loops, composition, and inheritance to define the desired outcome of your infrastructure.
-+
-Use the same programming language to define your infrastructure and your application logic.
-+
-Receive the benefits of developing infrastructure in your preferred IDE (Integrated Development Environment), such as syntax highlighting and intelligent code completion.
-+
-image::./images/CodeCompletion.png[Code snippet showing CDK setup for ECS cluster with VPC and Fargate service configuration.,scaledwidth=100%]
-
-[#home-benefits-cfn]
-*Deploy infrastructure through {aws} CloudFormation*::
-{aws} CDK integrates with {aws} CloudFormation to deploy and provision your infrastructure on {aws}. {aws} CloudFormation is a managed {aws} service that offers extensive support of resource and property configurations for provisioning services on {aws}. With {aws} CloudFormation, you can perform infrastructure deployments predictably and repeatedly, with rollback on error. If you are already familiar with {aws} CloudFormation, you don't have to learn a new IaC management service when getting started with the {aws} CDK.
-
-[#home-benefits-constructs]
-*Get started developing your application quickly with constructs*::
-Develop faster by using and sharing reusable components called constructs. Use low-level constructs to define individual {aws} CloudFormation resources and their properties. Use high-level constructs to quickly define larger components of your application, with sensible, secure defaults for your {aws} resources, defining more infrastructure with less code.
-+
-Create your own constructs that are customized for your unique use cases and share them across your organization or even with the public.
-
-[#home-example]
-== Example of the {aws} CDK
-
-The following is an example of using the {aws} CDK Constructs Library to create an Amazon Elastic Container Service (Amazon ECS) service with {aws} Fargate launch type. For more details of this example, see xref:ecs-example[Example: Create an {aws} Fargate service using the {aws} CDK].
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-export class MyEcsConstructStack extends Stack {
- constructor(scope: App, id: string, props?: StackProps) {
- super(scope, id, props);
-
- const vpc = new ec2.Vpc(this, "MyVpc", {
- maxAzs: 3 // Default is all AZs in region
- });
-
- const cluster = new ecs.Cluster(this, "MyCluster", {
- vpc: vpc
- });
-
- // Create a load-balanced Fargate service and make it public
- new ecs_patterns.ApplicationLoadBalancedFargateService(this, "MyFargateService", {
- cluster: cluster, // Required
- cpu: 512, // Default is 256
- desiredCount: 6, // Default is 1
- taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample") },
- memoryLimitMiB: 2048, // Default is 512
- publicLoadBalancer: true // Default is false
- });
- }
-}
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-class MyEcsConstructStack extends Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- const vpc = new ec2.Vpc(this, "MyVpc", {
- maxAzs: 3 // Default is all AZs in region
- });
-
- const cluster = new ecs.Cluster(this, "MyCluster", {
- vpc: vpc
- });
-
- // Create a load-balanced Fargate service and make it public
- new ecs_patterns.ApplicationLoadBalancedFargateService(this, "MyFargateService", {
- cluster: cluster, // Required
- cpu: 512, // Default is 256
- desiredCount: 6, // Default is 1
- taskImageOptions: { image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample") },
- memoryLimitMiB: 2048, // Default is 512
- publicLoadBalancer: true // Default is false
- });
- }
-}
-
-module.exports = { MyEcsConstructStack }
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-class MyEcsConstructStack(Stack):
-
- def __init__(self, scope: Construct, id: str, **kwargs) -> None:
- super().__init__(scope, id, **kwargs)
-
- vpc = ec2.Vpc(self, "MyVpc", max_azs=3) # default is all AZs in region
-
- cluster = ecs.Cluster(self, "MyCluster", vpc=vpc)
-
- ecs_patterns.ApplicationLoadBalancedFargateService(self, "MyFargateService",
- cluster=cluster, # Required
- cpu=512, # Default is 256
- desired_count=6, # Default is 1
- task_image_options=ecs_patterns.ApplicationLoadBalancedTaskImageOptions(
- image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample")),
- memory_limit_mib=2048, # Default is 512
- public_load_balancer=True) # Default is False
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-public class MyEcsConstructStack extends Stack {
-
- public MyEcsConstructStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyEcsConstructStack(final Construct scope, final String id,
- StackProps props) {
- super(scope, id, props);
-
- Vpc vpc = Vpc.Builder.create(this, "MyVpc").maxAzs(3).build();
-
- Cluster cluster = Cluster.Builder.create(this, "MyCluster")
- .vpc(vpc).build();
-
- ApplicationLoadBalancedFargateService.Builder.create(this, "MyFargateService")
- .cluster(cluster)
- .cpu(512)
- .desiredCount(6)
- .taskImageOptions(
- ApplicationLoadBalancedTaskImageOptions.builder()
- .image(ContainerImage
- .fromRegistry("amazon/amazon-ecs-sample"))
- .build()).memoryLimitMiB(2048)
- .publicLoadBalancer(true).build();
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-public class MyEcsConstructStack : Stack
-{
- public MyEcsConstructStack(Construct scope, string id, IStackProps props=null) : base(scope, id, props)
- {
- var vpc = new Vpc(this, "MyVpc", new VpcProps
- {
- MaxAzs = 3
- });
-
- var cluster = new Cluster(this, "MyCluster", new ClusterProps
- {
- Vpc = vpc
- });
-
- new ApplicationLoadBalancedFargateService(this, "MyFargateService",
- new ApplicationLoadBalancedFargateServiceProps
- {
- Cluster = cluster,
- Cpu = 512,
- DesiredCount = 6,
- TaskImageOptions = new ApplicationLoadBalancedTaskImageOptions
- {
- Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
- },
- MemoryLimitMiB = 2048,
- PublicLoadBalancer = true,
- });
- }
-}
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-func NewMyEcsConstructStack(scope constructs.Construct, id string, props *MyEcsConstructStackProps) awscdk.Stack {
-
- var sprops awscdk.StackProps
-
- if props != nil {
- sprops = props.StackProps
- }
-
- stack := awscdk.NewStack(scope, &id, &sprops)
-
- vpc := awsec2.NewVpc(stack, jsii.String("MyVpc"), &awsec2.VpcProps{
- MaxAzs: jsii.Number(3), // Default is all AZs in region
- })
-
- cluster := awsecs.NewCluster(stack, jsii.String("MyCluster"), &awsecs.ClusterProps{
- Vpc: vpc,
- })
-
- awsecspatterns.NewApplicationLoadBalancedFargateService(stack, jsii.String("MyFargateService"),
- &awsecspatterns.ApplicationLoadBalancedFargateServiceProps{
- Cluster: cluster, // required
- Cpu: jsii.Number(512), // default is 256
- DesiredCount: jsii.Number(5), // default is 1
- MemoryLimitMiB: jsii.Number(2048), // Default is 512
- TaskImageOptions: &awsecspatterns.ApplicationLoadBalancedTaskImageOptions{
- Image: awsecs.ContainerImage_FromRegistry(jsii.String("amazon/amazon-ecs-sample"), nil),
- },
- PublicLoadBalancer: jsii.Bool(true), // Default is false
- })
-
- return stack
-
-}
-----
-====
-
-This class produces an {aws} CloudFormation link:https://github.com/awsdocs/aws-cdk-guide/blob/main/doc_source/my_ecs_construct-stack.yaml[template of more than 500 lines]. Deploying the {aws} CDK app produces more than 50 resources of the following types:
-
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html[`{aws}::EC2::EIP`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html[`{aws}::EC2::InternetGateway`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html[`{aws}::EC2::NatGateway`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html[`{aws}::EC2::Route`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-routetable.html[`{aws}::EC2::RouteTable`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html[`{aws}::EC2::SecurityGroup`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html[`{aws}::EC2::Subnet`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html[`{aws}::EC2::SubnetRouteTableAssociation`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html[`{aws}::EC2::VPCGatewayAttachment`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html[`{aws}::EC2::VPC`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html[`{aws}::ECS::Cluster`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html[`{aws}::ECS::Service`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html[`{aws}::ECS::TaskDefinition`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listener.html[`{aws}::ElasticLoadBalancingV2::Listener`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html[`{aws}::ElasticLoadBalancingV2::LoadBalancer`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html[`{aws}::ElasticLoadBalancingV2::TargetGroup`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html[`{aws}::IAM::Policy`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html[`{aws}::IAM::Role`]
-* link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html[`{aws}::Logs::LogGroup`]
-
-[#home-features]
-== {aws} CDK features
-
-[#home-features-repo]
-=== The {aws} CDK [.noloc]`GitHub` repository
-
-For the official {aws} CDK [.noloc]`GitHub` repository, see link:https://github.com/aws/aws-cdk[aws-cdk]. Here, you can submit link:https://github.com/aws/aws-cdk/issues[issues], view our link:https://github.com/aws/aws-cdk/blob/main/LICENSE[license], track link:https://github.com/aws/aws-cdk/releases[releases], and more.
-
-Because the {aws} CDK is open-source, the team encourages you to contribute to make it an even better tool. For details, see link:https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md[Contributing to the {aws} Cloud Development Kit ({aws} CDK)].
-
-[#home-features-api]
-=== The {aws} CDK API reference
-
-The {aws} CDK Construct Library provides APIs to define your CDK application and add CDK constructs to the application. For more information, see the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html[{aws} CDK API Reference].
-
-[#home-features-cpm]
-=== The Construct Programming Model
-
-The Construct Programming Model (CPM) extends the concepts behind the {aws} CDK into additional domains. Other tools using the CPM include:
-
-* link:https://www.terraform.io/docs/cdktf/index.html[CDK for Terraform] (CDKtf)
-* link:https://cdk8s.io/[CDK for Kubernetes] (CDK8s)
-* link:https://github.com/projen/projen[Projen], for building project configurations
-
-[#home-features-hub]
-=== The Construct Hub
-
-The link:https://constructs.dev/[Construct Hub] is an online registry where you can find, publish, and share open-source {aws} CDK libraries.
-
-[#home-next]
-== Next steps
-
-To get started with using the {aws} CDK, see xref:getting-started[Getting started with the {aws} CDK].
-
-[#home-learn]
-== Learn more
-
-To continue learning about the {aws} CDK, see the following:
-
-* *xref:core-concepts[Learn {aws} CDK core concepts]* – Important concepts and terms for the {aws} CDK.
-* *link:https://cdkworkshop.com/[{aws} CDK Workshop]* – Hands-on workshop to learn and use the {aws} CDK.
-* *link:https://cdkpatterns.com/[{aws} CDK Patterns]* – Open-source collection of {aws} serverless architecture patterns, built for the {aws} CDK by {aws} experts.
-* *link:https://github.com/aws-samples/aws-cdk-examples[{aws} CDK code examples]* – [.noloc]`GitHub` repository of example {aws} CDK projects.
-* *link:https://cdk.dev/[cdk.dev]* – Community-driven hub for the {aws} CDK, including a community [.noloc]`Slack` workspace.
-* *link:https://github.com/kalaiser/awesome-cdk[Awesome CDK]* – [.noloc]`GitHub` repository containing a curated list of {aws} CDK open-source projects, guides, blogs, and other resources.
-* *link:https://aws.amazon.com/solutions/constructs/[{aws} Solutions Constructs]* – Vetted, configuration infrastructure as code (IaC) patterns that can easily be assembled into production-ready applications.
-* *link:https://aws.amazon.com/blogs/developer/category/developer-tools/aws-cloud-development-kit/[{aws} Developer Tools Blog]* – Blog posts filtered for the {aws} CDK.
-* *link:https://stackoverflow.com/questions/tagged/aws-cdk[{aws} CDK on Stack Overflow]* – Questions tagged with *aws-cdk* on [.noloc]`Stack Overflow`.
-* *link:https://docs.aws.amazon.com/cloud9/latest/user-guide/sample-cdk.html[{aws} CDK tutorial for {aws} Cloud9]* – Tutorial on using the {aws} CDK with the {aws} Cloud9 development environment.
-
-To learn more about related topics to the {aws} CDK, see the following:
-
-* *link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-whatis-concepts.html[{aws} CloudFormation concepts]* – Since the {aws} CDK is built to work with {aws} CloudFormation, we recommend that you learn and understand key {aws} CloudFormation concepts.
-* *link:https://docs.aws.amazon.com/general/latest/gr/glos-chap.html[{aws} Glossary]* – Definitions of key terms used across {aws}.
-
-To learn more about tools related to the {aws} CDK that can be used to simplify serverless application development and deployment, see the following:
-
-* *link:https://aws.amazon.com/serverless/sam/[{aws} Serverless Application Model]* – An open-source developer tool that simplifies and improves the experience of building and running serverless applications on {aws}.
-* *link:https://github.com/aws/chalice[{aws} Chalice]* – A framework for writing serverless apps in Python.
\ No newline at end of file
diff --git a/v2/guide/how-tos.adoc b/v2/guide/how-tos.adoc
deleted file mode 100644
index 4c9a17e2..00000000
--- a/v2/guide/how-tos.adoc
+++ /dev/null
@@ -1,37 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#how-tos]
-= {aws} CDK tutorials and examples
-:info_titleabbrev: Tutorials and examples
-:keywords: {aws} CDK, {aws} Cloud Development Kit ({aws} CDK), IaC, Infrastructure as Code, serverless, serverless application, Lambda, API Gateway
-
-[abstract]
---
-This section contains tutorials and examples for the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-
-This section contains tutorials and examples for the {aws} Cloud Development Kit ({aws} CDK).
-
-[#tutorials]
-*Tutorials*::
-Tutorials provide you with step-by-step instructions that you can follow to implement a task using the {aws} CDK.
-
-[#examples]
-*Examples*::
-Examples show and explain how specific tasks can be implemented using the {aws} CDK. They do not provide direct step-by-step instructions for you to follow.
-+
-For more examples of {aws} CDK stacks and apps in your favorite supported programming language, see the https://github.com/aws-samples/aws-cdk-examples[{aws} CDK Examples] repository on GitHub.
-
-
-include::serverless_example.adoc[leveloffset=+1]
-
-
-include::create-multiple-stacks.adoc[leveloffset=+1]
-
-
-include::ecs_example.adoc[leveloffset=+1]
diff --git a/v2/guide/identifiers.adoc b/v2/guide/identifiers.adoc
deleted file mode 100644
index 0befe594..00000000
--- a/v2/guide/identifiers.adoc
+++ /dev/null
@@ -1,309 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Identifiers
-:keywords: {aws} CDK, Identifiers
-
-[#identifiers]
-= Identifiers and the {aws} CDK
-
-[abstract]
---
-When building {aws} Cloud Development Kit ({aws} CDK) apps, you will use many types of identifiers and names. To use the {aws} CDK effectively and avoid errors, it is important to understand the types of identifiers.
---
-
-// Content start
-
-When building {aws} Cloud Development Kit ({aws} CDK) apps, you will use many types of identifiers and names. To use the {aws} CDK effectively and avoid errors, it is important to understand the types of identifiers.
-
-Identifiers must be unique within the scope in which they are created; they do not need to be globally unique in your {aws} CDK application.
-
-If you attempt to create an identifier with the same value within the same scope, the {aws} CDK throws an exception.
-
-[#identifiers-construct-ids]
-== Construct IDs
-
-The most common identifier, `id`, is the identifier passed as the second argument when instantiating a construct object. This identifier, like all identifiers, only needs to be unique within the scope in which it is created, which is the first argument when instantiating a construct object.
-
-[NOTE]
-====
-
-The `id` of a stack is also the identifier that you use to refer to it in the xref:cli[{aws} CDK CLI reference].
-
-====
-
-Let's look at an example where we have two constructs with the identifier `MyBucket` in our app. The first is defined in the scope of the stack with the identifier `Stack1`. The second is defined in the scope of a stack with the identifier `Stack2`. Because they're defined in different scopes, this doesn't cause any conflict, and they can coexist in the same app without issues.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import { App, Stack, StackProps } from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-import * as s3 from 'aws-cdk-lib/aws-s3';
-
-class MyStack extends Stack {
- constructor(scope: Construct, id: string, props: StackProps = {}) {
- super(scope, id, props);
-
- new s3.Bucket(this, 'MyBucket');
- }
-}
-
-const app = new App();
-new MyStack(app, 'Stack1');
-new MyStack(app, 'Stack2');
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { App , Stack } = require('aws-cdk-lib');
-const s3 = require('aws-cdk-lib/aws-s3');
-
-class MyStack extends Stack {
- constructor(scope, id, props = {}) {
- super(scope, id, props);
-
- new s3.Bucket(this, 'MyBucket');
- }
-}
-
-const app = new App();
-new MyStack(app, 'Stack1');
-new MyStack(app, 'Stack2');
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import App, Construct, Stack, StackProps
-from constructs import Construct
-from aws_cdk import aws_s3 as s3
-
-class MyStack(Stack):
-
- def __init__(self, scope: Construct, id: str, **kwargs):
-
- super().__init__(scope, id, **kwargs)
- s3.Bucket(self, "MyBucket")
-
-app = App()
-MyStack(app, 'Stack1')
-MyStack(app, 'Stack2')
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// MyStack.java
-package com.myorg;
-
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-import software.constructs.Construct;
-import software.amazon.awscdk.services.s3.Bucket;
-
-public class MyStack extends Stack {
- public MyStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
- new Bucket(this, "MyBucket");
- }
-}
-
-// Main.java
-package com.myorg;
-
-import software.amazon.awscdk.App;
-
-public class Main {
- public static void main(String[] args) {
- App app = new App();
- new MyStack(app, "Stack1");
- new MyStack(app, "Stack2");
- }
-}
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using constructs;
-using Amazon.CDK.{aws}.S3;
-
-public class MyStack : Stack
-{
- public MyStack(Construct scope, string id, IStackProps props) : base(scope, id, props)
- {
- new Bucket(this, "MyBucket");
- }
-}
-
-class Program
-{
- static void Main(string[] args)
- {
- var app = new App();
- new MyStack(app, "Stack1");
- new MyStack(app, "Stack2");
- }
-}
-----
-====
-
-[#identifiers-paths]
-== Paths
-
-The constructs in an {aws} CDK application form a hierarchy rooted in the `App` class. We refer to the collection of IDs from a given construct, its parent construct, its grandparent, and so on to the root of the construct tree, as a _path_.
-
-The {aws} CDK typically displays paths in your templates as a string. The IDs from the levels are separated by slashes, starting at the node immediately under the root `App` instance, which is usually a stack. For example, the paths of the two Amazon S3 bucket resources in the previous code example are `Stack1/MyBucket` and `Stack2/MyBucket`.
-
-You can access the path of any construct programmatically, as shown in the following example. This gets the path of `myConstruct` (or `my_construct`, as Python developers would write it). Since IDs must be unique within the scope they are created, their paths are always unique within an {aws} CDK application.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const path: string = myConstruct.node.path;
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const path = myConstruct.node.path;
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-path = my_construct.node.path
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-String path = myConstruct.getNode().getPath();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-string path = myConstruct.Node.Path;
-----
-====
-
-[#identifiers-unique-ids]
-== Unique IDs
-
-{aws} CloudFormation requires that all logical IDs in a template be unique. Because of this, the {aws} CDK must be able to generate a unique identifier for each construct in an application. Resources have paths that are globally unique (the names of all scopes from the stack to a specific resource). Therefore, the {aws} CDK generates the necessary unique identifiers by concatenating the elements of the path and adding an 8-digit hash. (The hash is necessary to distinguish distinct paths, such as `A/B/C` and `A/BC`, that would result in the same {aws} CloudFormation identifier. {aws} CloudFormation identifiers are alphanumeric and cannot contain slashes or other separator characters.) The {aws} CDK calls this string the _unique ID_ of the construct.
-
-In general, your {aws} CDK app should not need to know about unique IDs. You can, however, access the unique ID of any construct programmatically, as shown in the following example.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const uid: string = Names.uniqueId(myConstruct);
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const uid = Names.uniqueId(myConstruct);
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-uid = Names.unique_id(my_construct)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-String uid = Names.uniqueId(myConstruct);
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-string uid = Names.Uniqueid(myConstruct);
-----
-====
-
-The _address_ is another kind of unique identifier that uniquely distinguishes CDK resources. Derived from the SHA-1 hash of the path, it is not human-readable. However, its constant, relatively short length (always 42 hexadecimal characters) makes it useful in situations where the "traditional" unique ID might be too long. Some constructs may use the address in the synthesized {aws} CloudFormation template instead of the unique ID. Again, your app generally should not need to know about its constructs' addresses, but you can retrieve a construct's address as follows.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const addr: string = myConstruct.node.addr;
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const addr = myConstruct.node.addr;
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-addr = my_construct.node.addr
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-String addr = myConstruct.getNode().getAddr();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-string addr = myConstruct.Node.Addr;
-----
-====
-
-[#identifiers-logical-ids]
-== Logical IDs
-
-Unique IDs serve as the _logical identifiers_ (or __logical names__) of resources in the generated {aws} CloudFormation templates for constructs that represent {aws} resources.
-
-For example, the Amazon S3 bucket in the previous example that is created within `Stack2` results in an `{aws}::S3::Bucket` resource. The resource's logical ID is `Stack2MyBucket4DD88B4F` in the resulting {aws} CloudFormation template. (For details on how this identifier is generated, see xref:identifiers-unique-ids[Unique IDs].)
-
-[#identifiers-logical-id-stability]
-=== Logical ID stability
-
-Avoid changing the logical ID of a resource after it has been created. {aws} CloudFormation identifies resources by their logical ID. Therefore, if you change the logical ID of a resource, {aws} CloudFormation creates a new resource with the new logical ID, then deletes the existing one. Depending on the type of resource, this might cause service interruption, data loss, or both.
\ No newline at end of file
diff --git a/v2/guide/images/AppStacks.png b/v2/guide/images/AppStacks.png
deleted file mode 100644
index 094c61db..00000000
Binary files a/v2/guide/images/AppStacks.png and /dev/null differ
diff --git a/v2/guide/images/CliCredentialsStackSynthesizer-deploy-process_cdk_flowchart.png b/v2/guide/images/CliCredentialsStackSynthesizer-deploy-process_cdk_flowchart.png
deleted file mode 100644
index 69866507..00000000
Binary files a/v2/guide/images/CliCredentialsStackSynthesizer-deploy-process_cdk_flowchart.png and /dev/null differ
diff --git a/v2/guide/images/CliCredentialsStackSynthesizer-deploy-process_cdk_flowchart.svg b/v2/guide/images/CliCredentialsStackSynthesizer-deploy-process_cdk_flowchart.svg
deleted file mode 100644
index 36874724..00000000
--- a/v2/guide/images/CliCredentialsStackSynthesizer-deploy-process_cdk_flowchart.svg
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/v2/guide/images/CodeCompletion.png b/v2/guide/images/CodeCompletion.png
deleted file mode 100644
index 2006baec..00000000
Binary files a/v2/guide/images/CodeCompletion.png and /dev/null differ
diff --git a/v2/guide/images/CustomizeSynth.png b/v2/guide/images/CustomizeSynth.png
deleted file mode 100644
index 69866507..00000000
Binary files a/v2/guide/images/CustomizeSynth.png and /dev/null differ
diff --git a/v2/guide/images/activate-cfn-extension.png b/v2/guide/images/activate-cfn-extension.png
deleted file mode 100644
index 04d01e4a..00000000
Binary files a/v2/guide/images/activate-cfn-extension.png and /dev/null differ
diff --git a/v2/guide/images/all-in-one.jpg b/v2/guide/images/all-in-one.jpg
deleted file mode 100644
index e7011806..00000000
Binary files a/v2/guide/images/all-in-one.jpg and /dev/null differ
diff --git a/v2/guide/images/app-lifecycle_cdk-flowchart.png b/v2/guide/images/app-lifecycle_cdk-flowchart.png
deleted file mode 100644
index b1e07e36..00000000
Binary files a/v2/guide/images/app-lifecycle_cdk-flowchart.png and /dev/null differ
diff --git a/v2/guide/images/app-lifecycle_cdk-flowchart.svg b/v2/guide/images/app-lifecycle_cdk-flowchart.svg
deleted file mode 100644
index 4f8e22a2..00000000
--- a/v2/guide/images/app-lifecycle_cdk-flowchart.svg
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/v2/guide/images/aws_cover.jpg b/v2/guide/images/aws_cover.jpg
deleted file mode 100644
index 42956877..00000000
Binary files a/v2/guide/images/aws_cover.jpg and /dev/null differ
diff --git a/v2/guide/images/best-practice-deploy-to-multiple-accounts.png b/v2/guide/images/best-practice-deploy-to-multiple-accounts.png
deleted file mode 100644
index a41e4018..00000000
Binary files a/v2/guide/images/best-practice-deploy-to-multiple-accounts.png and /dev/null differ
diff --git a/v2/guide/images/code-organization.jpg b/v2/guide/images/code-organization.jpg
deleted file mode 100644
index eaf846b6..00000000
Binary files a/v2/guide/images/code-organization.jpg and /dev/null differ
diff --git a/v2/guide/images/default-deploy-process_cdk_flowchart.png b/v2/guide/images/default-deploy-process_cdk_flowchart.png
deleted file mode 100644
index a6df0d61..00000000
Binary files a/v2/guide/images/default-deploy-process_cdk_flowchart.png and /dev/null differ
diff --git a/v2/guide/images/default-deploy-process_cdk_flowchart.svg b/v2/guide/images/default-deploy-process_cdk_flowchart.svg
deleted file mode 100644
index b1aea874..00000000
--- a/v2/guide/images/default-deploy-process_cdk_flowchart.svg
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/v2/guide/images/serverless-example-01.png b/v2/guide/images/serverless-example-01.png
deleted file mode 100644
index 07758545..00000000
Binary files a/v2/guide/images/serverless-example-01.png and /dev/null differ
diff --git a/v2/guide/images/visual-studio-nuget.png b/v2/guide/images/visual-studio-nuget.png
deleted file mode 100644
index 00db5a25..00000000
Binary files a/v2/guide/images/visual-studio-nuget.png and /dev/null differ
diff --git a/v2/guide/infrastructure-security.adoc b/v2/guide/infrastructure-security.adoc
deleted file mode 100644
index 0d95e4a0..00000000
--- a/v2/guide/infrastructure-security.adoc
+++ /dev/null
@@ -1,15 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#infrastructure-security]
-= Infrastructure security for the {aws} Cloud Development Kit ({aws} CDK)
-:info_titleabbrev: Infrastructure security
-
-[abstract]
---
-Provides information about infrastructure security for the {aws} CDK.
---
-
-The {aws} CDK follows the link:https://aws.amazon.com/compliance/shared-responsibility-model/[shared responsibility model] through the specific Amazon Web Services ({aws}) services it supports. For {aws} service security information, see the link:https://docs.aws.amazon.com/security/?id=docs_gateway#aws-security[{aws} service security documentation page] and https://aws.amazon.com/compliance/services-in-scope/[{aws} services that are in scope of {aws} compliance efforts by compliance program].
\ No newline at end of file
diff --git a/v2/guide/languages.adoc b/v2/guide/languages.adoc
deleted file mode 100644
index a7ccd65b..00000000
--- a/v2/guide/languages.adoc
+++ /dev/null
@@ -1,121 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Programming languages
-:keywords: {aws} CDK, TypeScript, JavaScript, Python, Java, C#, Go
-
-[#languages]
-= Supported programming languages for the {aws} CDK
-
-[abstract]
---
-The {aws} Cloud Development Kit ({aws} CDK) has first-class support for the TypeScript, JavaScript, Python, Java, C#, and [.noloc]``Go`` general-purpose programming languages.
---
-
-// Content start
-
-The {aws} Cloud Development Kit ({aws} CDK) has first-class support for the following general-purpose programming languages:
-
-* TypeScript
-* JavaScript
-* Python
-* Java
-* C#
-* [.noloc]`Go`
-
-Other [.noloc]`JVM` and [.noloc]`.NET` [.noloc]`CLR` languages may also be used in theory, but we do not offer official support at this time.
-
-The {aws} CDK is developed in one language, TypeScript. To support the other languages, the {aws} CDK utilizes a tool called https://github.com/aws/jsii[JSII] to generate language bindings.
-
-We attempt to offer each language's usual conventions to make development with the {aws} CDK as natural and intuitive as possible. For example, we distribute {aws} Construct Library modules using your preferred language's standard repository, and you install them using the language's standard package manager. Methods and properties are also named using your language's recommended naming patterns.
-
-The following are a few code examples:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new s3.Bucket(this, 'amzn-s3-demo-bucket', {
- bucketName: 'amzn-s3-demo-bucket',
- versioned: true,
- websiteRedirect: {hostName: 'aws.amazon.com'}});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const bucket = new s3.Bucket(this, 'amzn-s3-demo-bucket', {
- bucketName: 'amzn-s3-demo-bucket',
- versioned: true,
- websiteRedirect: {hostName: 'aws.amazon.com'}});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-bucket = s3.Bucket("amzn-s3-demo-bucket", bucket_name="amzn-s3-demo-bucket", versioned=True,
- website_redirect=s3.RedirectTarget(host_name="aws.amazon.com"))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-Bucket bucket = Bucket.Builder.create(self, "amzn-s3-demo-bucket")
- .bucketName("amzn-s3-demo-bucket")
- .versioned(true)
- .websiteRedirect(new RedirectTarget.Builder()
- .hostName("aws.amazon.com").build())
- .build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var bucket = new Bucket(this, "amzn-s3-demo-bucket", new BucketProps {
- BucketName = "amzn-s3-demo-bucket",
- Versioned = true,
- WebsiteRedirect = new RedirectTarget {
- HostName = "aws.amazon.com"
- }});
-----
-
-Go::
-+
-[source,go,subs="verbatim,attributes"]
-----
-bucket := awss3.NewBucket(scope, jsii.String("amzn-s3-demo-bucket"), &awss3.BucketProps {
- BucketName: jsii.String("amzn-s3-demo-bucket"),
- Versioned: jsii.Bool(true),
- WebsiteRedirect: &awss3.RedirectTarget {
- HostName: jsii.String("aws.amazon.com"),
- },
-})
-----
-====
-
-[NOTE]
-====
-
-These code snippets are intended for illustration only. They are incomplete and won't run as they are.
-
-====
-
-The {aws} Construct Library is distributed using each language's standard package management tools, including [.noloc]`NPM`, [.noloc]`PyPi`, [.noloc]`Maven`, and [.noloc]`NuGet`. We also provide a version of the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html[{aws} CDK API Reference] for each language.
-
-To help you use the {aws} CDK in your preferred language, this guide includes the following topics for supported languages:
-
-* xref:work-with-cdk-typescript[Working with the {aws} CDK in TypeScript]
-* xref:work-with-cdk-javascript[Working with the {aws} CDK in JavaScript]
-* xref:work-with-cdk-python[Working with the {aws} CDK in Python]
-* xref:work-with-cdk-java[Working with the {aws} CDK in Java]
-* xref:work-with-cdk-csharp[Working with the {aws} CDK in C#]
-* xref:work-with-cdk-go[Working with the {aws} CDK in Go]
-
-TypeScript was the first language supported by the {aws} CDK, and much of the {aws} CDK example code is written in TypeScript. This guide includes a topic specifically to show how to adapt TypeScript {aws} CDK code for use with the other supported languages. For more information, see xref:work-with-cdk-compare[Comparing {aws} CDK in TypeScript with other languages].
\ No newline at end of file
diff --git a/v2/guide/libraries.adoc b/v2/guide/libraries.adoc
deleted file mode 100644
index cf4ee63c..00000000
--- a/v2/guide/libraries.adoc
+++ /dev/null
@@ -1,50 +0,0 @@
-include::attributes.txt[]
-
-[.topic]
-[#libraries]
-= The {aws} CDK libraries
-:info_titleabbrev: Libraries
-:keywords: {aws} CDK, {aws} CDK libraries, constructs, {aws} Construct Library
-
-[abstract]
---
-Learn about the core libraries that you will use with the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-
-Learn about the core libraries that you will use with the {aws} Cloud Development Kit ({aws} CDK).
-
-[#libraries-cdk]
-== The {aws} CDK Library
-
-The {aws} CDK Library, also referred to as `aws-cdk-lib`, is the main library that you will use to develop applications with the {aws} CDK. It is developed and maintained by {aws}. This library contains base classes, such as https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.App.html[`App`] and https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html[`Stack`]. It also contains the libraries you will use to define your infrastructure through constructs.
-
-[#libraries-construct]
-== The {aws} Construct Library
-
-The {aws} Construct Library is a part of the {aws} CDK Library. It contains a collection of xref:constructs[constructs] that are developed and maintained by {aws}. It is organized into various modules for each {aws} service. Each module includes constructs that you can use to define your {aws} resources and properties.
-
-[#libraries-constructs]
-== The Constructs library
-
-The Constructs library, commonly referred to as `constructs`, is a library for defining and composing cloud infrastructure components. It contains the core https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html[`Construct`] class, which represents the construct building block. This class is the foundational base class of all constructs from the {aws} Construct Library. The Constructs library is a separate general-purpose library that is used by other construct-based tools such as _CDK for Terraform_ and _CDK for Kubernetes_.
-
-[#libraries-reference]
-== The {aws} CDK API reference
-
-The https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html[{aws} CDK API reference] contains official reference documentation for the {aws} CDK Library, including the {aws} Construct Library and Constructs library. A version of the API reference is provided for each supported programming language.
-
-* For {aws} CDK Library (`aws-cdk-lib`) documentation, see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib-readme.html[aws-cdk-lib module].
-* Documentation for constructs in the {aws} Construct Library are organized by {aws} service in the following format: `aws-cdk-lib.`. For example, construct documentation for Amazon Simple Storage Service (Amazon S3), can be found at https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html[aws-cdk-lib.aws_s3 module].
-* For Constructs library (constructs) documentation, see https://docs.aws.amazon.com/cdk/api/v2/docs/constructs-readme.html[constructs module].
-
-[#libraries-reference-contribute]
-=== Contribute to the {aws} CDK API reference
-
-The {aws} CDK is open-source and we welcome you to contribute. Community contributions positively impact and improve the {aws} CDK. For instructions on contributing specifically to {aws} CDK API reference documentation, see https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md#documentation[Documentation] in the __aws-cdk [.noloc]`GitHub` repository__.
-
-[#libraries-learn,libraries-learn.title]
-== Learn more
-
-For instructions on importing and using the CDK Library, see xref:work-with[Work with the CDK library].
\ No newline at end of file
diff --git a/v2/guide/migrate.adoc b/v2/guide/migrate.adoc
deleted file mode 100644
index 31063c2d..00000000
--- a/v2/guide/migrate.adoc
+++ /dev/null
@@ -1,370 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#migrate]
-= Migrate existing resources and {aws} CloudFormation templates to the {aws} CDK
-:info_titleabbrev: Migrate to the {aws} CDK
-:keywords: {aws} CDK, {aws} CDK CLI, {aws} CloudFormation, Migrate, {aws} resources, Infrastructure as Code, IaC
-
-[abstract]
---
-Use the {aws} Cloud Development Kit ({aws} CDK) Command Line Interface ({aws} CDK CLI) to migrate deployed {aws} resources, deployed {aws} CloudFormation stacks, and local {aws} CloudFormation templates to {aws} CDK.
---
-
-// Content start
-
-[cols="1", frame="all"]
-|===
-
-|The CDK Migrate feature is in preview release for {aws} CDK and is subject to change.
-|===
-
-Use the {aws} Cloud Development Kit ({aws} CDK) Command Line Interface ({aws} CDK CLI) to migrate deployed {aws} resources, deployed {aws} CloudFormation stacks, and local {aws} CloudFormation templates to {aws} CDK.
-
-
-[#migrate-intro]
-== How migration works
-
-Use the {aws} CDK CLI `cdk migrate` command to migrate from the following sources:
-
---
-* Deployed {aws} resources.
-* Deployed {aws} CloudFormation stacks.
-* Local {aws} CloudFormation templates.
---
-
-*Deployed {aws} resources*::
-+
-You can migrate deployed {aws} resources from a specific environment ({aws} account and {aws} Region) that are not associated with an {aws} CloudFormation stack.
-+
-The {aws} CDK CLI utilizes the _IaC generator_ service to scan for resources in your {aws} environment to gather resource details. To learn more about IaC generator, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC.html[Generating templates for existing resources] in the _{aws} CloudFormation User Guide_.
-+
-After gathering resource details, the {aws} CDK CLI creates a new CDK app that includes a single stack containing your migrated resources.
-
-*Deployed {aws} CloudFormation stacks*::
-+
-You can migrate a single {aws} CloudFormation stack into a new {aws} CDK app. The {aws} CDK CLI will retrieve the {aws} CloudFormation template of your stack and create a new CDK app. The CDK app will consist of a single stack that contains your migrated {aws} CloudFormation stack.
-
-*Local {aws} CloudFormation templates*::
-+
-You can migrate from a local {aws} CloudFormation template. Local templates may or may not contain deployed resources. The {aws} CDK CLI will create a new CDK app that contains a single stack with your resources.
-+
-After migrating, you can manage, modify, and deploy your CDK app to {aws} CloudFormation to provision or update your resources.
-
-[#migrate-benefits]
-== Benefits of CDK Migrate
-
-Migrating resources into {aws} CDK has historically been a manual process that requires time and expertise with {aws} CloudFormation and {aws} CDK to even begin. With CDK Migrate, the {aws} CDK CLI facilitates a majority of the migration effort for you in a fraction of the time. CDK Migrate will quickly get you started with using the {aws} CDK to develop and manage new and existing applications on {aws}.
-
-[#migrate-considerations]
-== Considerations
-
-[#migrate-considerations-general]
-=== General considerations
-
-*CDK Migrate vs. CDK Import*::
-+
-The `cdk import` command can import deployed resources into a new or existing CDK app. When importing, each resource will have to manually be defined as an L1 construct in your app. We recommend using `cdk import` to import one or more resources at a time into a new or existing CDK app. To learn more, see xref:cli-import[Import existing resources into a stack].
-+
-The `cdk migrate` command migrates from deployed resources, deployed {aws} CloudFormation stacks, or local {aws} CloudFormation templates into a new CDK app. During migration, the {aws} CDK CLI uses `cdk import` to import your resources into the new CDK app. The {aws} CDK CLI also generates L1 constructs for each resource for you. We recommend using `cdk migrate` when importing from a supported migration source into a new {aws} CDK app.
-
-*CDK Migrate creates L1 constructs only*::
-+
-The newly created CDK app will include L1 constructs only. You can add higher-level constructs to your app after migration.
-
-*CDK Migrate creates CDK apps that contain a single stack*::
-+
-The newly created CDK app will contain a single stack.
-+
-When migrating deployed resources, all migrated resources will be contained within a single stack in the new CDK app.
-+
-When migrating {aws} CloudFormation stacks, you can only migrate a single {aws} CloudFormation stack into a single stack in the new CDK app.
-
-*Migrating assets*::
-+
-Project assets, such as {aws} Lambda code, will not directly migrate into the new CDK app. After migration, you can specify asset values to include them in the CDK app.
-
-*Migrating stateful resources*::
-+
-When migrating stateful resources, such as databases and Amazon Simple Storage Service (Amazon S3) buckets, you'd most often want to migrate the existing resource instead of creating a new resource.
-+
-To migrate and preserve stateful resources, do the following:
-+
---
-** Verify that your stateful resource supports import. For more information, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html[Resource type support] in the _{aws} CloudFormation User Guide_.
-** After migration, verify that the migrated resource`'s logical ID in the new CDK app matches the logical ID of the deployed resource.
-** If migrating from an {aws} CloudFormation stack, verify that the stack name in the new CDK app matches the {aws} CloudFormation stack.
-** Deploy the CDK app using the same {aws} account and {aws} Region of the migrated resource.
---
-
-[#migrate-considerations-template]
-=== Considerations when migrating from an {aws} CloudFormation template
-
-*CDK Migrate supports single template migration*::
-+
-When migrating {aws} CloudFormation templates, you can select a single template to migrate. Nested templates are not supported.
-
-*Migrating templates with intrinsic functions*::
-+
-When migrating from an {aws} CloudFormation template that uses intrinsic functions, the {aws} CDK CLI will attempt to migrate your logic into the CDK app with the `Fn` class. To learn more, see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Fn.html[class Fn] in the _{aws} Cloud Development Kit ({aws} CDK) API Reference_.
-
-[#migrate-considerations-resources]
-=== Considerations when migrating from deployed resources
-
-*Scan limitations*::
-+
-When scanning your environment for resources, IaC generator has specific limitations on the data it can retrieve and quota limitations when scanning. To learn more, see link:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC.html#generate-template-considerations[Considerations] in the _{aws} CloudFormation User Guide_.
-
-[#migrate-prerequisites]
-== Prerequisites
-
-Before using the `cdk migrate` command, complete all set up steps in xref:getting-started[Getting started with the {aws} CDK].
-
-[#migrate-gs]
-== Get started with CDK Migrate
-
-To begin, run the {aws} CDK CLI `cdk migrate` command from a directory of your choice. Provide required and optional options, depending on the type of migration you are performing.
-
-For a full list and description of options that you can use with `cdk migrate`, see xref:ref-cli-cdk-migrate[cdk migrate].
-
-The following are some important options that you may want to provide.
-
-*Stack name*::
-+
-The only required option is `--stack-name`. Use this option to specify a name for the stack that will be created within the {aws} CDK app after migration. The stack name will also be used as the name of your {aws} CloudFormation stack at deployment.
-
-*Language*::
-+
-Use `--language` to specify the programming language of the new CDK app.
-
-*{aws} account and {aws} Region*::
-+
-The {aws} CDK CLI retrieves {aws} account and {aws} Region information from default sources. For more information, see xref:environments[Environments for the {aws} CDK]. You can use `--account` and `--region` options with `cdk migrate` to provide other values.
-
-*Output directory of your new CDK project*::
-+
-By default, the {aws} CDK CLI will create a new CDK project in your working directory and use the value you provide with `--stack-name` to name the project folder. If a folder with the same name currently exists, the {aws} CDK CLI will overwrite that folder.
-+
-You can specify a different output path for the new CDK project folder with the `--output-path` option.
-
-*Migration source*::
-+
-Provide an option to specify the source you are migrating from.
-+
---
-* `--from-path` – Migrate from a local {aws} CloudFormation template.
-* `--from-scan` – Migrate from deployed resources in an {aws} account and {aws} Region.
-* `--from-stack` – Migrate from an {aws} CloudFormation stack.
---
-+
-Depending on your migration source, you can provide additional options to customize the `cdk migrate` command.
-
-[#migrate-stack]
-== Migrate from an {aws} CloudFormation stack
-
-To migrate from a deployed {aws} CloudFormation stack, provide the `--from-stack` option. Provide the name of your deployed {aws} CloudFormation stack with `--stack-name`. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk migrate --from-stack --stack-name "myCloudFormationStack"
-----
-
-The {aws} CDK CLI will do the following:
-
-. Retrieve the {aws} CloudFormation template of your deployed stack.
-. Run `cdk init` to initialize a new CDK app.
-. Create a stack within the CDK app that contains your migrated {aws} CloudFormation stack.
-
-When you migrate from a deployed {aws} CloudFormation stack, the {aws} CDK CLI attempts to match deployed resource logical IDs and the deployed {aws} CloudFormation stack name to the migrated resources and stack in the new CDK app.
-
-After migration, you can manage and modify your CDK app normally. When you deploy, {aws} CloudFormation will identify the deployment as an {aws} CloudFormation stack update due to the matching {aws} CloudFormation stack name. Resources with matching logical IDs will be updated. For more information on deploying, see xref:migrate-manage[Manage and deploy your CDK app].
-
-[#migrate-template]
-== Migrate from an {aws} CloudFormation template
-
-CDK Migrate supports migrating from {aws} CloudFormation templates formatted in `JSON` or `YAML`.
-
-To migrate from a local {aws} CloudFormation template, use the `--from-path` option and provide a path to the local template. You must also provide the required `--stack-name` option. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk migrate --from-path "./template.json" --stack-name "myCloudFormationStack"
-----
-
-The {aws} CDK CLI will do the following:
-
-. Retrieve your local {aws} CloudFormation template.
-. Run `cdk init` to initialize a new CDK app.
-. Create a stack within the CDK app that contains your migrated {aws} CloudFormation template.
-
-After migration, you can manage and modify your CDK app normally. At deployment, you have the following options:
-
-* *Update an {aws} CloudFormation stack* – If the local {aws} CloudFormation template was previously deployed, you can update the deployed {aws} CloudFormation stack.
-* *Deploy a new {aws} CloudFormation stack* – If the local {aws} CloudFormation template was never deployed, or if you want to create a new stack from a previously deployed template, you can deploy a new {aws} CloudFormation stack.
-
-[#migrate-template-sam]
-=== Migrate from an {aws} SAM template
-
-To migrate from an {aws} Serverless Application Model ({aws} SAM) template, you must first convert it to an {aws} CloudFormation template or deploy to create an {aws} CloudFormation stack.
-
-To convert an {aws} SAM template to {aws} CloudFormation, you can use the {aws} SAM CLI `sam validate --debug` command. You may have to set `lint` to `false` in your `samconfig.toml` file before running this command.
-
-To convert to an {aws} CloudFormation stack, deploy the {aws} SAM template using the {aws} SAM CLI. Then migrate from the deployed stack.
-
-[#migrate-resources]
-== Migrate from deployed resources
-
-To migrate from deployed {aws} resources, provide the `--from-scan` option. You must also provide the required `--stack-name` option. The following is an example:
-
-[source,bash,subs="verbatim,attributes"]
-----
-$ cdk migrate --from-scan --stack-name "myCloudFormationStack"
-----
-
-The {aws} CDK CLI will do the following:
-
-. *Scan your account for resource and property details* – The {aws} CDK CLI utilizes IaC generator to scan your account and gather details.
-. *Generate an {aws} CloudFormation template* – After scanning, the {aws} CDK CLI utilizes IaC generator to create an {aws} CloudFormation template.
-. *Initialize a new CDK app and migrate your template* – The {aws} CDK CLI runs `cdk init` to initialize a new {aws} CDK app and migrates your {aws} CloudFormation template into the CDK app as a single stack.
-
-[#migrate-resources-filters]
-=== Use filters
-
-By default, the {aws} CDK CLI will scan the entire {aws} environment and migrate resources up to the maximum quota limit of IaC generator. You can provide filters with the {aws} CDK CLI to specify a criteria for which resources get migrated from your account to the new CDK app. To learn more, see `xref:ref-cli-cdk-migrate-options-filter[--filter]`.
-
-[#migrate-resources-scan]
-=== Scanning for resources with IaC generator
-
-Depending on the number of resources in your account, scanning may take a few minutes. A progress bar will display during the scanning process.
-
-[#migrate-resources-supported]
-*Supported resource types*::
-+
-The {aws} CDK CLI will migrate resources supported by the IaC generator. For a full list, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html[Resource type support] in the __{aws} CloudFormation User Guide__.
-
-[#migrate-resources-writeonly]
-=== Resolve write-only properties
-
-Some supported resources contain write-only properties. These properties can be written to, to configure the property, but can't be read by IaC generator or {aws} CloudFormation to obtain the value. For example, a property used to specify a database password may be write-only for security reasons.
-
-When scanning resources during migration, IaC generator will detect resources that may contain write-only properties and will categorize them into any of the following types:
-
-* `MUTUALLY_EXCLUSIVE_PROPERTIES` – These are write-only properties for a specific resource that are interchangeable and serve a similar purpose. One of the mutually exclusive properties are required to configure your resource. For example, the `S3Bucket`, `ImageUri`, and `ZipFile` properties for an `{aws}::Lambda::Function` resource are mutually exclusive write-only properties. Any one of them can be used to specify your function assets, but you must use one.
-* `MUTUALLY_EXCLUSIVE_TYPES` – These are required write-only properties that accept multiple configuration types. For example, the `Body` property of an `{aws}::ApiGateway::RestApi` resource accepts an object or string type.
-* `UNSUPPORTED_PROPERTIES` – These are write-only properties that don't fall under the other two categories. They are either optional properties or required properties that accept an array of objects.
-
-For more information on write-only properties and how IaC generator manages them when scanning for deployed resources and creating {aws} CloudFormation templates, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC-write-only-properties.html[IaC generator and write-only properties] in the _{aws} CloudFormation User Guide_.
-
-After migration, you must specify write-only property values in the new CDK app. The {aws} CDK CLI will append a *Warnings* section to the CDK project's `ReadMe` file to document any write-only properties that were identified by IaC generator. The following is an example:
-
-[source,markdown,subs="verbatim,attributes"]
-----
-# Welcome to your CDK TypeScript project
-...
-## Warnings
-### Write-only properties
-Write-only properties are resource property values that can be written to but can't be read by {aws} CloudFormation or CDK Migrate. For more information, see [IaC generator and write-only properties](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC-write-only-properties.html).
-
-Write-only properties discovered during migration are organized here by resource ID and categorized by write-only property type. Resolve write-only properties by providing property values in your CDK app. For guidance, see [Resolve write-only properties](https://docs.aws.amazon.com/cdk/v2/guide/migrate.html#migrate-resources-writeonly).
-### MyLambdaFunction
-- **UNSUPPORTED_PROPERTIES**:
- - SnapStart/ApplyOn: Applying SnapStart setting on function resource type.Possible values: [PublishedVersions, None]
-This property can be replaced with other types
- - Code/S3ObjectVersion: For versioned objects, the version of the deployment package object to use.
-This property can be replaced with other exclusive properties
-- **MUTUALLY_EXCLUSIVE_PROPERTIES**:
- - Code/S3Bucket: An Amazon S3 bucket in the same {aws} Region as your function. The bucket can be in a different {aws} account.
-This property can be replaced with other exclusive properties
- - Code/S3Key: The Amazon S3 key of the deployment package.
-This property can be replaced with other exclusive properties
-----
-
---
-* Warnings are organized under headings that identify the resource`'s logical ID that they are associated with.
-* Warnings are categorized by type. These types come directly from IaC generator.
---
-
-*To resolve write-only properties*::
-+
-. Identify write-only properties to resolve from the *Warnings* section of your CDK project`'s `ReadMe` file. Here, you can take note of the resources in your CDK app that may contain write-only properties and identify the write-only property types that were discovered.
-+
-.. For ``MUTUALLY_EXCLUSIVE_PROPERTIES``, determine which mutually exclusive property to configure in your {aws} CDK app.
-.. For ``MUTUALLY_EXCLUSIVE_TYPES``, determine which accepted type that you will use to configure the property.
-.. For ``UNSUPPORTED_PROPERTIES``, determine if the property is optional or required. Then, configure as necessary.
-. Use guidance from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC-write-only-properties.html[IaC generator and write-only properties] to reference what the warning types mean.
-. In your CDK app, write-only property values to resolve will also be specified in the `Props` section of your app. Provide the correct values here. For property descriptions and guidance, you can reference the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-construct-library.html[{aws} CDK API Reference].
-+
-
-The following is an example of the `Props` section within a migrated CDK app with two write-only properties to resolve:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-export interface MyTestAppStackProps extends cdk.StackProps {
- /**
- * The Amazon S3 key of the deployment package.
- */
- readonly lambdaFunction00asdfasdfsadf008grk1CodeS3Keym8P82: string;
- /**
- * An Amazon S3 bucket in the same {aws} Region as your function. The bucket can be in a different {aws} account.
- */
- readonly lambdaFunction00asdfasdfsadf008grk1CodeS3Bucketzidw8: string;
-}
-----
-+
-
-Once you resolve all write-only property values, you're ready to prepare for deployment.
-
-[#migrate-resources-file]
-=== The migrate.json file
-
-The {aws} CDK CLI creates a `migrate.json` file in your {aws} CDK project during migration. This file contains reference information on your deployed resources. When you deploy your CDK app for the first time, the {aws} CDK CLI uses this file to reference your deployed resources, associates your resources with the new {aws} CloudFormation stack, and deletes the file.
-
-[#migrate-manage]
-== Manage and deploy your CDK app
-
-When migrating to {aws} CDK, the new CDK app may not be deployment-ready immediately. This topic describes action items to consider while managing and deploying your new CDK app.
-
-[#migrate-manage-prepare]
-=== Prepare for deployment
-
-Before deploying, you must prepare your CDK app.
-
-*Synthesize your app*::
-Use the `cdk synth` command to synthesize the stack in your CDK app into an {aws} CloudFormation template.
-+
-If you migrated from a deployed {aws} CloudFormation stack or template, you can compare the synthesized template to the migrated template to verify resource and property values.
-+
-To learn more about `cdk synth`, see xref:cli-synth[Synthesize stacks].
-
-*Perform a diff*::
-If you migrated from a deployed {aws} CloudFormation stack, you can use the cdk diff command to compare with the stack in your new CDK app.
-+
-To learn more about cdk diff, see xref:cli-diff[Compare stacks].
-
-*Bootstrap your environment*::
-If you are deploying from an {aws} environment for the first time, use `cdk bootstrap` to prepare your environment. To learn more, see xref:bootstrapping[{aws} CDK bootstrapping].
-
-[#migrate-manage-deploy]
-=== Deploy your CDK app
-
-When you deploy a CDK app, the {aws} CDK CLI utilizes the {aws} CloudFormation service to provision your resources. Resources are bundled into a single stack in the CDK app and are deployed as a single {aws} CloudFormation stack.
-
-Depending on where you migrated from, you can deploy to create a new {aws} CloudFormation stack or update an existing {aws} CloudFormation stack.
-
-*Deploy to create a new {aws} CloudFormation stack*::
-If you migrated from deployed resources, the {aws} CDK CLI will automatically create a new {aws} CloudFormation stack at deployment. Your deployed resources will be included in the new {aws} CloudFormation stack.
-+
-If you migrated from a local {aws} CloudFormation template that was never deployed, the {aws} CDK CLI will automatically create a new {aws} CloudFormation stack at deployment.
-+
-If you migrated from a deployed {aws} CloudFormation stack or local {aws} CloudFormation template that was previously deployed, you can deploy to create a new {aws} CloudFormation stack. To create a new stack, do the following:
-+
---
-* Deploy to a new {aws} environment. This consists of using a different {aws} account or deploying to a different {aws} Region.
-* If you want to deploy a new stack to the same {aws} environment of the migrated stack or template, you must modify the stack name in your CDK app to a new value. You must also modify all logical IDs of resources in your CDK app. Then, you can deploy to the same environment to create a new stack and new resources.
---
-
-*Deploy to update an existing {aws} CloudFormation stack*::
-If you migrated from a deployed {aws} CloudFormation stack or local {aws} CloudFormation template that was previously deployed, you can deploy to update the existing {aws} CloudFormation stack.
-+
-Verify that the stack name in your CDK app matches the stack name of the deployed {aws} CloudFormation stack and deploy to the same {aws} environment.
\ No newline at end of file
diff --git a/v2/guide/parameters.adoc b/v2/guide/parameters.adoc
deleted file mode 100644
index 379c1eb2..00000000
--- a/v2/guide/parameters.adoc
+++ /dev/null
@@ -1,45 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-:info_titleabbrev: Parameters
-:keywords: {aws} CDK, {aws} CloudFormation, Parameters
-
-[#parameters]
-= Parameters and the {aws} CDK
-
-[abstract]
---
-_Parameters_ are custom values that are supplied at deployment time.
---
-
-// Content start
-_Parameters_ are custom values that are supplied at deployment time. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html[Parameters] are a feature of {aws} CloudFormation. Since the {aws} Cloud Development Kit ({aws} CDK) synthesizes {aws} CloudFormation templates, it also offers support for deployment-time parameters.
-
-[#parameters-about]
-== About parameters
-
-Using the {aws} CDK, you can define parameters, which can then be used in the properties of constructs you create. You can also deploy stacks that contain parameters.
-
-When deploying the {aws} CloudFormation template using the {aws} CDK CLI, you provide the parameter values on the command line. If you deploy the template through the {aws} CloudFormation console, you are prompted for the parameter values.
-
-In general, we recommend against using {aws} CloudFormation parameters with the {aws} CDK. The usual ways to pass values into {aws} CDK apps are xref:context[context values] and environment variables. Because they are not available at synthesis time, parameter values cannot be easily used for flow control and other purposes in your CDK app.
-
-[NOTE]
-====
-
-To do control flow with parameters, you can use https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnCondition.html[`CfnCondition`] constructs, although this is awkward compared to native `if` statements.
-
-====
-
-Using parameters requires you to be mindful of how the code you're writing behaves at deployment time, and also at synthesis time. This makes it harder to understand and reason about your {aws} CDK application, in many cases for little benefit.
-
-Generally, it's better to have your CDK app accept necessary information in a well-defined way and use it directly to declare constructs in your CDK app. An ideal {aws} CDK–generated {aws} CloudFormation template is concrete, with no values remaining to be specified at deployment time.
-
-There are, however, use cases to which {aws} CloudFormation parameters are uniquely suited. If you have separate teams defining and deploying infrastructure, for example, you can use parameters to make the generated templates more widely useful. Also, because the {aws} CDK supports {aws} CloudFormation parameters, you can use the {aws} CDK with {aws} services that use {aws} CloudFormation templates (such as Service Catalog). These {aws} services use parameters to configure the template that's being deployed.
-
-[#parameters-learn]
-== Learn more
-
-For instructions on developing CDK apps with parameters, see xref:get-cfn-param[Use CloudFormation parameters to get a CloudFormation value].
\ No newline at end of file
diff --git a/v2/guide/permissions.adoc b/v2/guide/permissions.adoc
deleted file mode 100644
index f9ad870a..00000000
--- a/v2/guide/permissions.adoc
+++ /dev/null
@@ -1,555 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Permissions
-:keywords: {aws} CDK, Permissions, IAM
-
-[#permissions]
-= Permissions and the {aws} CDK
-
-[abstract]
---
-The {aws} Construct Library uses a few common, widely implemented idioms to manage access and permissions. The IAM module provides you with the tools you need to use these idioms.
---
-
-// Content start
-
-The {aws} Construct Library uses a few common, widely implemented idioms to manage access and permissions. The IAM module provides you with the tools you need to use these idioms.
-
-{aws} CDK uses {aws} CloudFormation to deploy changes. Every deployment involves an actor (either a developer, or an automated system) that starts a {aws} CloudFormation deployment. In the course of doing this, the actor will assume one or more IAM Identities (user or roles) and optionally pass a role to {aws} CloudFormation.
-
-If you use {aws} IAM Identity Center to authenticate as a user, then the single sign-on provider supplies short-lived session credentials that authorize you to act as a pre-defined IAM role. To learn how the {aws} CDK obtains {aws} credentials from IAM Identity Center authentication, see https://docs.aws.amazon.com/sdkref/latest/guide/understanding-sso.html[Understand IAM Identity Center authentication] in the _{aws} SDKs and Tools Reference Guide_.
-
-[#permissions-principals]
-== Principals
-
-An IAM principal is an authenticated {aws} entity representing a user, service, or application that can call {aws} APIs. The {aws} Construct Library supports specifying principals in several flexible ways to grant them access your {aws} resources.
-
-In security contexts, the term "principal" refers specifically to authenticated entities such as users. Objects like groups and roles do not _represent_ users (and other authenticated entities) but rather _identify_ them indirectly for the purpose of granting permissions.
-
-For example, if you create an IAM group, you can grant the group (and thus its members) write access to an Amazon RDS table. However, the group itself is not a principal because it doesn't represent a single entity (also, you cannot log in to a group).
-
-In the CDK's IAM library, classes that directly or indirectly identify principals implement the https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IPrincipal.html[`IPrincipal`] interface, allowing these objects to be used interchangeably in access policies. However, not all of them are principals in the security sense. These objects include:
-
-. IAM resources such as https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html[`Role`], https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.User.html[`User`], and https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Group.html[`Group`]
-. Service principals (`new iam.link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.ServicePrincipal.html[ServicePrincipal]('service.amazonaws.com')`)
-. Federated principals (`new iam.link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.FederatedPrincipal.html[FederatedPrincipal]('cognito-identity.amazonaws.com')`)
-. Account principals (`new iam.link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.AccountPrincipal.html[AccountPrincipal]('0123456789012')`)
-. Canonical user principals (`new iam.link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.CanonicalUserPrincipal.html[CanonicalUserPrincipal]('79a59d[...]7ef2be')`)
-. {aws} Organizations principals (`new iam.link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.OrganizationPrincipal.html[OrganizationPrincipal]('org-id')`)
-. Arbitrary ARN principals (`new iam.link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.ArnPrincipal.html[ArnPrincipal](res.arn)`)
-. An `iam.link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.CompositePrincipal.html[CompositePrincipal](principal1, principal2, ...)` to trust multiple principals
-
-[#permissions-grants]
-== Grants
-
-Every construct that represents a resource that can be accessed, such as an Amazon S3 bucket or Amazon DynamoDB table, has methods that grant access to another entity. All such methods have names starting with *grant*.
-
-For example, Amazon S3 buckets have the methods link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html#grantwbrreadidentity-objectskeypattern[`grantRead`] and link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html#grantwbrreadwbrwriteidentity-objectskeypattern[`grantReadWrite`] (Python: `grant_read`, `grant_read_write`) to enable read and read/write access, respectively, from an entity to the bucket. The entity doesn't have to know exactly which Amazon S3 IAM permissions are required to perform these operations.
-
-The first argument of a *grant* method is always of type link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IGrantable.html[`IGrantable`]. This interface represents entities that can be granted permissions. That is, it represents resources with roles, such as the IAM objects link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html[`Role`], link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.User.html[`User`], and link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Group.html[`Group`].
-
-Other entities can also be granted permissions. For example, later in this topic, we show how to grant a CodeBuild project access to an Amazon S3 bucket. Generally, the associated role is obtained via a `role` property on the entity being granted access.
-
-Resources that use execution roles, such as link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html[`lambda.Function`], also implement `IGrantable`, so you can grant them access directly instead of granting access to their role. For example, if `bucket` is an Amazon S3 bucket, and `function` is a Lambda function, the following code grants the function read access to the bucket.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-bucket.grantRead(function);
-----
-
-JavaScript::
-+
-[source,none,subs="verbatim,attributes"]
-----
-bucket.grantRead(function);
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-bucket.grant_read(function)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-bucket.grantRead(function);
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-bucket.GrantRead(function);
-----
-====
-
-Sometimes permissions must be applied while your stack is being deployed. One such case is when you grant an {aws} CloudFormation custom resource access to some other resource. The custom resource will be invoked during deployment, so it must have the specified permissions at deployment time.
-
-Another case is when a service verifies that the role you pass to it has the right policies applied. (A number of {aws} services do this to make sure that you didn't forget to set the policies.) In those cases, the deployment might fail if the permissions are applied too late.
-
-To force the grant's permissions to be applied before another resource is created, you can add a dependency on the grant itself, as shown here. Though the return value of grant methods is commonly discarded, every grant method in fact returns an `iam.Grant` object.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const grant = bucket.grantRead(lambda);
-const custom = new CustomResource(...);
-custom.node.addDependency(grant);
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const grant = bucket.grantRead(lambda);
-const custom = new CustomResource(...);
-custom.node.addDependency(grant);
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-grant = bucket.grant_read(function)
-custom = CustomResource(...)
-custom.node.add_dependency(grant)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-Grant grant = bucket.grantRead(function);
-CustomResource custom = new CustomResource(...);
-custom.node.addDependency(grant);
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-var grant = bucket.GrantRead(function);
-var custom = new CustomResource(...);
-custom.node.AddDependency(grant);
-----
-====
-
-[#permissions-roles]
-== Roles
-
-The IAM package contains a link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html[`Role`] construct that represents IAM roles. The following code creates a new role, trusting the Amazon EC2 service.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as iam from 'aws-cdk-lib/aws-iam';
-
-const role = new iam.Role(this, 'Role', {
- assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), // required
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const iam = require('aws-cdk-lib/aws-iam');
-
-const role = new iam.Role(this, 'Role', {
- assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com') // required
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_iam as iam
-
-role = iam.Role(self, "Role",
- assumed_by=iam.ServicePrincipal("ec2.amazonaws.com")) # required
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.iam.Role;
-import software.amazon.awscdk.services.iam.ServicePrincipal;
-
-Role role = Role.Builder.create(this, "Role")
- .assumedBy(new ServicePrincipal("ec2.amazonaws.com")).build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.IAM;
-
-var role = new Role(this, "Role", new RoleProps
-{
- AssumedBy = new ServicePrincipal("ec2.amazonaws.com"), // required
-});
-----
-====
-
-You can add permissions to a role by calling the role's link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html#addwbrtowbrpolicystatement[`addToPolicy`] method (Python: `add_to_policy`), passing in a link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html[`PolicyStatement`] that defines the rule to be added. The statement is added to the role's default policy; if it has none, one is created.
-
-The following example adds a `Deny` policy statement to the role for the actions `ec2:SomeAction` and `s3:AnotherAction` on the resources `bucket` and `otherRole` (Python: `other_role`), under the condition that the authorized service is {aws} CodeBuild.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-role.addToPolicy(new iam.PolicyStatement({
- effect: iam.Effect.DENY,
- resources: [bucket.bucketArn, otherRole.roleArn],
- actions: ['ec2:SomeAction', 's3:AnotherAction'],
- conditions: {StringEquals: {
- 'ec2:AuthorizedService': 'codebuild.amazonaws.com',
-}}}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-role.addToPolicy(new iam.PolicyStatement({
- effect: iam.Effect.DENY,
- resources: [bucket.bucketArn, otherRole.roleArn],
- actions: ['ec2:SomeAction', 's3:AnotherAction'],
- conditions: {StringEquals: {
- 'ec2:AuthorizedService': 'codebuild.amazonaws.com'
-}}}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-role.add_to_policy(iam.PolicyStatement(
- effect=iam.Effect.DENY,
- resources=[bucket.bucket_arn, other_role.role_arn],
- actions=["ec2:SomeAction", "s3:AnotherAction"],
- conditions={"StringEquals": {
- "ec2:AuthorizedService": "codebuild.amazonaws.com"}}
-))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-role.addToPolicy(PolicyStatement.Builder.create()
- .effect(Effect.DENY)
- .resources(Arrays.asList(bucket.getBucketArn(), otherRole.getRoleArn()))
- .actions(Arrays.asList("ec2:SomeAction", "s3:AnotherAction"))
- .conditions(java.util.Map.of( // Map.of requires Java 9 or later
- "StringEquals", java.util.Map.of(
- "ec2:AuthorizedService", "codebuild.amazonaws.com")))
- .build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-role.AddToPolicy(new PolicyStatement(new PolicyStatementProps
-{
- Effect = Effect.DENY,
- Resources = new string[] { bucket.BucketArn, otherRole.RoleArn },
- Actions = new string[] { "ec2:SomeAction", "s3:AnotherAction" },
- Conditions = new Dictionary
- {
- ["StringEquals"] = new Dictionary
- {
- ["ec2:AuthorizedService"] = "codebuild.amazonaws.com"
- }
- }
-}));
-----
-====
-
-In the preceding example, we've created a new link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html[`PolicyStatement`] inline with the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html#addwbrtowbrpolicystatement[`addToPolicy`] (Python: `add_to_policy`) call. You can also pass in an existing policy statement or one you've modified. The link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html[`PolicyStatement`] object has link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html#methods[numerous methods] for adding principals, resources, conditions, and actions.
-
-If you're using a construct that requires a role to function correctly, you can do one of the following:
-
-* Pass in an existing role when instantiating the construct object.
-* Let the construct create a new role for you, trusting the appropriate service principal. The following example uses such a construct: a CodeBuild project.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as codebuild from 'aws-cdk-lib/aws-codebuild';
-
-// imagine roleOrUndefined is a function that might return a Role object
-// under some conditions, and undefined under other conditions
-const someRole: iam.IRole | undefined = roleOrUndefined();
-
-const project = new codebuild.Project(this, 'Project', {
- // if someRole is undefined, the Project creates a new default role,
- // trusting the codebuild.amazonaws.com service principal
- role: someRole,
-});
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const codebuild = require('aws-cdk-lib/aws-codebuild');
-
-// imagine roleOrUndefined is a function that might return a Role object
-// under some conditions, and undefined under other conditions
-const someRole = roleOrUndefined();
-
-const project = new codebuild.Project(this, 'Project', {
- // if someRole is undefined, the Project creates a new default role,
- // trusting the codebuild.amazonaws.com service principal
- role: someRole
-});
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk.aws_codebuild as codebuild
-
-# imagine role_or_none is a function that might return a Role object
-# under some conditions, and None under other conditions
-some_role = role_or_none();
-
-project = codebuild.Project(self, "Project",
-# if role is None, the Project creates a new default role,
-# trusting the codebuild.amazonaws.com service principal
-role=some_role)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-import software.amazon.awscdk.services.iam.Role;
-import software.amazon.awscdk.services.codebuild.Project;
-
-// imagine roleOrNull is a function that might return a Role object
-// under some conditions, and null under other conditions
-Role someRole = roleOrNull();
-
-// if someRole is null, the Project creates a new default role,
-// trusting the codebuild.amazonaws.com service principal
-Project project = Project.Builder.create(this, "Project")
- .role(someRole).build();
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK.{aws}.CodeBuild;
-
-// imagine roleOrNull is a function that might return a Role object
-// under some conditions, and null under other conditions
-var someRole = roleOrNull();
-
-// if someRole is null, the Project creates a new default role,
-// trusting the codebuild.amazonaws.com service principal
-var project = new Project(this, "Project", new ProjectProps
-{
- Role = someRole
-});
-----
-====
-
-Once the object is created, the role (whether the role passed in or the default one created by the construct) is available as the property `role`. However, this property is not available on external resources. Therefore, these constructs have an `addToRolePolicy` (Python: `add_to_role_policy`) method.
-
-The method does nothing if the construct is an external resource, and it calls the `addToPolicy` (Python: `add_to_policy`) method of the `role` property otherwise. This saves you the trouble of handling the undefined case explicitly.
-
-The following example demonstrates:
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// project is imported into the CDK application
-const project = codebuild.Project.fromProjectName(this, 'Project', 'ProjectName');
-
-// project is imported, so project.role is undefined, and this call has no effect
-project.addToRolePolicy(new iam.PolicyStatement({
- effect: iam.Effect.ALLOW, // ... and so on defining the policy
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-// project is imported into the CDK application
-const project = codebuild.Project.fromProjectName(this, 'Project', 'ProjectName');
-
-// project is imported, so project.role is undefined, and this call has no effect
-project.addToRolePolicy(new iam.PolicyStatement({
- effect: iam.Effect.ALLOW // ... and so on defining the policy
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-# project is imported into the CDK application
-project = codebuild.Project.from_project_name(self, 'Project', 'ProjectName')
-
-# project is imported, so project.role is undefined, and this call has no effect
-project.add_to_role_policy(iam.PolicyStatement(
- effect=iam.Effect.ALLOW, # ... and so on defining the policy
- )
-)
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-// project is imported into the CDK application
-Project project = Project.fromProjectName(this, "Project", "ProjectName");
-
-// project is imported, so project.getRole() is null, and this call has no effect
-project.addToRolePolicy(PolicyStatement.Builder.create()
- .effect(Effect.ALLOW) // .. and so on defining the policy
- .build();
-)
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-// project is imported into the CDK application
-var project = Project.FromProjectName(this, "Project", "ProjectName");
-
-// project is imported, so project.role is null, and this call has no effect
-project.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps
-{
- Effect = Effect.ALLOW, // ... and so on defining the policy
-}));
-----
-====
-
-[#permissions-resource-policies]
-== Resource policies
-
-A few resources in {aws}, such as Amazon S3 buckets and IAM roles, also have a resource policy. These constructs have an `addToResourcePolicy` method (Python: `add_to_resource_policy`), which takes a link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyStatement.html[`PolicyStatement`] as its argument. Every policy statement added to a resource policy must specify at least one principal.
-
-In the following example, the link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html[Amazon S3 bucket] `bucket` grants a role with the `s3:SomeAction` permission to itself.
-
-====
-[role="tablist"]
-TypeScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-bucket.addToResourcePolicy(new iam.PolicyStatement({
- effect: iam.Effect.ALLOW,
- actions: ['s3:SomeAction'],
- resources: [bucket.bucketArn],
- principals: [role]
-}));
-----
-
-JavaScript::
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-bucket.addToResourcePolicy(new iam.PolicyStatement({
- effect: iam.Effect.ALLOW,
- actions: ['s3:SomeAction'],
- resources: [bucket.bucketArn],
- principals: [role]
-}));
-----
-
-Python::
-+
-[source,python,subs="verbatim,attributes"]
-----
-bucket.add_to_resource_policy(iam.PolicyStatement(
- effect=iam.Effect.ALLOW,
- actions=["s3:SomeAction"],
- resources=[bucket.bucket_arn],
- principals=role))
-----
-
-Java::
-+
-[source,java,subs="verbatim,attributes"]
-----
-bucket.addToResourcePolicy(PolicyStatement.Builder.create()
- .effect(Effect.ALLOW)
- .actions(Arrays.asList("s3:SomeAction"))
- .resources(Arrays.asList(bucket.getBucketArn()))
- .principals(Arrays.asList(role))
- .build());
-----
-
-C#::
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-bucket.AddToResourcePolicy(new PolicyStatement(new PolicyStatementProps
-{
- Effect = Effect.ALLOW,
- Actions = new string[] { "s3:SomeAction" },
- Resources = new string[] { bucket.BucketArn },
- Principals = new IPrincipal[] { role }
-}));
-----
-====
-
-[#permissions-existing]
-== Using external IAM objects
-
-If you have defined an IAM user, principal, group, or role outside your {aws} CDK app, you can use that IAM object in your {aws} CDK app. To do so, create a reference to it using its ARN or its name. (Use the name for users, groups, and roles.) The returned reference can then be used to grant permissions or to construct policy statements as explained previously.
-
-* For users, call link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.User.html#static-fromwbruserwbrarnscope-id-userarn[`User.fromUserArn()`] or link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.User.html#static-fromwbruserwbrnamescope-id-username[`User.fromUserName()`]. `User.fromUserAttributes()` is also available, but currently provides the same functionality as `User.fromUserArn()`.
-* For principals, instantiate an link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.ArnPrincipal.html[`ArnPrincipal`] object.
-* For groups, call link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Group.html#static-fromwbrgroupwbrarnscope-id-grouparn[`Group.fromGroupArn()`] or link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Group.html#static-fromwbrgroupwbrnamescope-id-groupname[`Group.fromGroupName()`].
-* For roles, call link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html#static-fromwbrrolewbrarnscope-id-rolearn-options[`Role.fromRoleArn()`] or link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html#static-fromwbrrolewbrnamescope-id-rolename[`Role.fromRoleName()`].
-
-Policies (including managed policies) can be used in similar fashion using the following methods. You can use references to these objects anywhere an IAM policy is required.
-
-* link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Policy.html#static-fromwbrpolicywbrnamescope-id-policyname[`Policy.fromPolicyName`]
-* link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.ManagedPolicy.html#static-fromwbrmanagedwbrpolicywbrarnscope-id-managedpolicyarn[`ManagedPolicy.fromManagedPolicyArn`]
-* link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.ManagedPolicy.html#static-fromwbrmanagedwbrpolicywbrnamescope-id-managedpolicyname[`ManagedPolicy.fromManagedPolicyName`]
-* link:https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.ManagedPolicy.html#static-fromwbrawswbrmanagedwbrpolicywbrnamemanagedpolicyname[`ManagedPolicy.fromAwsManagedPolicyName`]
-
-[NOTE]
-====
-
-As with all references to external {aws} resources, you cannot modify external IAM objects in your CDK app.
-
-====
\ No newline at end of file
diff --git a/v2/guide/pgp-keys.adoc b/v2/guide/pgp-keys.adoc
deleted file mode 100644
index b8ba167f..00000000
--- a/v2/guide/pgp-keys.adoc
+++ /dev/null
@@ -1,423 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[#pgp-keys]
-= OpenPGP keys for the {aws} CDK and jsii
-:doctype: book
-:info_titleabbrev: OpenPGP keys
-
-[abstract]
---
-Current and historical OpenPGP keys for the {aws} CDK and jsii.
---
-
-// Content start
-
-This topic contains current and historical OpenPGP keys for the {aws} CDK and jsii.
-
-[#pgp-keys-current,]
-== Current keys
-
-These keys should be used to validate current releases of the {aws} CDK and jsii.
-
-[#cdk-pgp-key]
-=== {aws} CDK OpenPGP key
-
-[cols="1,1"]
-|===
-
-|Key ID:
-|0x42B9CF2286CD987A
-
-|Type:
-|RSA
-
-|Size:
-|4096/4096
-
-|Created:
-|2022-07-05
-
-|Expires:
-|2026-07-04
-
-|User ID:
-|{aws} Cloud Development Kit
-
-|Key fingerprint:
-|69B5 2D5B A295 1D11 FA65 413B 42B9 CF22 86CD 987A
-|===
-
-Select the "Copy" icon to copy the following OpenPGP key:
-
-[source,none,subs="verbatim,attributes"]
-----
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQINBGLEgOsBEADCoAMwvnszMLybJ+AD9cHhVyX6+rYIUEXYSgVnfkl6Z7qawIwv
-wgd/a5fEs9Kiz2XJmfwS9Rxb4d+0+Y1ls1A+gnpw9FMLcZlqkC9KLnS2MqvuXWLB
-t3z4kjZaL9fQ+58PoD4gy/M2hDg6gZrYqR3gtJuw8FcFpb/1KlkzRQUM8eAMFxf2
-TyfjP0V0tSHwcB+84oushX7fUXVMyc3+OHsCPOe/WBFMIlWgKA+n33JKIQlUUC8f
-kCWBAsAFupil0lCveT6mZu5slNRlc1I3iBLjUZ3/MtLygfqAMKwUVXeawtDvRIZe
-PrAFc2NyODEhly2JG6K0FW7eIcvBqR3rg8U49t9Y74ELTM0kKnfd+flvq35xWqQC
-0zghnk3kDppRTN4zWBgTKiCMxBcsHXGOoGn57t4B9VY9Zy3vkeySigeiwl/Tw9nJ
-PE0SRnwEc/HnjTTfX+GTG1aQVE0xSVyZ4m5ymRNCu6+rNH8lKwo5FujlXJ+GXPkp
-qT+Lx6Ix/Ny7PaoweWxwtZUkLRS4pWUsg0yotZrGyIbS+X3yMEG8WBTFI9hf6HTq
-0ryfi5/TsBrdrGKqWB99EC9xYEGgtHp4fKO5X0ynOagVOhf0jSe8t1uyuJPGb2Gc
-MQagSys5xMhdG/ZnEY4Cb+JDtH/4jc3tca0+4Z5RQ7kF9IhCncFtrbjJbwARAQAB
-tC5BV1MgQ2xvdWQgRGV2ZWxvcG1lbnQgS2l0IDxhd3MtY2RrQGFtYXpvbi5jb20+
-iQI/BBMBAgApBQJixIDrAhsvBQkHhM4ABwsJCAcDAgEGFQgCCQoLBBYCAwECHgEC
-F4AACgkQQrnPIobNmHo2qg//Zt9p/kN1DevflzxWKouUX0AS7UmUtRYXu5k/EEbu
-wkYNHpUr7+lZ+Me5YyjcIpt6UwuG9cW4SvwuxIfXucyKAWiwEbydCQauvnrYDxDa
-J6Yr/ntk7Sii6An9re99qic3IsvX+xlUXh+qJ/34ooP/1PHziCMqykvW/DwAIyhx
-2qvTXy+9+OlOWSUbhkCnNz5XKb4XQGq73DqalZX1nH4dG6fckZmYRX+dpw2njfTw
-ZLdZ7bkrfiL84FI4A21RfSbEU4s4ngiV17lZ9ivilBKTbDv3da7+yc919M7C5N4J
-yrlxvtyYNDoqKAD2WYZAnpEbG/shu3f56RyOJd56tXGwl9nKPh+F9y+379XthSwA
-xZTURFtjWf7wWHaDZadU0DKi+Oeeszjg2f/VJaGmmS8PIg7q6GiSHHpqHqNvACHm
-ZXMw12QFd3qt3xu0JMmE11ZC5VBgblwpkQTrO04Sq1rOpJwXI9ODMS/ZEhAIoYmT
-OR7ouknlAx6mj9fwpavWDAAJHLdVUMYBZTXiQYFzDvx51ivvTRWkB1zTJcFdqShY
-B37+Jz2jLDNdMrcHk2yfVp/VvfbxKcexg8wEwrrtQUslTUenl5jBZJouoz/wW81s
-Y4U1nCPCdTK5/C7JCKzR2gVnCpe6uaxAWkkM2feQhjqJZkTC4cFVgBT+4M6WcT1r
-yq4=
-=ahbs
------END PGP PUBLIC KEY BLOCK-----
-----
-
-[#jsii-pgp-key]
-=== jsii OpenPGP key
-
-[cols="1,1"]
-|===
-
-|Key ID:
-|0x056C4E15DAE3D8D9
-
-|Type:
-|RSA
-
-|Size:
-|4096/4096
-
-|Created:
-|2022-07-05
-
-|Expires:
-|2026-07-04
-
-|User ID:
-|{aws} JSII Team
-
-|Key fingerprint:
-|1E07 31D4 57E5 FE87 87E5 530A 056C 4E15 DAE3 D8D9
-|===
-
-Select the "Copy" icon to copy the following OpenPGP key:
-
-[source,none,subs="verbatim,attributes"]
-----
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQINBGLEgOkBEAD27EPVG9g2mHQ3+M6tF6le+tfhARJ2EV7m7NKIrTdSlCZATLWn
-AVLlxG1unW34NlkKZbcbR86gAxRnnAhuEhPuloU/S5wAqPGbRiFl58YjYZDNJw6U
-1SSMpE4O1sfjxv9yAbiRihLYtvksyHHZmaDhYner2aK1PdeWu+BKq/tjfm3Yzsd2
-uuVEduJ72YoQk/29dEiGOHfT+2kUKxUX+0tJSJ9MGlEf4NtQE4WLzrT6Xqb2SG4+
-alIiIVxIEi0XKDn7n8ZLjFwfJwOYxVYLtEUkqFWM8e8vgoc9/nYc+vDXZVED2g3Z
-FWrwSnDSXbQpnMa2cLhD4xLpDHUS3i2p7r3dkJQGLo/5JGOopLibrOAbYZ72izhu
-H/TuPFogSz0mNFPglrWdnLF04UIjIq420+06V4WQZC9n55Zjcbki/OhnC3B9pAdU
-tiy8zg070bWq45dPGf5STkPPn7G8A2zmKefyO51iLIi26ZzW78siB+FvcGRhdg25
-39sHJ1cmrTeC+B+k4KeV5sQ/m3UucimrZnk1xdaiVp8mWzRqWb8bB6Rs8K9RMrMV
-tFBOKOBAT2QxOQtRGAantVgm193E1T1cmNpD0FKAKkDdPs64rKBEwFiHxccXHbah
-eMd1weVwn3AKFD6uAm8ZRMV+dyssfcQxqpo/kfT1XpA6cQeOmGDOcKBfdwARAQAB
-tCNBV1MgSlNJSSBUZWFtIDxhd3MtanNpaUBhbWF6b24uY29tPokCPwQTAQIAKQUC
-YsSA6QIbLwUJB4TOAAcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJEAVsThXa
-49jZjU4QANoyqOJUT4gRrXshE3N0mW5Ad4i8Ke09GA62HyvTtfbsA+2nkNVGJpXm
-sFMzdaFO95Q65RkLS9vW4nhhjXBEc2XYNCt2AnARudA/41ykjDPwU112z9ZTB9he
-y4ItIeNGpHvMWr51fihl0y2nkpODOBeiv44jscLbHyOmZfki1f5fuIu2U2IbUGK3
-5FtYyeHcgRHnpYkzLuzK4PfayOywqQPJ7M9DWrHf+v5Cu4ZCZDOIKfzF+ew7MWwc
-6KaoWHCYbFpX8jxFppbGsSFOQ8Sl2quoP0TLz9Wsq70Khi6C2P8JI6lm0HRLO+1M
-jFbQxNOwAcN3k4HSwunAjXBlmT/6oc1RsdBdpXBaZ2AWseIXwSYZqNXp+5L179uZ
-vSiD3DSSUqLJbdQRVOsJi3/87V5QU59byq2dToHveRjtSbVnK0TkTx9ZlgkcpjvM
-BwHNqWhratV6af2Upjq2YQ0fdSB42f3pgopInxNJPMvlAb+cCfr0Pfwu7ge7UooQ
-WHTxbpCvwtn/HNctMGpWscO02WsWgoYVjnVFay/XphE77pQ9rRUkhMe6VKXfxj/n
-OCZJKrydluIIwR8vvONNqO+QwZ1xDEhO7MaSZlOm1AuUZIXFPgaWQkPZHKiiwFA/
-QWnL/+shuRtMH2geTjkev198Jgb5HyXFm4SyYtZferQROyliEhik
-=BuGv
------END PGP PUBLIC KEY BLOCK-----
-----
-
-[#pgp-keys-expired]
-== Historical keys
-
-These keys may be used to validate releases of the {aws} CDK and jsii before 2022-07-05.
-
-[IMPORTANT]
-====
-
-New keys are created before the previous ones expire. As a result, at any given moment in time, more than one key may be valid. Keys are used to sign artifacts starting the day they are created, so use the more recently-issued key where keys' validity overlaps.
-
-====
-
-[#cdk-pgp-key-2022-04-07]
-=== {aws} CDK OpenPGP key (2022-04-07)
-
-[NOTE]
-====
-
-This key was not used to sign {aws} CDK artifacts after 2022-07-05.
-
-====
-
-[cols="1,1"]
-|===
-
-|Key ID:
-|0x015584281F44A3C3
-
-|Type:
-|RSA
-
-|Size:
-|4096/4096
-
-|Created:
-|2022-04-07
-
-|Expires:
-|2026-04-06
-
-|User ID:
-|{aws} Cloud Development Kit
-
-|Key fingerprint:
-|EAE1 1A24 82B0 AA86 456E 6C67 0155 8428 1F44 A3C3
-|===
-
-Select the "Copy" icon to copy the following OpenPGP key:
-
-[source,none,subs="verbatim,attributes"]
-----
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQINBGJPLgUBEADtlR5jQtxtBmROQvmWlPOViqqnJNhk0dULc3tXnq8NS/l6X81r
-wHk+/CHG5kBunwvM0qaqLFRC6z9NnnNDxEHcTi47n+OAjWyDM6unxxWOPz8Dfaps
-Uq/ZWa4by292ZeqRC9Ir2wdrizb69JbRjeshBwlJDAS/qtqCAqBRH/f7Zw7QSD6/
-XTxyIy+KOVjZwFPFNHMRQ/NmgUc/Rfxsa0pUjk1YAj/AkvQlwwD8DEnASoBhO0DP
-QonZxouLqIpgp4LsGo8TZdQv30ocIj0C9DuYUiUXWlCPlYPgDj6IWf3rgpMQ6nB9
-wC9lx4t/L3Zg1HUD52y8aymndmbdHVn90mzlNg4XWyc58rioYrEk57YwbDnea/Kk
-Hv4kVHZRfJ4/OFPyqs5ex1X3X6rb07VvA1tfLgPywO9XF2Xws8YWOWcEobaWTcnb
-AzyVC6wKya8rEQzxkYJ6UkJlhDB6g6bZwIpsI2zlimG+kSBsyFvE2oRYMS0cXPqU
-o+tX0+4TvxEyW3RrUQzQHIpqXrb0X1Q8Z2idPn5dwsipDEa4gsFXtrSXmbB/0Cee
-eJVvKWQAsxol3+NE9L/yozq3cz5PWh0SSbmCLRcs78lMJ23MmzbMWV7BWC9DXdY+
-TywY5IkDUPjGCKlD8VlrI3TgC222bH6qaua6LYCiTtRtvpDYuJNAlUjhawARAQAB
-tC5BV1MgQ2xvdWQgRGV2ZWxvcG1lbnQgS2l0IDxhd3MtY2RrQGFtYXpvbi5jb20+
-iQI/BBMBAgApBQJiTy4FAhsvBQkHhM4ABwsJCAcDAgEGFQgCCQoLBBYCAwECHgEC
-F4AACgkQAVWEKB9Eo8NpbxAAiBF0kR/lVw3vuam60mk4l0iGMVsP8Xq6g/buzbEO
-2MEB4Ftk04qOnoa+93S0ZiLR9PqxrwsGSp4ADDX3Vtc4uxwzUlKUi1ywEhQ1cwyL
-YHQI3Hd75K1J81ozMEu6qJH+yF0TtTDZMeZHtH/XvuIYJW3Lx4o5ZFlsEegFPAgX
-YCCpUS+k9qC6M8g2VjcltQJpyjGswsKm6FWaKHW+B9dfjdOHlImB9E2jaknJ8eoY
-zb9zHgFANluMzpZ6rYVSiCuXiEgYmazQWCvlPcMOP7nX+1hq1z11LMqeSnfE09gX
-H+OYho9cMEJkb1dzx1H9MRpylFIn9tL+2iCp4UPJjnqi6uawWyLZ2tp4G11haqQq
-1yAh69u233I8GZKFUySzjHwH5qWGRgBTjrZ6FdcjSS2w/wMkVKuCPkWtdvo/TJrm
-msCd1Reye8SEKYqrs0ujTwmlvWmUZmO06AdUjo1kWiBKeslTJrWEuG7Yk4pFOoA4
-dsaq83gxpOJNVCh6M3y4DLNrvl7dhF95NwTWMROPj2otw7NIjF4/cdzve2+P7YNN
-pVAtyCtTJdD3eZbQPVaL3T8cf1VGqt6++pnLGnWJ0+X3TyvfmTohdJvN3TE+tq7A
-7cprDX/q9c56HaXdJzVpxEzuf/YC+JuYKeHwsX3QouDhyRg3PsigdZES/02Wr8so
-l6U=
-=MQI4
------END PGP PUBLIC KEY BLOCK-----
-----
-
-
-[#jsii-pgp-key-2022-04-07]
-=== jsii OpenPGP key (2022-04-07)
-
-[NOTE]
-====
-
-This key was not used to sign jsii artifacts after 2022-07-05.
-
-====
-
-[cols="1,1"]
-|===
-
-|Key ID:
-|0x985F5BC974B79356
-
-|Type:
-|RSA
-
-|Size:
-|4096/4096
-
-|Created:
-|2022-04-07
-
-|Expires:
-|2026-04-06
-
-|User ID:
-|{aws} JSII Team
-
-|Key fingerprint:
-|35A7 1785 8FA6 282D C5AC CD95 985F 5BC9 74B7 9356
-|===
-
-Select the "Copy" icon to copy the following OpenPGP key:
-
-[source,none,subs="verbatim,attributes"]
-----
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQINBGJPLewBEADHH4TXup/gOlHrKDZRbj8MvsMTdM6eDteA6/c32UYV/YsK9rDA
-jN8Jv/xlfosOebcHrfnFpHF9VTkmjuOpN695XdwMrW/NvlEPISTGEJf21x6ZTQ2r
-1xWFYzC3sl3FZmvj9XAXTmygdv+XM3TqsFgZeCaBkZVdiLbQf+FhYrovUlgotb5D
-YiCQI3ofV5QTE+141jhO5Pkd3ZIoBG+P826LaT8NXhwS0o1XqVk39DCZNoFshNmR
-WFZpkVCTHyv5ZhVey1NWXnD8opO375htGNV4AeSmSIH9YkURD1g5F+2t7RiosKFo
-kJrfPmUjhHn8IFpReGc8qmMMZX0WaV3t+VAWfOHGGyrXDfQ4xz1VCot75C2+qypM
-+qhwOAOOP0zA7CfI96ULZzSH/j8HuQk3O0DsUCybpMuKEazEMxP3tgGtRerwDaFG
-jQvAlK8Rbq3v8buBI6YJuXTwSzJE8KLjleUiTFumE6WP4rsAvlP/5rBvubeMfa3n
-NIMm5Rkl36Z+jt3e2Z2ZqWDPpBRta8m7QHccrZhkvqu3YC3Gl6kdnm4Vio3Xfpg2
-qtWhIQutQ6DmItewV+weQHas3hl88RPJtSrfWWIIMkpbF7Y4vbX9xcnsYCLlp2Mz
-tWbbnU+EWATNSsufml/Kdnu9iEEuLmeovE11I69nwjNOq9P+GJ3r/FUb2wARAQAB
-tCNBV1MgSlNJSSBUZWFtIDxhd3MtanNpaUBhbWF6b24uY29tPokCPwQTAQIAKQUC
-Yk8t7AIbLwUJB4TOAAcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJEJhfW8l0
-t5NWo64P/2y7gcMRylLLW/wbrCjton2O4+YRocwQxKm1cBml9FVDUR5967YczNuu
-EwEOfH/Pu3UAlrBfKAfxPNhKchLwYiOBNh2Wk5UUxRcldNHTLb5jn5gxCeWNAsl/
-Tc46qY+ObdBMdOf2Vu33UCOg83WLbg1bfBoA8Bm1cd0XObtLGucu606EBt1dBrKq
-9UTcbJfuGivY2Xjy5r4kEiMHBoLKcFrSo2Mm7VtYlE4Mabjyj9+orqUio7qxOl60
-aa7Psa6rMvs1Ip9IOrAdG7o5Y29tQpeINH0R1/u47BrlTEAgG63Dfy49w2h/1g0G
-c9KPXVuN55OWRIu0hsiySDMk/2ERsF348TU3NURZltnCOxp6pHlbPJIxRVTNa9Cn
-f8tbLB3y3HfA80516g+qwNYIYiqksDdV2bz+VbvmCWcO+FellDZli831gyMGa5JJ
-rq7d0lEr6nqjcnKiVwItTQXyFYmKTAXweQtVC72g1sd3oZIyqa7T8pvhWpKXxoJV
-WP+OPBhGg/JEVC9sguhuv53tzVwayrNwb54JxJsD2nemfhQm1Wyvb2bPTEaJ3mrv
-mhPUvXZj/I9rgsEq3L/sm2Xjy09nra4o3oe3bhEL8nOj11wkIodi17VaGP0y+H3s
-I5zB5UztS6dy+cH+J7DoRaxzVzq7qtH/ZY2quClt30wwqDHUX1ef
-=+iYX
------END PGP PUBLIC KEY BLOCK-----
-----
-
-[#cdk-pgp-key-2018-06-19]
-=== {aws} CDK OpenPGP key (2018-06-19)
-
-[cols="1,1"]
-|===
-
-|Key ID:
-|0x0566A784E17F3870
-
-|Type:
-|RSA
-
-|Size:
-|4096/4096
-
-|Created:
-|2018-06-19
-
-|Expires:
-|2022-06-18
-
-|User ID:
-|{aws} CDK Team
-
-|Key fingerprint:
-|E88B E3B6 F0B1 E350 9E36 4F96 0566 A784 E17F 3870
-|===
-
-Select the "Copy" icon to copy the following OpenPGP key:
-
-[source,none,subs="verbatim,attributes"]
-----
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQINBFsovE8BEADEFVCHeAVPvoQgsjVu9FPUczxy9P+2zGIT/MLI3/vPLiULQwRy
-IN2oxyBNDtcDToNa/fTkW3Ev0NTP4V1h+uBoKDZD/p+dTmSDRfByECMI0sGZ3UsG
-Ohhyl2Of44s0sL8gdLtDnqSRLf+ZrfT3gpgUnplW7VitkwLxr78jDpW4QD8p8dZ9
-WNm3JgB55jyPgaJKqA1Ln4Vduni/1XkrG42nxrrU71uUdZPvPZ2ELLJa6n0/raG8
-jq3le+xQh45gAIs6PGaAgy7jAsfbwkGTBHjjujITAY1DwvQH5iS31OaCM9n4JNpc
-xGZeJAVYTLilznf2QtS/a50t+ZOmpq67Ssp2j6qYpiumm0Lo9q3K/R4/yF0FZ8SL
-1TuNX0ecXEptiMVUfTiqrLsANg18EPtLZZOYW+ZkbcVytkDpiqj7bMwA7mI7zGCJ
-1gjaTbcEmOmVdQYS1G6ZptwbTtvrgA6AfnZxX1HUxLRQ7tT/wvRtABfbQKAh85Ff
-a3U9W4oC3c1MP5IyhNV1Wo8Zm0flZiZc0iZnojTtSG6UbcxNNL4Q8e08FWjhungj
-yxSsIBnQO1Aeo1N4BbzlI+n9iaXVDUN7Kz1QEyS4PNpjvUyrUiQ+a9C5sRA7WP+x
-IEOaBBGpoAXB3oLsdTNO6AcwcDd9+r2NlXlhWC4/uH2YHQUIegPqHmPWxwARAQAB
-tCFBV1MgQ0RLIFRlYW0gPGF3cy1jZGtAYW1hem9uLmNvbT6JAj8EEwEIACkFAlso
-vE8CGy8FCQeEzgAHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRAFZqeE4X84
-cLGxD/0XHnhoR2xvz38GM8HQlwlZy9W1wVhQKmNDQUavw8Zx7+iRR3m7nq3xM7Qq
-BDbcbKSg1lVLSBQ6H2V6vRpysOhkPSH1nN2dO8DtvSKIPcxK48+1x7lmO+ksSs/+
-oo1UvOmTDaRzOitYh3kOGXHHXk/l11GtF2FGQzYssX5iM4PHcjBsK1unThs56IMh
-OJeZezEYzBaskTu/ytRJ236bPP2kZIEXfzAvhmTytuXWUXEftxOxc6fIAcYiKTha
-aofG7WyR+Fvb1j5gNLcbY552QMxa23NZd5cSZH7468WEW1SGJ3AdLA7k5xvsPPOC
-2YvQFD+vUOZ1JJuu6B5rHkiEMhRTLklkvqXEShTxuXiCp7iTOo6TBCmrWAT4eQr7
-htLmqlXrgKi8qPkWmRdXXG+MQBzI/UyZq2q8KC6cx2md1PhANmeefhiM7FZZfeNM
-WLonWfh8gVCsNH5h8WJ9fxsQCADd3Xxx3NelS2zDYBPRoaqZEEBbgUP6LnWFprA2
-EkSlc/RoDqZCpBGgcoy1FFWvV/ZLgNU6OTQlYH6oYOWiylSJnaTDyurrktsxJI6d
-4gdsFb6tqwTGecuUPvvZaEuvhWExLxAebhu780FdAPXgVTX+YCLI2zf+dWQvkFQf
-80RE7ayn7BsiaLzFBVux/zz/WgvudsZX18r8tDiVQBL51ORmqw==
-=0wuQ
------END PGP PUBLIC KEY BLOCK-----
-----
-
-[#jsii-pgp-key-2018-08-06]
-=== jsii OpenPGP key (2018-08-06)
-
-[cols="1,1"]
-|===
-
-|Key ID:
-|0x1C7ACE4CB2A1B93A
-
-|Type:
-|RSA
-
-|Size:
-|4096/4096
-
-|Created:
-|2018-08-06
-
-|Expires:
-|2022-08-05
-
-|User ID:
-|{aws} JSII Team
-
-|Key fingerprint:
-|85EF 6522 4CE2 1E8C 72DB 28EC 1C7A CE4C B2A1 B93A
-|===
-
-Select the "Copy" icon to copy the following OpenPGP key:
-
-[source,none,subs="verbatim,attributes"]
-----
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQINBFtoSs0BEAD6WweLD0B26h0F7Jo9iR6tVQ4PgQBK1Va5H/eP+A2Iqw79UyxZ
-WNzHYhzQ5MjYYI1SgcPavXy5/LV1N8HJ7QzyKszybnLYpNTLPYArWE8ZM9ZmjvIR
-p1GzwnVBGQfoOlxyeutE9T5ZkAn45dTS5jlno4unji4gHjnwXKf2nP1APU2CZfdK
-8vDpLOgj9LeeGlerYNbx+7xtY/I+csFIQvK09FPLSNMJQLlkBhY0r6Rt9ZQG+653
-tJn+AUjyM237w0UIX1IqyYc5IONXu8HklPGu0NYuX9AY/63Ak2Cyfj0w/PZlvueQ
-noQNM3j0nkOEsTOEXCyaLQw9iBKpxvLnm5RjMSODDCkj8c9uu0LHr7J4EOtgt2S1
-pem7Y/c/N+/Z+Ksg9fP8fVTfYwRPvdI1x2sCiRDfLoQSG9tdrN5VwPFi4sGV04sI
-x7Al8Vf/OBjAGZrDaJgM/gVvb9SKAQUA6t3ofeP14gDrS0eYodEXZ+lamnxFglxF
-Sn8NRC4JFNmkXSUaTNGUdFf//F0D69PRNT8CnFfmniGj0CphN5037PCA2LC/Buq2
-3+K6mTPkCcCHYPC/SwItp/xIDAQsGuDc1i1SfDYXrjsK7uOuwC5jLA9X6wZ/jgXQ
-4umRRJBAV1aW8b1+yfaYYCO2AfXXO6caObv8IvH7Pc4leC2DoqylD3KklQARAQAB
-tCNBV1MgSlNJSSBUZWFtIDxhd3MtanNpaUBhbWF6b24uY29tPokCPwQTAQgAKQUC
-W2hKzQIbLwUJB4TOAAcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJEBx6zkyy
-obk6B34P/iNb5QjKyhT0glZiq1wK7tuDDRpR6fC/sp6Jd/GhaNjO4BzlDbUPSjW5
-950VT+qwaHXbIma/QVP7EIRztfwWy7m8eOodjpiu7JyJprhwG9nocXiNsLADcMoH
-BvabkDRWXWIWSurq2wbcFMlTVwxjHPIQs6kt2oojpzP985CDS/KTzyjow6/gfMim
-DLdhSSbDUM34STEgew79L2sQzL7cvM/N59k+AGyEMHZDXHkEw/Bge5Ovz50YOnsp
-lisH4BzPRIw7uWqPlkVPzJKwMuo2WvMjDfgbYLbyjfvs5mqDxT2GTwAx/rd2taU6
-iSqP0QmLM54BtTVVdoVXZSmJyTmXAAGlITq8ECZ/coUW9K2pUSgVuWyu63lktFP6
-MyCQYRmXPh9aSd4+ielteXM9Y39snlyLgEJBhMxioZXVO2oszwluPuhPoAp4ekwj
-/umVsBf6As6PoAchg7Qzr+lRZGmV9YTJOgDn2Z7jf/7tOes0g/mdiXTQMSGtp/Fp
-ggnifTBx3iXkrQhqHlwtam8XTHGHy3MvX17ZslNuB8Pjh+07hhCxv0VUVZPUHJqJ
-ZsLa398LMteQ8UMxwJ3t06jwDWAd7mbr2tatIilLHtWWBFoCwBh1XLe/03ENCpDp
-njZ7OsBsBK2nVVcN0H2v5ey0T1yE93o6r7xOwCwBiVp5skTCRUob
-=2Tag
------END PGP PUBLIC KEY BLOCK-----
-----
\ No newline at end of file
diff --git a/v2/guide/policy-validation-synthesis.adoc b/v2/guide/policy-validation-synthesis.adoc
deleted file mode 100644
index 4d11c9d5..00000000
--- a/v2/guide/policy-validation-synthesis.adoc
+++ /dev/null
@@ -1,186 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#policy-validation-synthesis]
-= {aws} CDK policy validation at synthesis time
-:info_titleabbrev: Policy validation
-:keywords: cdk, policy, validation
-
-[abstract]
---
-By using the appropriate policy validation plugin, you can make the {aws} CDK application check the generated {aws} CloudFormation template against your policies immediately after synthesis.
---
-
-// Content start
-
-[#policy-validation]
-== Policy validation at synthesis time
-
-If you or your organization use any policy validation tool, such as https://docs.aws.amazon.com/cfn-guard/latest/ug/what-is-guard.html[{aws} CloudFormation Guard] or https://www.openpolicyagent.org/[OPA], to define constraints on your {aws} CloudFormation template, you can integrate them with the {aws} CDK at synthesis time. By using the appropriate policy validation plugin, you can make the {aws} CDK application check the generated {aws} CloudFormation template against your policies immediately after synthesis. If there are any violations, the synthesis will fail and a report will be printed to the console.
-
-The validation performed by the {aws} CDK at synthesis time validate controls at one point in the deployment lifecycle, but they can't affect actions that occur outside synthesis. Examples include actions taken directly in the console or via service APIs. They aren't resistant to alteration of {aws} CloudFormation templates after synthesis. Some other mechanism to validate the same rule set more authoritatively should be set up independently, like https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/hooks.html[{aws} CloudFormation hooks] or https://docs.aws.amazon.com/config/latest/developerguide/WhatIsConfig.html[{aws} Config]. Nevertheless, the ability of the {aws} CDK to evaluate the rule set during development is still useful as it will improve detection speed and developer productivity.
-
-The goal of {aws} CDK policy validation is to minimize the amount of set up needed during development, and make it as easy as possible.
-
-[NOTE]
-====
-
-This feature is considered experimental, and both the plugin API and the format of the validation report are subject to change in the future.
-
-====
-
-[#for-application-developers]
-== For application developers
-
-To use one or more validation plugins in your application, use the `policyValidationBeta1` property of `Stage`:
-
-[source,javascript,subs="verbatim,attributes"]
-----
-import { CfnGuardValidator } from '@cdklabs/cdk-validator-cfnguard';
-const app = new App({
- policyValidationBeta1: [
- new CfnGuardValidator()
- ],
-});
-// only apply to a particular stage
-const prodStage = new Stage(app, 'ProdStage', {
- policyValidationBeta1: [...],
-});
-----
-
-Immediately after synthesis, all plugins registered this way will be invoked to validate all the templates generated in the scope you defined. In particular, if you register the templates in the `App` object, all templates will be subject to validation.
-
-[WARNING]
-====
-
-Other than modifying the cloud assembly, plugins can do anything that your {aws} CDK application can. They can read data from the filesystem, access the network etc. It's your responsibility as the consumer of a plugin to verify that it's secure to use.
-
-====
-
-[#cfnguard-plugin]
-=== {aws} CloudFormation Guard plugin
-
-Using the link:https://github.com/cdklabs/cdk-validator-cfnguard[`CfnGuardValidator`] plugin allows you to use https://github.com/aws-cloudformation/cloudformation-guard[{aws} CloudFormation Guard] to perform policy validations. The `CfnGuardValidator` plugin comes with a select set of https://docs.aws.amazon.com/controltower/latest/userguide/proactive-controls.html[{aws} Control Tower proactive controls] built in. The current set of rules can be found in the https://github.com/cdklabs/cdk-validator-cfnguard/blob/main/README.md[project documentation]. As mentioned in xref:policy-validation[Policy validation at synthesis time], we recommend that organizations set up a more authoritative method of validation using https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/hooks.html[{aws} CloudFormation hooks].
-
-For link:https://docs.aws.amazon.com/controltower/latest/userguide/what-is-control-tower.html[{aws} Control Tower] customers, these same proactive controls can be deployed across your organization. When you enable {aws} Control Tower proactive controls in your {aws} Control Tower environment, the controls can stop the deployment of non-compliant resources deployed via {aws} CloudFormation. For more information about managed proactive controls and how they work, see the https://docs.aws.amazon.com/controltower/latest/userguide/proactive-controls.html[{aws} Control Tower documentation].
-
-These {aws} CDK bundled controls and managed {aws} Control Tower proactive controls are best used together. In this scenario you can configure this validation plugin with the same proactive controls that are active in your {aws} Control Tower cloud environment. You can then quickly gain confidence that your {aws} CDK application will pass the {aws} Control Tower controls by running `cdk synth` locally.
-
-[#validation-report]
-=== Validation Report
-
-When you synthesize the {aws} CDK app the validator plugins will be called and the results will be printed. An example report is showing below.
-
-[source,none,subs="verbatim,attributes"]
-----
-Validation Report (CfnGuardValidator)
--------------------------------------
-(Summary)
-╔═══════════╤════════════════════════╗
-║ Status │ failure ║
-╟───────────┼────────────────────────╢
-║ Plugin │ CfnGuardValidator ║
-╚═══════════╧════════════════════════╝
-(Violations)
-Ensure S3 Buckets are encrypted with a KMS CMK (1 occurrences)
-Severity: medium
- Occurrences:
-
- - Construct Path: MyStack/MyCustomL3Construct/Bucket
- - Stack Template Path: ./cdk.out/MyStack.template.json
- - Creation Stack:
- └── MyStack (MyStack)
- │ Library: aws-cdk-lib.Stack
- │ Library Version: 2.50.0
- │ Location: Object. (/home/johndoe/tmp/cdk-tmp-app/src/main.ts:25:20)
- └── MyCustomL3Construct (MyStack/MyCustomL3Construct)
- │ Library: N/A - (Local Construct)
- │ Library Version: N/A
- │ Location: new MyStack (/home/johndoe/tmp/cdk-tmp-app/src/main.ts:15:20)
- └── Bucket (MyStack/MyCustomL3Construct/Bucket)
- │ Library: aws-cdk-lib/aws-s3.Bucket
- │ Library Version: 2.50.0
- │ Location: new MyCustomL3Construct (/home/johndoe/tmp/cdk-tmp-app/src/main.ts:9:20)
- - Resource Name: amzn-s3-demo-bucket
- - Locations:
- > BucketEncryption/ServerSideEncryptionConfiguration/0/ServerSideEncryptionByDefault/SSEAlgorithm
- Recommendation: Missing value for key `SSEAlgorithm` - must specify `aws:kms`
- How to fix:
- > Add to construct properties for `cdk-app/MyStack/Bucket`
- `encryption: BucketEncryption.KMS`
-
-Validation failed. See above reports for details
-----
-
-By default, the report will be printed in a human readable format. If you want a report in JSON format, enable it using the `@aws-cdk/core:validationReportJson` via the CLI or passing it directly to the application:
-
-[source,javascript,subs="verbatim,attributes"]
-----
-const app = new App({
- context: { '@aws-cdk/core:validationReportJson': true },
-});
-----
-
-Alternatively, you can set this context key-value pair using the `cdk.json` or `cdk.context.json` files in your project directory (see xref:context[Context values and the {aws} CDK]).
-
-If you choose the JSON format, the {aws} CDK will print the policy validation report to a file called `policy-validation-report.json` in the cloud assembly directory. For the default, human-readable format, the report will be printed to the standard output.
-
-[#plugin-authors]
-== For plugin authors
-
-[#plugins]
-=== Plugins
-
-The {aws} CDK core framework is responsible for registering and invoking plugins and then displaying the formatted validation report. The responsibility of the plugin is to act as the translation layer between the {aws} CDK framework and the policy validation tool. A plugin can be created in any language supported by {aws} CDK. If you are creating a plugin that might be consumed by multiple languages then it's recommended that you create the plugin in `TypeScript` so that you can use JSII to publish the plugin in each {aws} CDK language.
-
-[#creating-plugins]
-=== Creating plugins
-
-The communication protocol between the {aws} CDK core module and your policy tool is defined by the `IPolicyValidationPluginBeta1` interface. To create a new plugin you must write a class that implements this interface. There are two things you need to implement: the plugin name (by overriding the `name` property), and the `validate()` method.
-
-The framework will call `validate()`, passing an `IValidationContextBeta1` object. The location of the templates to be validated is given by `templatePaths`. The plugin should return an instance of `ValidationPluginReportBeta1`. This object represents the report that the user wil receive at the end of the synthesis.
-
-[source,javascript,subs="verbatim,attributes"]
-----
-validate(context: IPolicyValidationContextBeta1): PolicyValidationReportBeta1 {
- // First read the templates using context.templatePaths...
- // ...then perform the validation, and then compose and return the report.
- // Using hard-coded values here for better clarity:
- return {
- success: false,
- violations: [{
- ruleName: 'CKV_AWS_117',
- description: 'Ensure that {aws} Lambda function is configured inside a VPC',
- fix: 'https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1',
- violatingResources: [{
- resourceName: 'MyFunction3BAA72D1',
- templatePath: '/home/johndoe/myapp/cdk.out/MyService.template.json',
- locations: 'Properties/VpcConfig',
- }],
- }],
- };
-}
-----
-
-Note that plugins aren't allowed to modify anything in the cloud assembly. Any attempt to do so will result in synthesis failure.
-
-If your plugin depends on an external tool, keep in mind that some developers may not have that tool installed in their workstations yet. To minimize friction, we highly recommend that you provide some installation script along with your plugin package, to automate the whole process. Better yet, run that script as part of the installation of your package. With `npm`, for example, you can add it to the `postinstall` link:https://docs.npmjs.com/cli/v9/using-npm/scripts[script] in the `package.json` file.
-
-[#handling-exemptions]
-=== Handling Exemptions
-
-If your organization has a mechanism for handling exemptions, it can be implemented as part of the validator plugin.
-
-An example scenario to illustrate a possible exemption mechanism:
-
-* An organization has a rule that public Amazon S3 buckets aren't allowed, _except_ for under certain scenarios.
-* A developer is creating an Amazon S3 bucket that falls under one of those scenarios and requests an exemption (create a ticket for example).
-* Security tooling knows how to read from the internal system that registers exemptions
-
-In this scenario the developer would request an exception in the internal system and then will need some way of "registering" that exception. Adding on to the guard plugin example, you could create a plugin that handles exemptions by filtering out the violations that have a matching exemption in an internal ticketing system.
-
-See the existing plugins for example implementations.
-
-* https://github.com/cdklabs/cdk-validator-cfnguard[@cdklabs/cdk-validator-cfnguard]
\ No newline at end of file
diff --git a/v2/guide/prerequisites.adoc b/v2/guide/prerequisites.adoc
deleted file mode 100644
index f2c63734..00000000
--- a/v2/guide/prerequisites.adoc
+++ /dev/null
@@ -1,97 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#prerequisites]
-= {aws} CDK prerequisites
-:info_titleabbrev: Prerequisites
-:keywords: {aws} CDK, Prerequisites, {aws} account, IAM, IAM Identity Center
-
-[abstract]
---
-Complete prerequisites before getting started with the {aws} Cloud Development Kit ({aws} CDK).
---
-
-// Content start
-
-Complete all prerequisites before getting started with the {aws} Cloud Development Kit ({aws} CDK).
-
-[#prerequisites-account]
-== Set up your {aws} account
-
-If you or your organization are new to {aws}, you must set up your {aws} account. This includes signing up for an {aws} account, securing your root user, determining your method of managing users, and creating an administrative user. To manage users, you can use {aws} Identity and Access Management (IAM) or {aws} IAM Identity Center. We recommend that you use IAM Identity Center. For more information, see the following:
-
-* https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html[What is IAM?] in the _IAM User Guide_.
-* https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html[What is IAM Identity Center?] in the _{aws} IAM Identity Center User Guide_.
-
-After setting up an {aws} account, you should have an administrative user and the ability to create and manage additional users using IAM or IAM Identity Center.
-
-Before moving forward, we recommend that you take time to learn the recommended best practices in {aws} Identity and Access Management. For more information, see https://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPracticesAndUseCases.html[Security best practices and use cases in {aws} Identity and Access Management] in the _IAM User Guide_.
-
-[#prerequisites-cli]
-== Install and configure the {aws} CLI
-
-When you develop {aws} CDK applications on your local machine, you will use the {aws} Cloud Development Kit ({aws} CDK) Command Line Interface (CLI) to interact with {aws}, such as deploying applications to provision your {aws} resources. To interact with {aws} outside of the {aws} Management Console, you must configure security credentials on your local machine. To do this, we recommend that you install and use the {aws} Command Line Interface ({aws} CLI).
-
-For instructions on installing the {aws} CLI, see https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html[Install or update to the latest version of the {aws} CLI] in the _{aws} Command Line Interface User Guide_.
-
-How you configure security credentials will depend on how you or your organization manages users. For instructions, see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-authentication.html[Authentication and access credentials] in the _{aws} Command Line Interface User Guide_.
-
-After installing and configuring the {aws} CLI, you should have the following:
-
-* The {aws} CLI installed on your local machine.
-* Credentials configured in a `config` on your local machine using the {aws} CLI.
-
-[#prerequisites-node]
-== Install [.noloc]`Node.js` and programming language prerequisites
-
-All {aws} CDK developers, regardless of the supported programming language that you will use, require https://nodejs.org/en/download/[Node.js] 14.15.0 or later. All supported programming languages use the same backend, which runs on [.noloc]`Node.js`. We recommend a version in https://nodejs.org/en/about/releases/[active long-term support]. If your organization has a different recommendation, follow their guidance.
-
-[IMPORTANT]
-====
-
-Node.js versions 13.0.0 through 13.6.0 are not compatible with the {aws} CDK due to compatibility issues with its dependencies.
-
-====
-
-Other programming language prerequisites depend on the language that you will use to develop {aws} CDK applications:
-
-====
-[role="tablist"]
-TypeScript::
-* TypeScript 3.8 or later (`npm -g install typescript`)
-
-JavaScript::
-* No additional requirements
-
-Python::
-* Python 3.7 or later including `pip` and `virtualenv`
-
-Java::
-* Java Development Kit (JDK) 8 (a.k.a. 1.8) or later
-* Apache Maven 3.5 or later
-+
-Java IDE recommended (we use [.noloc]`Eclipse`` in some examples in this guide). IDE must be able to import Maven projects. Check to make sure that your project is set to use Java 1.8. Set the JAVA_HOME environment variable to the path where you have installed the JDK.
-
-C#::
-.NET Core 3.1 or later, or .NET 6.0 or later.
-+
-Visual Studio 2019 (any edition) or Visual Studio Code recommended.
-
-Go::
-Go 1.1.8 or later.
-
-====
-
-[NOTE]
-.Third-party language deprecation
-====
-
-Each language version is only supported until it is [.noloc]`EOL` (End Of Life) and is subject to change with prior notice.
-
-====
-
-[#prerequisites-next]
-== Next steps
-
-To get started with the {aws} CDK, see xref:getting-started[Getting started with the {aws} CDK].
\ No newline at end of file
diff --git a/v2/guide/projects.adoc b/v2/guide/projects.adoc
deleted file mode 100644
index 02fcb993..00000000
--- a/v2/guide/projects.adoc
+++ /dev/null
@@ -1,554 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-:info_titleabbrev: Projects
-:keywords: {aws} CDK, {aws} CloudFormation, IaC, Infrastructure as code, CDK projects, {aws} CDK concepts
-
-[[projects,projects.title]]
-= {aws} CDK projects
-
-[abstract]
---
-An {aws} Cloud Development Kit ({aws} CDK) project represents the files and folders that contain your CDK code. Contents will vary based on your programming language.
---
-
-// Content start
-
-An {aws} Cloud Development Kit ({aws} CDK) project represents the files and folders that contain your CDK code. Contents will vary based on your programming language.
-
-You can create your {aws} CDK project manually or with the {aws} CDK Command Line Interface ({aws} CDK CLI) `cdk init` command. In this topic, we will refer to the project structure and naming conventions of files and folders created by the {aws} CDK CLI. You can customize and organize your CDK projects to fit your needs.
-
-[NOTE]
-====
-
-Project structure created by the {aws} CDK CLI may vary across versions over time.
-
-====
-
-[#projects-universal]
-== Universal files and folders
-
-[[projects-universal-git]]
-`.git`:: If you have `git` installed, the {aws} CDK CLI automatically initializes a [.noloc]`Git` repository for your project. The `.git` directory contains information about the repository.
-
-[[projects-universal-gitignore]]
-`.gitignore`:: Text file used by [.noloc]``Git`` to specify files and folders to ignore.
-
-[[projects-universal-readme]]
-`README.md`:: Text file that provides you with basic guidance and important information for managing your {aws} CDK project. Modify this file as necessary to document important information regarding your CDK project.
-
-[[projects-universal-cdk]]
-`cdk.json`:: Configuration file for the {aws} CDK. This file provides instruction to the {aws} CDK CLI regarding how to run your app.
-
-[#projects-specific]
-== Language-specific files and folders
-
-The following files and folders are unique to each supported programming language.
-
-====
-[role="tablist"]
-TypeScript::
-The following is an example project created in the `my-cdk-ts-project` directory using the `cdk init --language typescript` command:
-+
-[source,none,subs="verbatim,attributes"]
-----
-my-cdk-ts-project
-├── .git
-├── .gitignore
-├── .npmignore
-├── README.md
-├── bin
-│ └── my-cdk-ts-project.ts
-├── cdk.json
-├── jest.config.js
-├── lib
-│ └── my-cdk-ts-project-stack.ts
-├── node_modules
-├── package-lock.json
-├── package.json
-├── test
-│ └── my-cdk-ts-project.test.ts
-└── tsconfig.json
-----
-
-`.npmignore`::: File that specifies which files and folders to ignore when publishing a package to the `npm` registry. This file is similar to `.gitignore`, but is specific to `npm` packages.
-
-`bin/my-cdk-ts-project.ts`::: The _application file_ defines your CDK app. CDK projects can contain one or more application files. Application files are stored in the `bin` folder.
-+
-The following is an example of a basic application file that defines a CDK app:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-import 'source-map-support/register';
-import * as cdk from 'aws-cdk-lib';
-import { MyCdkTsProjectStack } from '../lib/my-cdk-ts-project-stack';
-
-const app = new cdk.App();
-new MyCdkTsProjectStack(app, 'MyCdkTsProjectStack');
-----
-
-`jest.config.js`::: Configuration file for [.noloc]`Jest`. [.noloc]_Jest_ is a popular JavaScript testing framework.
-
-`lib/my-cdk-ts-project-stack.ts`::: The _stack file_ defines your CDK stack. Within your stack, you define {aws} resources and properties using constructs.
-+
-The following is an example of a basic stack file that defines a CDK stack:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-import * as cdk from 'aws-cdk-lib';
-import { Construct } from 'constructs';
-
-export class MyCdkTsProjectStack extends cdk.Stack {
- constructor(scope: Construct, id: string, props?: cdk.StackProps) {
- super(scope, id, props);
-
- // code that defines your resources and properties go here
- }
-}
-----
-
-`node_modules`::: Common folder in [.noloc]`Node.js` projects that contain dependencies for your project.
-
-`package-lock.json`::: Metadata file that works with the `package.json` file to manage versions of dependencies.
-
-`package.json`::: Metadata file that is commonly used in [.noloc]`Node.js` projects. This file contains information about your CDK project such as the project name, script definitions, dependencies, and other import project-level information.
-
-`test/my-cdk-ts-project.test.ts`::: A test folder is created to organize tests for your CDK project. A sample test file is also created.
-+
-You can write tests in TypeScript and use [.noloc]`Jest` to compile your TypeScript code before running tests.
-
-`tsconfig.json`::: Configuration file used in TypeScript projects that specifies compiler options and project settings.
-
-JavaScript::
-The following is an example project created in the `my-cdk-js-project` directory using the `cdk init --language javascript` command:
-+
-[source,none,subs="verbatim,attributes"]
-----
-my-cdk-js-project
-├── .git
-├── .gitignore
-├── .npmignore
-├── README.md
-├── bin
-│ └── my-cdk-js-project.js
-├── cdk.json
-├── jest.config.js
-├── lib
-│ └── my-cdk-js-project-stack.js
-├── node_modules
-├── package-lock.json
-├── package.json
-└── test
- └── my-cdk-js-project.test.js
-----
-
-`.npmignore`::: File that specifies which files and folders to ignore when publishing a package to the `npm` registry. This file is similar to `.gitignore`, but is specific to `npm` packages.
-
-`bin/my-cdk-js-project.js`::: The _application file_ defines your CDK app. CDK projects can contain one or more application files. Application files are stored in the `bin` folder.
-+
-The following is an example of a basic application file that defines a CDK app:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-#!/usr/bin/env node
-
-const cdk = require('aws-cdk-lib');
-const { MyCdkJsProjectStack } = require('../lib/my-cdk-js-project-stack');
-
-const app = new cdk.App();
-new MyCdkJsProjectStack(app, 'MyCdkJsProjectStack');
-----
-
-`jest.config.js`::: Configuration file for [.noloc]`Jest`. [.noloc]_Jest_ is a popular JavaScript testing framework.
-
-`lib/my-cdk-js-project-stack.js`::: The _stack file_ defines your CDK stack. Within your stack, you define {aws} resources and properties using constructs.
-+
-The following is an example of a basic stack file that defines a CDK stack:
-+
-[source,javascript,subs="verbatim,attributes"]
-----
-const { Stack, Duration } = require('aws-cdk-lib');
-
-class MyCdkJsProjectStack extends Stack {
- constructor(scope, id, props) {
- super(scope, id, props);
-
- // code that defines your resources and properties go here
- }
-}
-
-module.exports = { MyCdkJsProjectStack }
-----
-
-`node_modules`::: Common folder in [.noloc]`Node.js` projects that contain dependencies for your project.
-
-`package-lock.json`::: Metadata file that works with the `package.json` file to manage versions of dependencies.
-
-`package.json`::: Metadata file that is commonly used in [.noloc]`Node.js` projects. This file contains information about your CDK project such as the project name, script definitions, dependencies, and other import project-level information.
-
-`test/my-cdk-js-project.test.js`::: A test folder is created to organize tests for your CDK project. A sample test file is also created.
-+
-You can write tests in JavaScript and use [.noloc]`Jest` to compile your JavaScript code before running tests.
-
-Python:: The following is an example project created in the `my-cdk-py-project` directory using the `cdk init --language python` command:
-+
-[source,none,subs="verbatim,attributes"]
-----
-my-cdk-py-project
-├── .git
-├── .gitignore
-├── .venv
-├── README.md
-├── app.py
-├── cdk.json
-├── my_cdk_py_project
-│ ├── __init__.py
-│ └── my_cdk_py_project_stack.py
-├── requirements-dev.txt
-├── requirements.txt
-├── source.bat
-└── tests
- ├── __init__.py
- └── unit
-----
-
-`.venv`::: The CDK CLI automatically creates a virtual environment for your project. The `.venv` directory refers to this virtual environment.
-
-`app.py`::: The _application file_ defines your CDK app. CDK projects can contain one or more application files.
-+
-The following is an example of a basic application file that defines a CDK app:
-+
-[source,python,subs="verbatim,attributes"]
-----
-#!/usr/bin/env python3
-import os
-
-import aws_cdk as cdk
-
-from my_cdk_py_project.my_cdk_py_project_stack import MyCdkPyProjectStack
-
-app = cdk.App()
-MyCdkPyProjectStack(app, "MyCdkPyProjectStack")
-
-app.synth()
-----
-
-`my_cdk_py_project`:::
-Directory that contains your __stack files__. The CDK CLI creates the following here:
-+
---
-* +__init__.py+ – An empty Python package definition file.
-* `my_cdk_py_project` – File that defines your CDK stack. You then define {aws} resources and properties within the stack using constructs.
---
-+
-The following is an example of a stack file:
-+
-[source,python,subs="verbatim,attributes"]
-----
-from aws_cdk import Stack
-
-from constructs import Construct
-
-class MyCdkPyProjectStack(Stack):
- def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
- super().__init__(scope, construct_id, **kwargs)
-
- # code that defines your resources and properties go here
-----
-
-`requirements-dev.txt`::: File similar to `requirements.txt`, but used to manage dependencies specifically for development purposes rather than production.
-
-`requirements.txt`::: Common file used in Python projects to specify and manage project dependencies.
-
-`source.bat`::: Batch file for [.noloc]`Windows` that is used to set up the Python virtual environment.
-
-`tests`::: Directory that contains tests for your CDK project.
-+
-The following is an example of a unit test:
-+
-[source,python,subs="verbatim,attributes"]
-----
-import aws_cdk as core
-import aws_cdk.assertions as assertions
-
-from my_cdk_py_project.my_cdk_py_project_stack import MyCdkPyProjectStack
-
-def test_sqs_queue_created():
- app = core.App()
- stack = MyCdkPyProjectStack(app, "my-cdk-py-project")
- template = assertions.Template.from_stack(stack)
-
- template.has_resource_properties("{aws}::SQS::Queue", {
- "VisibilityTimeout": 300
- })
-----
-
-Java::
-The following is an example project created in the `my-cdk-java-project` directory using the `cdk init --language java` command:
-+
-[source,none,subs="verbatim,attributes"]
-----
-my-cdk-java-project
-├── .git
-├── .gitignore
-├── README.md
-├── cdk.json
-├── pom.xml
-└── src
- ├── main
- └── test
-----
-
-`pom.xml`:::
-File that contains configuration information and metadata about your CDK project. This file is a part of [.noloc]`Maven`.
-
-`src/main`:::
-Directory containing your _application_ and _stack_ files.
-+
-The following is an example application file:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.Environment;
-import software.amazon.awscdk.StackProps;
-
-import java.util.Arrays;
-
-public class MyCdkJavaProjectApp {
- public static void main(final String[] args) {
- App app = new App();
-
- new MyCdkJavaProjectStack(app, "MyCdkJavaProjectStack", StackProps.builder()
- .build());
-
- app.synth();
- }
-}
-----
-+
-The following is an example stack file:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.constructs.Construct;
-import software.amazon.awscdk.Stack;
-import software.amazon.awscdk.StackProps;
-
-public class MyCdkJavaProjectStack extends Stack {
- public MyCdkJavaProjectStack(final Construct scope, final String id) {
- this(scope, id, null);
- }
-
- public MyCdkJavaProjectStack(final Construct scope, final String id, final StackProps props) {
- super(scope, id, props);
-
- // code that defines your resources and properties go here
- }
-}
-----
-
-`src/test`:::
-Directory containing your test files. The following is an example:
-+
-[source,java,subs="verbatim,attributes"]
-----
-package com.myorg;
-
-import software.amazon.awscdk.App;
-import software.amazon.awscdk.assertions.Template;
-import java.io.IOException;
-
-import java.util.HashMap;
-
-import org.junit.jupiter.api.Test;
-
-public class MyCdkJavaProjectTest {
-
- @Test
- public void testStack() throws IOException {
- App app = new App();
- MyCdkJavaProjectStack stack = new MyCdkJavaProjectStack(app, "test");
-
- Template template = Template.fromStack(stack);
-
- template.hasResourceProperties("{aws}::SQS::Queue", new HashMap() {{
- put("VisibilityTimeout", 300);
- }});
- }
-}
-----
-
-C#::
-The following is an example project created in the `my-cdk-csharp-project` directory using the `cdk init --language csharp` command:
-+
-[source,none,subs="verbatim,attributes"]
-----
-my-cdk-csharp-project
-├── .git
-├── .gitignore
-├── README.md
-├── cdk.json
-└── src
- ├── MyCdkCsharpProject
- └── MyCdkCsharpProject.sln
-----
-
-`src/MyCdkCsharpProject`:::
-Directory containing your _application_ and _stack_ files.
-+
-The following is an example application file:
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace MyCdkCsharpProject
-{
- sealed class Program
- {
- public static void Main(string[] args)
- {
- var app = new App();
- new MyCdkCsharpProjectStack(app, "MyCdkCsharpProjectStack", new StackProps{});
- app.Synth();
- }
- }
-}
-----
-+
-The following is an example stack file:
-+
-[source,csharp,subs="verbatim,attributes"]
-----
-using Amazon.CDK;
-using Constructs;
-
-namespace MyCdkCsharpProject
-{
- public class MyCdkCsharpProjectStack : Stack
- {
- internal MyCdkCsharpProjectStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
- {
- // code that defines your resources and properties go here
- }
- }
-}
-----
-+
-This directory also contains the following:
-+
----
-* `GlobalSuppressions.cs` – File used to suppress specific compiler warnings or errors across your project.
-* `.csproj` – XML-based file used to define project settings, dependencies, and build configurations.
----
-
-`src/MyCdkCsharpProject.sln`:::
-[.noloc]``Microsoft Visual Studio Solution File`` used to organize and manage related projects.
-
-[.noloc]``Go``::
-The following is an example project created in the `my-cdk-go-project` directory using the `cdk init --language go` command:
-+
-[source,none,subs="verbatim,attributes"]
-----
-my-cdk-go-project
-├── .git
-├── .gitignore
-├── README.md
-├── cdk.json
-├── go.mod
-├── my-cdk-go-project.go
-└── my-cdk-go-project_test.go
-----
-
-`go.mod`:::
-File that contains module information and is used to manage dependencies and versioning for your [.noloc]`Go` project.
-
-`my-cdk-go-project.go`:::
-File that defines your CDK application and stacks.
-+
-The following is an example:
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-import (
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/constructs-go/constructs/v10"
- "github.com/aws/jsii-runtime-go"
-)
-
-type MyCdkGoProjectStackProps struct {
- awscdk.StackProps
-}
-
-func NewMyCdkGoProjectStack(scope constructs.Construct, id string, props *MyCdkGoProjectStackProps) awscdk.Stack {
- var sprops awscdk.StackProps
- if props != nil {
- sprops = props.StackProps
- }
- stack := awscdk.NewStack(scope, &id, &sprops)
- // The code that defines your resources and properties go here
-
- return stack
-}
-
-func main() {
- defer jsii.Close()
- app := awscdk.NewApp(nil)
- NewMyCdkGoProjectStack(app, "MyCdkGoProjectStack", &MyCdkGoProjectStackProps{
- awscdk.StackProps{
- Env: env(),
- },
- })
- app.Synth(nil)
-}
-
-func env() *awscdk.Environment {
-
- return nil
-}
-----
-
-`my-cdk-go-project_test.go`:::
-File that defines a sample test.
-+
-The following is an example:
-+
-[source,go,subs="verbatim,attributes"]
-----
-package main
-
-import (
- "testing"
-
- "github.com/aws/aws-cdk-go/awscdk/v2"
- "github.com/aws/aws-cdk-go/awscdk/v2/assertions"
- "github.com/aws/jsii-runtime-go"
-)
-
-func TestMyCdkGoProjectStack(t *testing.T) {
-
- // GIVEN
- app := awscdk.NewApp(nil)
-
- // WHEN
- stack := NewMyCdkGoProjectStack(app, "MyStack", nil)
-
- // THEN
- template := assertions.Template_FromStack(stack, nil)
- template.HasResourceProperties(jsii.String("{aws}::SQS::Queue"), map[string]interface{}{
- "VisibilityTimeout": 300,
- })
-}
-----
-====
\ No newline at end of file
diff --git a/v2/guide/ref-cli-cmd-ack.adoc b/v2/guide/ref-cli-cmd-ack.adoc
deleted file mode 100644
index def0a2f4..00000000
--- a/v2/guide/ref-cli-cmd-ack.adoc
+++ /dev/null
@@ -1,88 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#ref-cli-cmd-ack]
-= `cdk acknowledge`
-:info_titleabbrev: cdk ack
-:keywords: {aws} CDK, {aws} CDK CLI, CDK Toolkit, IaC, Infrastructure as code, {aws} Cloud, {aws} CloudFormation, cdk acknowledge, cdk ack
-
-[abstract]
---
-Acknowledge a notice by issue number and hide it from displaying again.
---
-
-// Content start
-
-Acknowledge a notice by issue number and hide it from displaying again.
-
-This is useful to hide notices that have been addressed or do not apply to you.
-
-Acknowledgements are saved at a CDK project level. If you acknowledge a notice in one CDK project, it will still display in other projects until acknowledged there.
-
-[#ref-cli-cmd-ack-usage]
-== Usage
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk acknowledge
-----
-
-[#ref-cli-cmd-ack-args]
-== Arguments
-
-[#ref-cli-cmd-ack-args-notice-id]
-*Notice ID*::
-The ID of the notice.
-+
-_Type_: String
-+
-_Required_: No
-
-[#ref-cli-cmd-ack-options]
-== Options
-
-For a list of global options that work with all CDK CLI commands, see xref:ref-cli-cmd-options[Global options].
-
-[#ref-cli-cmd-ack-options-help]
-`--help, -h `::
-Show command reference information for the `cdk acknowledge` command.
-
-[#ref-cli-cmd-ack-examples]
-== Examples
-
-[#ref-cli-cmd-ack-examples-1]
-=== Acknowledge and hide a notice that displays when running another CDK CLI command
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy
-... # Normal output of the command
-
-NOTICES
-
-16603 Toggling off auto_delete_objects for Bucket empties the bucket
-
- Overview: If a stack is deployed with an S3 bucket with
- auto_delete_objects=True, and then re-deployed with
- auto_delete_objects=False, all the objects in the bucket
- will be deleted.
-
- Affected versions: <1.126.0.
-
- More information at: https://github.com/aws/aws-cdk/issues/16603
-
-
-17061 Error when building EKS cluster with monocdk import
-
- Overview: When using monocdk/aws-eks to build a stack containing
- an EKS cluster, error is thrown about missing
- lambda-layer-node-proxy-agent/layer/package.json.
-
- Affected versions: >=1.126.0 <=1.130.0.
-
- More information at: https://github.com/aws/aws-cdk/issues/17061
-
-$ cdk acknowledge 16603
-----
\ No newline at end of file
diff --git a/v2/guide/ref-cli-cmd-bootstrap.adoc b/v2/guide/ref-cli-cmd-bootstrap.adoc
deleted file mode 100644
index a521bd98..00000000
--- a/v2/guide/ref-cli-cmd-bootstrap.adoc
+++ /dev/null
@@ -1,304 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#ref-cli-cmd-bootstrap]
-= `cdk bootstrap`
-:keywords: {aws} CDK, {aws} CDK CLI, CDK Toolkit, IaC, Infrastructure as code, {aws} Cloud, {aws} CloudFormation, bootstrap
-
-[abstract]
---
-Prepare an {aws} environment for CDK deployments by deploying the CDK bootstrap stack, named `CDKToolkit`, into the {aws} environment.
---
-
-// Content start
-
-Prepare an {aws} environment for CDK deployments by deploying the CDK bootstrap stack, named `CDKToolkit`, into the {aws} environment.
-
-The bootstrap stack is a CloudFormation stack that provisions an Amazon S3 bucket and Amazon ECR repository in the {aws} environment. The {aws} CDK CLI uses these resources to store synthesized templates and related assets during deployment.
-
-[#ref-cli-cmd-bootstrap-usage]
-== Usage
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap
-----
-
-[#ref-cli-cmd-bootstrap-args]
-== Arguments
-
-[#ref-cli-cmd-bootstrap-args-env]
-*{aws} environment*::
-The target {aws} environment to deploy the bootstrap stack to in the following format: `aws:///`.
-+
-Example: `aws://123456789012/us-east-1`
-+
-This argument can be provided multiple times in a single command to deploy the bootstrap stack to multiple environments.
-+
-By default, the CDK CLI will bootstrap all environments referenced in the CDK app or will determine an environment from default sources. This could be an environment specified using the `--profile` option, from environment variables, or default {aws} CLI sources.
-
-[#ref-cli-cmd-bootstrap-options]
-== Options
-
-For a list of global options that work with all CDK CLI commands, see xref:ref-cli-cmd-options[Global options].
-
-[#ref-cli-cmd-bootstrap-options-bootstrap-bucket-name]
-`--bootstrap-bucket-name, --toolkit-bucket-name, -b `::
-The name of the Amazon S3 bucket that will be used by the CDK CLI. This bucket will be created and must not currently exist.
-+
-Provide this option to override the default name of the Amazon S3 bucket.
-+
-When you use this option, you may have to customize synthesis. To learn more, see xref:bootstrapping-custom-synth[Customize CDK stack synthesis].
-+
-_Default value_: Undefined
-
-[#ref-cli-cmd-bootstrap-options-bootstrap-customer-key]
-`--bootstrap-customer-key `::
-Create a Customer Master Key (CMK) for the bootstrap bucket (you will be charged but can customize permissions, modern bootstrapping only).
-+
-This option is not compatible with `--bootstrap-kms-key-id`.
-+
-_Default value_: Undefined
-
-[#ref-cli-cmd-bootstrap-options-bootstrap-kms-key-id]
-`--bootstrap-kms-key-id `::
-The {aws} KMS master key ID to use for the `SSE-KMS` encryption.
-+
-Provide this option to override the default {aws} KMS key used to encrypt the Amazon S3 bucket.
-+
-This option is not compatible with `--bootstrap-customer-key`.
-+
-_Default value_: Undefined
-
-[#ref-cli-cmd-bootstrap-options-cloudformation-execution-policies]
-`--cloudformation-execution-policies `::
-The managed IAM policy ARNs that should be attached to the deployment role assumed by {aws} CloudFormation during deployment of your stacks.
-+
-By default, stacks are deployed with full administrator permissions using the `AdministratorAccess` policy.
-+
-You can provide this option multiple times in a single command. You can also provide multiple ARNs as a single string, with the individual ARNs separated by commas. The following is an example:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --cloudformation-execution-policies "arn:aws:iam::aws:policy/AWSLambda_FullAccess,arn:aws:iam::aws:policy/AWSCodeDeployFullAccess"
-----
-+
-To avoid deployment failures, be sure that the policies you specify are sufficient for any deployments that you will perform into the environment being bootstrapped.
-+
-This option applies to modern bootstrapping only.
-+
-[IMPORTANT]
-====
-The modern bootstrap template effectively grants the permissions implied by the `--cloudformation-execution-policies` to any {aws} account in the `--trust` list. By default, this extends permissions to read and write to any resource in the bootstrapped account. Make sure to xref:bootstrapping-customizing[configure the bootstrapping stack] with policies and trusted accounts that you are comfortable with.
-====
-+
-_Default value_: `[]`
-
-[#ref-cli-cmd-bootstrap-options-custom-permissions-boundary]
-`--custom-permissions-boundary, -cpb `::
-Specify the name of a permissions boundary to use.
-+
-This option is not compatible with ``--example-permissions-boundary``.
-+
-_Default value_: Undefined
-
-[#ref-cli-cmd-bootstrap-options-example-permissions-boundary]
-`--example-permissions-boundary, -epb `::
-Use the example permissions boundary, supplied by the {aws} CDK.
-+
-This option is not compatible with `--custom-permissions-boundary`.
-+
-The CDK supplied permissions boundary policy should be regarded as an example. Edit the content and reference the example policy if you are testing out the feature. Convert it into a new policy for actual deployments, if one does not already exist. The concern is to avoid drift. Most likely, a permissions boundary is maintained and has dedicated conventions, naming included.
-+
-For more information on configuring permissions, including using permissions boundaries, see the https://github.com/aws/aws-cdk/wiki/Security-And-Safety-Dev-Guide[Security and Safety Dev Guide].
-+
-_Default value_: Undefined
-
-[#ref-cli-cmd-bootstrap-options-execute]
-`--execute `::
-Configure whether to execute the change set.
-+
-_Default value_: `true`
-
-[#ref-cli-cmd-bootstrap-options-force]
-`--force, -f `::
-Always bootstrap, even if it would downgrade the bootstrap template version.
-+
-_Default value_: `false`
-
-[#ref-cli-cmd-bootstrap-options-help]
-`--help, -h `::
-Show command reference information for the `cdk bootstrap` command.
-
-[#ref-cli-cmd-bootstrap-options-previous-parameters]
-`--previous-parameters `::
-Use previous values for existing parameters.
-+
-Once a bootstrap template is deployed with a set of parameters, you must set this option to `false` to change any parameters on future deployments. When `false`, you must re-supply all previously supplied parameters.
-+
-_Default value_: `true`
-
-[#ref-cli-cmd-bootstrap-options-public-access-block-configuration]
-`--public-access-block-configuration `::
-Block public access configuration on the Amazon S3 bucket that is created and used by the CDK CLI.
-+
-_Default value_: `true`
-
-[#ref-cli-cmd-bootstrap-options-qualifier]
-`--qualifier `::
-Nine-digit string value that is unique for each bootstrap stack. This value is added to the physical ID of resources in the bootstrap stack.
-+
-By providing a qualifier, you avoid resource name clashes when provisioning multiple bootstrap stacks in the same environment.
-+
-When you change the qualifier, your CDK app must pass the changed value to the stack synthesizer. For more information, see xref:bootstrapping-custom-synth[Customize CDK stack synthesis].
-+
-_Default value_: `hnb659fds`. This value has no significance.
-
-[#ref-cli-cmd-bootstrap-options-show-template]
-`--show-template `::
-Instead of bootstrapping, print the current bootstrap template to the standard output (`stdout`). You can then copy and customize the template as necessary.
-+
-_Default value_: `false`
-
-[#ref-cli-cmd-bootstrap-options-tags]
-`--tags, -t `::
-Tags to add to the bootstrap stack in the format of `KEY=VALUE`.
-+
-_Default value_: `[]`
-
-[#ref-cli-cmd-bootstrap-options-template]
-`--template `::
-Use the template from the given file instead of the built-in one.
-
-[#ref-cli-cmd-bootstrap-options-termination-protection]
-`--termination-protection `::
-Toggle {aws} CloudFormation termination protection on the bootstrap stack.
-+
-When `true`, termination protection is enabled. This prevents the bootstrap stack from being accidentally deleted.
-+
-To learn more about termination protection, see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-protect-stacks.html[Protecting a stack from being deleted] in the _{aws} CloudFormation User Guide_.
-+
-_Default value_: Undefined
-
-[#ref-cli-cmd-bootstrap-options-toolkit-stack-name]
-`--toolkit-stack-name `::
-The name of the bootstrap stack to create.
-+
-By default, `cdk bootstrap` deploys a stack named `CDKToolkit` into the specified {aws} environment. Use this option to provide a different name for your bootstrap stack.
-+
-The CDK CLI uses this value to verify your bootstrap stack version.
-+
-_Default value_: `CDKToolkit`
-+
-_Required_: Yes
-
-[#ref-cli-cmd-bootstrap-options-trust]
-`--trust `::
-The {aws} account IDs that should be trusted to perform deployments into this environment.
-+
-The account performing the bootstrapping will always be trusted.
-+
-This option requires that you also provide `--cloudformation-execution-policies`.
-+
-You can provide this option multiple times in a single command.
-+
-This option applies to modern bootstrapping only.
-+
-To add trusted accounts to an existing bootstrap stack, you must specify all of the accounts to trust, including those that you may have previously provided. If you only provide new accounts to trust, the previously trusted accounts will be removed.
-+
-The following is an example that trusts two accounts:
-+
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap aws://123456789012/us-west-2 --trust 234567890123 --trust 987654321098 --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess
- ⏳ Bootstrapping environment aws://123456789012/us-west-2...
-Trusted accounts for deployment: 234567890123, 987654321098
-Trusted accounts for lookup: (none)
-Execution policies: arn:aws:iam::aws:policy/AdministratorAccess
-CDKToolkit: creating CloudFormation changeset...
- ✅ Environment aws://123456789012/us-west-2 bootstrapped.
-----
-+
-[IMPORTANT]
-====
-The modern bootstrap template effectively grants the permissions implied by the `--cloudformation-execution-policies` to any {aws} account in the `--trust` list. By default, this extends permissions to read and write to any resource in the bootstrapped account. Make sure to xref:bootstrapping-customizing[configure the bootstrapping stack] with policies and trusted accounts that you are comfortable with.
-====
-+
-_Default value_: `[]`
-
-[#ref-cli-cmd-bootstrap-options-trust-for-lookup]
-`--trust-for-lookup `::
-The {aws} account IDs that should be trusted to look up values in this environment.
-+
-Use this option to give accounts permission to synthesize stacks that will be deployed into the environment, without actually giving them permission to deploy those stacks directly.
-+
-You can provide this option multiple times in a single command.
-+
-This option applies to modern bootstrapping only.
-+
-_Default value_: `[]`
-
-[#ref-cli-cmd-bootstrap-examples]
-== Examples
-
-[#ref-cli-cmd-bootstrap-examples-1]
-=== Bootstrap the {aws} environment specified in the prod profile
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --profile prod
-----
-
-[#ref-cli-cmd-bootstrap-examples-2]
-=== Deploy the bootstrap stack to environments foo and bar
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --app='node bin/main.js' foo bar
-----
-
-[#ref-cli-cmd-bootstrap-examples-3]
-=== Export the bootstrap template to customize it
-
-If you have specific requirements that are not met by the bootstrap template, you can customize it to fit your needs.
-
-You can export the bootstrap template, modify it, and deploy it using {aws} CloudFormation. The following is an example of exporting the existing template:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --show-template > bootstrap-template.yaml
-----
-
-You can also tell the CDK CLI to use a custom template. The following is an example:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --template my-bootstrap-template.yaml
-----
-
-[#ref-cli-cmd-bootstrap-examples-4]
-=== Bootstrap with a permissions boundary. Then, remove that permissions boundary
-
-To bootstrap with a custom permissions boundary, we run the following:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --custom-permissions-boundary my-permissions-boundary
-----
-
-To remove the permissions boundary, we run the following:
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --no-previous-parameters
-----
-
-[#ref-cli-cmd-bootstrap-examples-5]
-=== Use a qualifier to distinguish resources that are created for a development environment
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk bootstrap --qualifier dev2024
-----
\ No newline at end of file
diff --git a/v2/guide/ref-cli-cmd-context.adoc b/v2/guide/ref-cli-cmd-context.adoc
deleted file mode 100644
index ee00d694..00000000
--- a/v2/guide/ref-cli-cmd-context.adoc
+++ /dev/null
@@ -1,55 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-
-[.topic]
-[#ref-cli-cmd-context]
-= `cdk context`
-:keywords: {aws} CDK, {aws} CDK CLI, CDK Toolkit, IaC, Infrastructure as code, {aws} Cloud, {aws} CloudFormation, cdk context
-
-[abstract]
---
-Manage cached context values for your {aws} CDK application.
---
-
-// Content start
-
-Manage cached context values for your {aws} CDK application.
-
-_Context_ represents the configuration and environment information that can influence how your stacks are synthesized and deployed. Use `cdk context` to do the following:
-
-* View your configured context values.
-* Set and manage context values.
-* Remove context values.
-
-[#ref-cli-cmd-context-usage]
-== Usage
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk context
-----
-
-[#ref-cli-cmd-context-options]
-== Options
-
-For a list of global options that work with all CDK CLI commands, see xref:ref-cli-cmd-options[Global options].
-
-
-[#ref-cli-cmd-context-options-clear]
-`--clear `::
-Clear all context.
-
-[#ref-cli-cmd-context-options-force]
-`--force, -f `::
-Ignore missing key error.
-+
-_Default value_: `false`
-
-[#ref-cli-cmd-context-options-help]
-`--help, -h `::
-Show command reference information for the `cdk context` command.
-
-[#ref-cli-cmd-context-options-reset]
-`--reset, -e `::
-The context key, or its index, to reset.
\ No newline at end of file
diff --git a/v2/guide/ref-cli-cmd-deploy.adoc b/v2/guide/ref-cli-cmd-deploy.adoc
deleted file mode 100644
index 7ba9f8a6..00000000
--- a/v2/guide/ref-cli-cmd-deploy.adoc
+++ /dev/null
@@ -1,469 +0,0 @@
-include::attributes.txt[]
-
-// Attributes
-[.topic]
-[#ref-cli-cmd-deploy]
-= `cdk deploy`
-:keywords: {aws} CDK, {aws} CDK CLI, CDK Toolkit, IaC, Infrastructure as code, {aws} Cloud, {aws} CloudFormation, cdk deploy
-
-[abstract]
---
-Deploy one or more {aws} CDK stacks into your {aws} environment.
---
-
-// Content start
-
-Deploy one or more {aws} CDK stacks into your {aws} environment.
-
-During deployment, the CDK CLI will output progress indicators, similar to what can be observed from the {aws} CloudFormation console.
-
-If the {aws} environment is not bootstrapped, only stacks without assets and with synthesized templates under 51,200 bytes will successfully deploy.
-
-[#ref-cli-cmd-deploy-usage]
-== Usage
-
-[source,none,subs="verbatim,attributes"]
-----
-$ cdk deploy