-
Notifications
You must be signed in to change notification settings - Fork 270
Add documentation for using Lambda with Secrets Manager #2544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for using Lambda with Secrets Manager #2544
Conversation
00a4291
to
0ef61ef
Compare
0ef61ef
to
105c43f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @knottnt ! left a few non blocking comments
const secretName = process.env.TEST_SECRET_ARN; | ||
const options = { | ||
hostname: 'localhost', | ||
port: 2773, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is port 2773 for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This port is what the AWS Parameter and Secrets Lambda extension
listens to.
|
||
```bash | ||
cat > index.mjs << 'EOF' | ||
import http from 'http'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we use aws-sdk instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example function uses the AWS Parameter and Secrets Lambda extension
as suggested in the Lambda service docs for integrating with AWS Secrets Manager. I call this out later, but I can add a call out in this section as well to make things clearer.
ACK_LAMBDA_IAM_ROLE="ack-lambda-function" | ||
ACK_LAMBDA_IAM_ROLE_DESCRIPTION="Role for ACK managed Lamdba function" | ||
aws iam create-role --role-name "${ACK_LAMBDA_IAM_ROLE}" --assume-role-policy-document file://trust.json --description "${ACK_LAMBDA_IAM_ROLE_DESCRIPTION}" | ||
ACK_LAMBDA_IAM_ROLE_ARN=$(aws iam get-role --role-name=$ACK_LAMBDA_IAM_ROLE --query Role.Arn --output text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarily can we use iam controller for these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I used the IAM roles directly was that involving the IAM controller requires adding instructions on how to setup the controller which I personally found to draw focus from the core concept of this tutorial. Would a call out to the IAM controller similar to what I used for the secrets-manager controller work for you?
Co-authored-by: Amine <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @knottnt !
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, knottnt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.