Skip to content

Commit 3beec6f

Browse files
authored
docs: use npx projen commands in examples and clarify pdk vs projen (#753)
To help clarify PDK vs Projen, use projen commands in examples instead of PDK cli, and reword parts of the documentation. Also remove the migration banner from the README. Fixes #678
1 parent 87f53c5 commit 3beec6f

File tree

20 files changed

+135
-106
lines changed

20 files changed

+135
-106
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<a href="https://aws.github.io/aws-pdk/getting_started/migration_guide.html"><img src="docs/content/assets/images/rebrand_banner.png" width="1024px"></a>
2-
31
# Getting started
42

53
## What is the AWS PDK?
-39.3 KB
Binary file not shown.

docs/content/faqs/index.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Frequently Asked Questions
22

3+
## What's the difference between PDK and Projen?
4+
5+
[Projen](https://projen.io/) is a framework which allows you to define and maintain complex project configuration through code. PDK uses this framework, and vends several Projen projects. PDK is not a replacement or alternative to Projen, but rather builds on Projen to define opinionated projects which work synergistically with one another.
6+
7+
## What's the difference between PDK and CDK?
8+
9+
[CDK](https://aws.amazon.com/cdk/) is a framework for defining AWS infrastructure as code. PDK vends several CDK constructs which can be used in traditional CDK projects, but are more powerful when used within the context of a PDK project. For example, the `StaticWebsite` CDK construct vended by PDK can be used in any CDK project to deploy the infrastructure to host a static website on AWS, however when the Infrastructure and CloudscapeReactTsWebsite PDK projects are used, the `StaticWebsite` CDK construct is automatically configured to deploy your Cloudscape website, and deploy the necessary runtime configuration to set up Cognito login for your website.
10+
11+
While many of the PDK projects generate CDK code, PDK is not considered an abstraction over CDK. You still work with CDK to define your AWS infrastructure, but you may use these generated CDK constructs to supplement your CDK code.
12+
313
## I want to change a “pre-defined” task (e.g.: add --verbose to a tsc compile task)
414

515
Use the `reset` function:

docs/content/getting_started/index.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This topic introduces you to important AWS PDK concepts and describes how to ins
77
The AWS PDK lets you define your project structure as code in one of its supported programming languages. At its core, the AWS PDK is built on [Projen](https://github.com/projen/projen) and is a piece of software you should become familiar with if you want to become proficient with the PDK. In addition, alot of the constructs provided by the PDK generate CDK code which is used to deploy relevant infrastructure. The following expandable sections provide a quick primer on how these two key pieces of technology work.
88

99
??? "CDK Primer"
10-
10+
1111
AWS Construct Development Kit (AWS CDK) allows you to model AWS infrastructure as code (IaC) in a variety of supported languages. By allowing you to define Infastructure programatically, you can create higher level abstractions which can be re-used in a variety of applications. The deployment mechanism used at AWS is Cloudformation and as such all CDK code 'synthesizes' into Cloudformation. You can think of this like code that compiles to some native format (i.e: Java -> ByteCode).
1212

1313
To ground this in an example, let's create an S3 Bucket using the CDK:
@@ -143,7 +143,7 @@ The distributables for each language can be used directly as follows:
143143
```
144144

145145
!!!tip
146-
Whilst the AWS PDK can be used directly via these package managers, we recommend bootstrapping via the `pdk new` command which negates the need to interact directly with these package managers. The package managers will still need to be installed however, refer to [prerequisites](index.md#prerequisites) for more information.
146+
Whilst the AWS PDK can be used directly via these package managers, we recommend bootstrapping via the `npx projen new` command which negates the need to interact directly with these package managers. The package managers will still need to be installed however, refer to [prerequisites](index.md#prerequisites) for more information.
147147

148148
## Prerequisites
149149

@@ -156,9 +156,11 @@ All AWS PDK developers, even those working in Python or Java, need Node.js 16 or
156156
!!!tip
157157
We recommend installing [`nvm`](https://github.com/nvm-sh/nvm#installing-and-updating) and configuring it to use Node 18.
158158

159-
### PDK CLI
159+
### (Optional) PDK CLI
160+
161+
The PDK CLI is a wrapper command which delegates to either a package manager or a projen command depending on the context. As a rule of thumb, this replaces the use of `npx projen` for commands shown in the documentation.
160162

161-
Once your NodeJs runtime is set up, run the following command to install the pdk CLI:
163+
Once your NodeJS runtime is set up, run the following command to install the pdk CLI:
162164

163165
```bash
164166
npm install -g @aws/pdk
@@ -168,9 +170,6 @@ Run the following command to verify correct installation and print the version n
168170

169171
`pdk --version`
170172

171-
!!!warning
172-
The `pdk` command is a wrapper command which delegates to either a package manager or a projen command depending on the context. As such it may be possible that certain arguments may not operate as expected.
173-
174173
### Git
175174

176175
[Git](https://git-scm.com/) is also required to be installed and configured when bootstrapping new applications unless the `--no-git` flag is specified when executing the `pdk new` command.

docs/content/getting_started/shopping_list_app.md

+14-10
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,15 @@ The final step is the ensure our operations are exposed as part of the API by li
189189

190190
use aws.protocols#restJson1
191191

192-
/// A sample smithy api
192+
/// My Shopping List API
193193
@restJson1
194194
service MyApi {
195195
version: "1.0"
196-
operations: [GetShoppingLists, PutShoppingList, DeleteShoppingList]
196+
operations: [
197+
GetShoppingLists
198+
PutShoppingList
199+
DeleteShoppingList
200+
]
197201
errors: [
198202
BadRequestError
199203
NotAuthorizedError
@@ -210,7 +214,7 @@ The final step is the ensure our operations are exposed as part of the API by li
210214

211215
### Build the API
212216

213-
Now that we have our API defined, the final step is to build our code which will generate all of our type-safe bindings. To do so, run `pdk build` from the root of your PDK project.
217+
Now that we have our API defined, the final step is to build our code which will generate all of our type-safe bindings. To do so, run `npx projen build` from the root of your PDK project.
214218

215219
Take some time now to inspect the code that was generated for you in the following locations:
216220

@@ -335,7 +339,7 @@ Once you have saved your `.projenrc.ts` file, run `pdk` from the root to synthes
335339

336340
### Implement the handlers
337341

338-
We now have everything we need to start implementing our handlers.
342+
We now have everything we need to start implementing our handlers.
339343

340344
Let's first by creating a shared file called `dynamo-client.ts` within the handlers `src` directory as follows:
341345

@@ -564,7 +568,7 @@ Fantastic! We now have all of our API business logic implemented. Let's also upd
564568
expect(response.statusCode).toBe(200);
565569
expect((response.body as PutShoppingListResponseContent).shoppingListId).toBeDefined();
566570
});
567-
});
571+
});
568572
```
569573

570574
=== "delete-shopping-list.test.ts"
@@ -864,9 +868,9 @@ export class ApplicationStack extends Stack {
864868
We are now ready to deploy our API. To do so, run the following steps:
865869

866870
```bash
867-
pdk build
871+
npx projen build
868872
cd packages/infra
869-
pdk deploy:dev
873+
npx projen deploy:dev
870874
```
871875

872876
Once the deployment completes, we can test our API by navigating the the website (either via Cloudfront or locally) and trying out the API Explorer.
@@ -1334,7 +1338,7 @@ We can now test our UI locally by running the following command:
13341338

13351339
```bash
13361340
cd packages/website
1337-
pdk dev
1341+
npx projen dev
13381342
```
13391343

13401344
This will load a local server and open a browser showing your new application.
@@ -1348,9 +1352,9 @@ Have a play around with your website to ensure it is working as expected.
13481352
If you are happy with your website locally, you can go ahead and deploy it to AWS Cloudfront by performing the following steps from the root directory:
13491353

13501354
```bash
1351-
pdk build
1355+
npx projen build
13521356
cd packages/infra
1353-
pdk deploy:dev
1357+
npx projen deploy:dev
13541358
```
13551359

13561360
Once the deployment completes, navigate to your cloudfront URL to play around with your deployed website.

0 commit comments

Comments
 (0)