awscfn 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -40
- package/bin/awscfn +1 -0
- package/dist/lib/cfn/executeChangeSet.js +1 -1
- package/dist/lib/cfn/executeChangeSet.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,15 +9,51 @@
|
|
|
9
9
|
[](https://conventionalcommits.org)
|
|
10
10
|
[](https://github.com/mhweiner/autorel)
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Deploy CloudFormation stacks without the usual suffering.
|
|
13
13
|
|
|
14
14
|
## Why awscfn?
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
16
|
+
If you've deployed CloudFormation stacks, you know the pain:
|
|
17
|
+
|
|
18
|
+
- You run `aws cloudformation create-stack` and get... nothing. Is it working? Who knows.
|
|
19
|
+
- You open the AWS console, hit refresh, scroll through events, trying to find the one that matters.
|
|
20
|
+
- It fails. The error says "Resource creation cancelled." The *actual* reason is buried somewhere in the event log.
|
|
21
|
+
- The stack is stuck in `ROLLBACK_COMPLETE`. Now you have to delete it manually before you can try again.
|
|
22
|
+
- Your CI job times out or exits 0 even though the deploy failed.
|
|
23
|
+
- You write a parameter file and remember: oh right, CloudFormation wants *that* JSON format.
|
|
24
|
+
|
|
25
|
+
**awscfn fixes this.**
|
|
26
|
+
|
|
27
|
+
- **Watch deploys happen** — Stack events stream to your terminal in real time. No refreshing. No second window.
|
|
28
|
+
- **See why it failed** — When a deploy fails, you get the actual failure reason, not "Resource creation cancelled."
|
|
29
|
+
- **Recover automatically** — Stuck in `ROLLBACK_COMPLETE`? awscfn detects it and re-creates the stack for you.
|
|
30
|
+
- **YAML params** — Simple YAML parameter files. No more verbose JSON.
|
|
31
|
+
- **CI that works** — Auto-detects CI environments. Exits non-zero when deploys fail. Compact output mode.
|
|
32
|
+
- **CLI + TypeScript SDK** — Use from the command line or import directly into Node.js/TypeScript projects.
|
|
33
|
+
|
|
34
|
+
It's not a CDK. It's not a framework. It's just a better way to deploy raw CloudFormation.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
**Global install** (recommended for CLI use):
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm i -g awscfn
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then run commands directly: `awscfn create-stack ...`
|
|
45
|
+
|
|
46
|
+
**Project dependency** (for SDK/library use):
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm i awscfn
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**npx** (no install):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx awscfn create-stack ...
|
|
56
|
+
```
|
|
21
57
|
|
|
22
58
|
## CLI commands
|
|
23
59
|
|
|
@@ -25,13 +61,15 @@ CLI and TypeScript SDK for managing AWS CloudFormation stacks.
|
|
|
25
61
|
|
|
26
62
|
### Global Options
|
|
27
63
|
|
|
28
|
-
| Flag |
|
|
29
|
-
|
|
30
|
-
| `--ci` |
|
|
31
|
-
| `--no-color
|
|
32
|
-
| `--verbose
|
|
33
|
-
| `--help
|
|
34
|
-
| `--version
|
|
64
|
+
| Flag | Description |
|
|
65
|
+
|------|-------------|
|
|
66
|
+
| `--ci`, `-C` | CI mode (compact output). Auto-detected when `CI=true` or `GITHUB_ACTIONS=true`. |
|
|
67
|
+
| `--no-color`, `-N` | Disable colored output |
|
|
68
|
+
| `--verbose`, `-V` | Show full error details on failure |
|
|
69
|
+
| `--help`, `-h` | Show help |
|
|
70
|
+
| `--version`, `-v` | Show version |
|
|
71
|
+
|
|
72
|
+
Run `awscfn --help` or `awscfn <command> --help` for full CLI usage.
|
|
35
73
|
|
|
36
74
|
### Shell Completion
|
|
37
75
|
|
|
@@ -63,34 +101,32 @@ When a failure occurs, the error message includes the actual reason from CloudFo
|
|
|
63
101
|
List all CloudFormation stacks in the current region (name, status, creation date).
|
|
64
102
|
|
|
65
103
|
```bash
|
|
66
|
-
|
|
104
|
+
awscfn list-stacks
|
|
67
105
|
```
|
|
68
106
|
|
|
69
|
-
No options. Output is a table of stack name, status, and creation date.
|
|
70
|
-
|
|
71
107
|
### 🚀 create-stack
|
|
72
108
|
|
|
73
109
|
```bash
|
|
74
|
-
|
|
110
|
+
awscfn create-stack -n <STACK_NAME> -t <TEMPLATE_FILE> -p <PARAMS_FILE>
|
|
75
111
|
```
|
|
76
112
|
|
|
77
|
-
| Flag |
|
|
78
|
-
|
|
79
|
-
| `--name
|
|
80
|
-
| `--template
|
|
81
|
-
| `--params
|
|
113
|
+
| Flag | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `--name`, `-n` | Stack name |
|
|
116
|
+
| `--template`, `-t` | CloudFormation template file |
|
|
117
|
+
| `--params`, `-p` | Parameters file (YAML) |
|
|
82
118
|
|
|
83
119
|
### ⬆️ update-stack
|
|
84
120
|
|
|
85
121
|
```bash
|
|
86
|
-
|
|
122
|
+
awscfn update-stack -n <STACK_NAME> -t <TEMPLATE_FILE> -p <PARAMS_FILE>
|
|
87
123
|
```
|
|
88
124
|
|
|
89
|
-
| Flag |
|
|
90
|
-
|
|
91
|
-
| `--name
|
|
92
|
-
| `--template
|
|
93
|
-
| `--params
|
|
125
|
+
| Flag | Description |
|
|
126
|
+
|------|-------------|
|
|
127
|
+
| `--name`, `-n` | Stack name |
|
|
128
|
+
| `--template`, `-t` | CloudFormation template file |
|
|
129
|
+
| `--params`, `-p` | Parameters file (YAML) |
|
|
94
130
|
|
|
95
131
|
If there are no changes to apply, the command succeeds gracefully:
|
|
96
132
|
```
|
|
@@ -100,13 +136,13 @@ If there are no changes to apply, the command succeeds gracefully:
|
|
|
100
136
|
### ♻️ redeploy-stack
|
|
101
137
|
|
|
102
138
|
```bash
|
|
103
|
-
|
|
139
|
+
awscfn redeploy-stack -n <STACK_NAME> -t <TEMPLATE_FILE>
|
|
104
140
|
```
|
|
105
141
|
|
|
106
|
-
| Flag |
|
|
107
|
-
|
|
108
|
-
| `--name
|
|
109
|
-
| `--template
|
|
142
|
+
| Flag | Description |
|
|
143
|
+
|------|-------------|
|
|
144
|
+
| `--name`, `-n` | Stack name |
|
|
145
|
+
| `--template`, `-t` | CloudFormation template file |
|
|
110
146
|
|
|
111
147
|
Redeploys using the existing stack's parameters. Useful for updating a stack with a new template without re-specifying params, or re-deploying after a failed create.
|
|
112
148
|
|
|
@@ -115,20 +151,20 @@ Redeploys using the existing stack's parameters. Useful for updating a stack wit
|
|
|
115
151
|
Deletes a CloudFormation stack with a confirmation safeguard.
|
|
116
152
|
|
|
117
153
|
```bash
|
|
118
|
-
|
|
154
|
+
awscfn delete-stack -n <STACK_NAME> -c <STACK_NAME>
|
|
119
155
|
```
|
|
120
156
|
|
|
121
|
-
| Flag |
|
|
122
|
-
|
|
123
|
-
| `--name
|
|
124
|
-
| `--confirm
|
|
157
|
+
| Flag | Description |
|
|
158
|
+
|------|-------------|
|
|
159
|
+
| `--name`, `-n` | Stack name |
|
|
160
|
+
| `--confirm`, `-c` | Repeat stack name to confirm |
|
|
125
161
|
|
|
126
|
-
|
|
162
|
+
`--confirm` must match `--name` exactly to prevent accidental deletion.
|
|
127
163
|
|
|
128
164
|
**Example:**
|
|
129
165
|
|
|
130
166
|
```bash
|
|
131
|
-
|
|
167
|
+
awscfn delete-stack -n my-app-prod -c my-app-prod
|
|
132
168
|
```
|
|
133
169
|
|
|
134
170
|
If the stack doesn't exist, the command will exit with an error.
|
|
@@ -140,6 +176,10 @@ If the names don't match, the deletion will be aborted.
|
|
|
140
176
|
|
|
141
177
|
> ⚠️ Requires AWS credentials to be configured in your shell or environment. [Start here](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) if you haven't already.
|
|
142
178
|
|
|
179
|
+
### Nested stacks and IAM
|
|
180
|
+
|
|
181
|
+
Change sets request **`CAPABILITY_NAMED_IAM`** and **`CAPABILITY_AUTO_EXPAND`**, so stacks that define named IAM resources or **nested stacks** (including templates from [`aws cloudformation package`](https://docs.aws.amazon.com/cli/latest/reference/cloudformation/package.html)) work with **`create-stack`** / **`update-stack`** and the SDK `createStack` / `updateStack` helpers.
|
|
182
|
+
|
|
143
183
|
### 📋 `listStacks(): Promise<StackSummary[]>`
|
|
144
184
|
|
|
145
185
|
Returns all CloudFormation stacks in the current region (paginated). Excludes deleted stacks (`DELETE_COMPLETE`, `DELETE_IN_PROGRESS`) via `StackStatusFilter`. Each item is an AWS SDK `StackSummary` (e.g. `StackName`, `StackStatus`, `CreationTime`).
|
package/bin/awscfn
CHANGED
|
@@ -30,7 +30,7 @@ async function createChangeSet(stackName, template, operation) {
|
|
|
30
30
|
ChangeSetName: changeSetName,
|
|
31
31
|
ChangeSetType: operation,
|
|
32
32
|
Parameters: parameters,
|
|
33
|
-
Capabilities: ['CAPABILITY_NAMED_IAM'],
|
|
33
|
+
Capabilities: ['CAPABILITY_NAMED_IAM', 'CAPABILITY_AUTO_EXPAND'],
|
|
34
34
|
}));
|
|
35
35
|
const cfg = (0, output_1.getOutputConfig)();
|
|
36
36
|
const stopSpinner = cfg.ci ? null : (0, output_1.startSpinner)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeChangeSet.js","sourceRoot":"","sources":["../../../src/lib/cfn/executeChangeSet.ts"],"names":[],"mappings":";;AAwEA,wDAmBC;AA3FD,0EAIwC;AACxC,mCAA8D;AAC9D,sCAA4E;AAI5E,SAAS,SAAS,CAA2B,QAAqB;IAE9D,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC/C,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;IAE1B,OAAO,OAAO,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAEnD,CAAC;AAED,SAAS,eAAe,CAAC,MA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