You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# The role-to-assume should be the ARN of the IAM role you created for GitHub Actions OIDC
52
+
53
+
- name: Deploy Lambda Function
54
+
uses: aws-actions/aws-lambda-deploy@v1
55
+
with:
56
+
function-name: my-function-name
57
+
code-artifacts-dir: my-code-artifacts-dir
58
+
# handler: my-handler
59
+
# runtime: my-runtime
60
+
# Add any additional inputs your action supports
50
61
```
51
62
52
-
### Using S3 Deployment Method
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.
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:
103
+
104
+
### Node.js
117
105
118
106
```yaml
119
-
name: Validate Lambda Deployment
107
+
- name: Build source code
108
+
run: |
109
+
# Install dependencies
110
+
npm ci
120
111
121
-
on:
122
-
pull_request:
123
-
branches: [main, master]
112
+
# Build
113
+
npm run build
114
+
```
115
+
### Python
124
116
125
-
jobs:
126
-
validate:
127
-
runs-on: ubuntu-latest
128
-
permissions:
129
-
id-token: write # Required for OIDC authentication
130
-
contents: read # Required to check out the repository
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.
189
170
190
-
### OpenID Connect (OIDC) - Recommended Approach
171
+
### OpenID Connect (OIDC)
191
172
192
173
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.
193
174
194
175
Here's an example of using OIDC with the aws-actions/configure-aws-credentials action:
195
176
196
177
```yaml
197
-
jobs:
198
-
deploy:
199
-
runs-on: ubuntu-latest
200
-
permissions:
201
-
id-token: write # Required for OIDC authentication
202
-
contents: read # Required to check out the repository
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