Skip to content

Commit f5fda0b

Browse files
authored
Merge pull request #16 from aws-actions/docs
Add more details to the project's README
2 parents dcf3034 + 162df63 commit f5fda0b

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# AWS Lambda "Deploy Lambda Function" Action for GitHub Actions
1+
# AWS Lambda Deploy Action for GitHub Actions
22

3-
Updates the code and configuration of AWS Lambda functions
3+
Updates the code and configuration of AWS Lambda functions as part of GitHub Actions workflow steps.
44

55
**Table of Contents**
66

77
<!-- toc -->
88

99
- [Usage](#usage)
10-
* [Update Function Configuration](#update-configuration-only)
10+
* [Update Function Configuration](#update-function-configuration)
1111
* [Using S3 Deployment Method](#using-s3-deployment-method)
1212
* [Dry Run Mode](#dry-run-mode)
1313
- [Build from Source](#build-from-source)
@@ -57,13 +57,19 @@ jobs:
5757
code-artifacts-dir: my-code-artifacts-dir
5858
# handler: my-handler
5959
# runtime: my-runtime
60-
# Add any additional inputs your action supports
60+
# Add any additional inputs this action supports
6161
```
6262

63-
The required parameters to deploy are function name, code artifacts directory, handler, and runtime. The function name and code artifacts directory need to be provided by the user. However, the handler and runtime do not and will default to index.handler and nodejs20.x if not provided.
63+
The required parameters to deploy are `function-name` and `code-artifacts-dir`. If a function with the name specified by `function-name` does not exist, it will be created with the provided code within `code-artifacts-dir` and configuration parameters using the [CreateFunction](https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunction.html) API.
64+
65+
Handler and runtime default to index.handler and nodejs20.x but can be customized. For the full list of inputs this GitHub Action supports, see [Inputs](#inputs).
66+
67+
6468

6569
### Update Function Configuration
70+
Function configuration will be updated using the [UpdateFunctionConfiguration](https://docs.aws.amazon.com/lambda/latest/api/API_UpdateFunctionConfiguration.html) API if configuration values differ from the deployed Lambda function's configuration.
6671

72+
As a first step, [GetFunctionConfiguration](https://docs.aws.amazon.com/lambda/latest/api/API_GetFunctionConfiguration.html) is called to perform a diff between the provided configuration parameters and the configuration of the currently deployed function. If there is no change, UpdateFunctionConfiguration will not be called.
6773
```yaml
6874
- name: Update Lambda configuration
6975
uses: aws-actions/aws-lambda-deploy@v1
@@ -76,7 +82,7 @@ The required parameters to deploy are function name, code artifacts directory, h
7682
```
7783
7884
### Using S3 Deployment Method
79-
85+
Optionally store code artifacts in S3 instead of direct `.zip` file upload.
8086
```yaml
8187
- name: Deploy Lambda function via S3
8288
uses: aws-actions/aws-lambda-deploy@v1
@@ -88,7 +94,7 @@ The required parameters to deploy are function name, code artifacts directory, h
8894
```
8995

9096
### Dry Run Mode
91-
97+
Validate parameters and permissions without any function code or configuration modifications.
9298
```yaml
9399
- name: Deploy on dry run mode
94100
uses: aws-actions/aws-lambda-deploy@v1
@@ -99,7 +105,9 @@ The required parameters to deploy are function name, code artifacts directory, h
99105
```
100106
## Build from Source
101107

102-
To automate building your source code, add a build step based on your runtime and build process. Below are two commonly used examples for Node.js and Python:
108+
To automate building your source code, add a build step based on your runtime and build process. This build step should be performed before the AWS Lambda Deploy step, and AWS Lambda Deploy's `code-artifacts-dir` parameter will typically be set to the build step's code artifact output directory.
109+
110+
Below are two commonly used Build examples for Node.js and Python:
103111

104112
### Node.js
105113

@@ -109,7 +117,7 @@ To automate building your source code, add a build step based on your runtime an
109117
# Install dependencies
110118
npm ci
111119
112-
# Build
120+
# Build
113121
npm run build
114122
```
115123
### Python
@@ -119,7 +127,7 @@ To automate building your source code, add a build step based on your runtime an
119127
run: |
120128
# Install dependencies
121129
pip install -r requirement.txt
122-
130+
123131
# Build
124132
python -m build
125133
```
@@ -168,7 +176,7 @@ To automate building your source code, add a build step based on your runtime an
168176

169177
This action relies on the [default behavior of the AWS SDK for JavaScript](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html) to determine AWS credentials and region. Use the [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) action to configure the GitHub Actions environment for AWS authentication.
170178

171-
### OpenID Connect (OIDC)
179+
### OpenID Connect (OIDC)
172180

173181
We **highly recommend** using OpenID Connect (OIDC) to authenticate with AWS. OIDC allows your GitHub Actions workflows to access AWS resources without storing AWS credentials as long-lived GitHub secrets.
174182

@@ -178,7 +186,8 @@ Here's an example of using OIDC with the aws-actions/configure-aws-credentials a
178186
- name: Configure AWS credentials with OIDC
179187
uses: aws-actions/configure-aws-credentials@v2
180188
with:
181-
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionRole
189+
role-to-assume: my-role
190+
aws-region: my-region
182191
```
183192

184193
To use OIDC authentication, you must configure a trust policy in AWS IAM that allows GitHub Actions to assume an IAM role. Here's an example trust policy:

0 commit comments

Comments
 (0)