aws-lambda-api-tools 0.1.13 → 0.1.15

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.
Files changed (2) hide show
  1. package/README.md +91 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -224,22 +224,103 @@ interface RouteArguments {
224
224
  - Implement proper permission checks
225
225
  - Validate all input data
226
226
 
227
- ## Contributing
227
+ ## GitHub Actions IAM Setup
228
228
 
229
- Contributions are welcome! Please feel free to submit a Pull Request.
229
+ This package includes a utility to set up IAM OIDC authentication for GitHub Actions, allowing secure deployments to AWS without storing long-lived credentials.
230
230
 
231
- ## License
231
+ ### Usage
232
232
 
233
- MIT
233
+ Create or update an IAM stack for GitHub Actions OIDC authentication:
234
234
 
235
- ## GitHub Actions IAM Setup
235
+ ```bash
236
+ npx aws-lambda-api-tools create-gha-iam-stack --repo=owner/repo-name
237
+ ```
238
+
239
+ ### Options
236
240
 
237
- This package includes a utility to set up IAM OIDC authentication for GitHub Actions so that you can deploy to AWS from your GitHub Actions:
241
+ - `--repo`: (Required, Multiple) GitHub repository in the format `owner/repo-name`. Can be specified multiple times to grant access to multiple repositories
242
+ - `--policy`: (Optional) AWS managed policy name to attach to the role. Defaults to 'AdministratorAccess'
243
+ - Uses AWS credentials from your environment or AWS_PROFILE
244
+
245
+ ### Examples
238
246
 
247
+ **Single Repository:**
239
248
  ```bash
240
- npx gh-oidc-iam --repo=owner/repo-name [--policy=PolicyName]
249
+ npx aws-lambda-api-tools create-gha-iam-stack --repo=myorg/my-service
241
250
  ```
242
251
 
243
- Options:
244
- - `--repo`: (Required) Your GitHub repository in the format `owner/repo-name`
245
- - `--policy`: (Optional) AWS managed policy name to attach to the role. Defaults to 'AdministratorAccess'
252
+ **Multiple Repositories:**
253
+ ```bash
254
+ npx aws-lambda-api-tools create-gha-iam-stack \
255
+ --repo=myorg/service-a \
256
+ --repo=myorg/service-b \
257
+ --repo=myorg/service-c
258
+ ```
259
+
260
+ **Custom IAM Policy:**
261
+ ```bash
262
+ npx aws-lambda-api-tools create-gha-iam-stack \
263
+ --repo=myorg/my-service \
264
+ --policy=AWSLambda_FullAccess
265
+ ```
266
+
267
+ **Using AWS Profile:**
268
+ ```bash
269
+ AWS_PROFILE=staging npx aws-lambda-api-tools create-gha-iam-stack \
270
+ --repo=myorg/my-service
271
+ ```
272
+
273
+ ### Implementation Details
274
+
275
+ The tool creates a CloudFormation stack named `GithubActionsIam` containing:
276
+
277
+ 1. An OIDC Provider for GitHub Actions (if it doesn't exist)
278
+ 2. An IAM Role with:
279
+ - Trust policy configured for the specified GitHub repositories
280
+ - Specified AWS managed policy attached (defaults to AdministratorAccess)
281
+
282
+ The role ARN is output after stack creation/update and can be used in your GitHub Actions workflows.
283
+
284
+ ### Using in GitHub Actions
285
+
286
+ Add the following to your GitHub Actions workflow:
287
+
288
+ ```yaml
289
+ permissions:
290
+ id-token: write
291
+ contents: read
292
+
293
+ jobs:
294
+ deploy:
295
+ runs-on: ubuntu-latest
296
+ steps:
297
+ - uses: actions/checkout@v3
298
+
299
+ - name: Configure AWS Credentials
300
+ uses: aws-actions/configure-aws-credentials@v4
301
+ with:
302
+ role-to-assume: ${{ secrets.AWS_ROLE_ARN }} # Role ARN from stack output
303
+ aws-region: us-east-1
304
+
305
+ - name: Deploy
306
+ run: |
307
+ # Your deployment steps here
308
+ ```
309
+
310
+ Set the `AWS_ROLE_ARN` secret in your GitHub repository to the role ARN output by the create-gha-iam-stack command.
311
+
312
+ ### Updating Existing Stacks
313
+
314
+ You can run the command again with different repositories to update the stack:
315
+ - New repositories will be added to the trust policy
316
+ - Existing repositories will remain unchanged
317
+ - The attached policy can be updated by specifying a new --policy value
318
+
319
+
320
+ ## Contributing
321
+
322
+ Contributions are welcome! Please feel free to submit a Pull Request.
323
+
324
+ ## License
325
+
326
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-lambda-api-tools",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {