An open API service indexing awesome lists of open source software.

https://github.com/dorneanu/aws-custom-resource-golang

AWS Lambda baked AWS custom resource PoC in Golang
https://github.com/dorneanu/aws-custom-resource-golang

aws aws-lambda cdk custom-resources golang

Last synced: 6 months ago
JSON representation

AWS Lambda baked AWS custom resource PoC in Golang

Awesome Lists containing this project

README

          

AWS custom resources using Golang, Lambda and TypeScript.

* Motivation

This is ready-to-deploy proof of concept leveraging Golang to efficiently handle the lifecycle management
of so called [[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html][AWS custom resources]]. This repository exemplifies how to use these to create [[https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html][SSM parameters]] of type
~SecureString~ in CDK. You can, of course, use this repository as a template for more advanced custom resources.

📖 You can read more on my blog at [[https://blog.dornea.nu/2023/04/06/aws-custom-resources-with-lambda-and-golang/][AWS Custom resources with Lambda and Golang]].

* Deployment

Make sure you first install all dependencies:
- ~go~ binary
- ~npm~

Then clone this repository:

#+begin_src sh
$ git clone https://github.com/dorneanu/aws-custom-resource-golang
#+end_src

Then install all ~npm~ dependencies:

#+begin_src sh
$ cd deployments
$ npm i --save-dev
added 310 packages in 3s

30 packages are looking for funding
run `npm fund` for details
#+end_src

I always recommend to first run ~cdk diff~ before deploying. This way you can review the
changes before it's to late:

#+begin_src sh
$ npx aws-cdk diff
#+end_src

Afterwards you can *deploy*:

#+begin_src sh
$ npx aws-cdk deploy
#+end_src

* TODOs
- [ ] Add [[https://github.com/sirupsen/logrus][logrus]]
- [X] Try to bundle Golang based lambda function locally first (see this [[https://github.com/aws-samples/cdk-build-bundle-deploy-example/blob/main/cdk-bundle-go-lambda-example/lib/api-stack.ts][example]])
- [X] Test locally
* Resources
- 2023-03-16 â—¦ [[https://www.npmjs.com/package/cdk-secure-parameter-store][cdk-secure-parameter-store - Create SecureString SSM parameter through CDK (TypeScript project)]]
- Related: [[https://github.com/HarshRohila/cdk-secure-parameter-store][github.com/HarshRohila/cdk-secure-parameter-store]]
- 2023-03-16 ◦ [[https://github.com/aws/aws-cdk/issues/3520][RFC: Have CDK put SecureString type parameter values into SSM securely · Issue #3520 · aws/aws-cdk · GitHub]]
- 2023-03-16 â—¦ [[https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/custom-resource][github.com/aws-cdk-examples/typescript/custom-resource official example using Python and TypeScript]]
- 2023-03-16 â—¦ [[https://medium.com/cyberark-engineering/advanced-custom-resources-with-aws-cdk-1e024d4fb2fa][Advanced AWS Custom Resources with CDK using Python]]
- Related: [[https://github.com/royby-cyberark/iot-policy-custom-resource-example][github.com/royby-cyberark/iot-policy-custom-resource-example]]
- 2023-03-15 â—¦ [[https://aws.amazon.com/blogs/devops/building-apps-with-aws-cdk/][Building, bundling, and deploying applications with the AWS CDK | AWS DevOps Blog]]
- Related: [[https://github.com/aws-samples/cdk-build-bundle-deploy-example][github.com/aws-samples/cdk-build-bundle-deploy-example]]
- 2023-03-15 â—¦ [[https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript][AWS CDK examples using TypeScript]]
- 2023-03-13 â—¦ [[https://github.com/thomaspoignant/cdk-golang-lambda-deployment][Build a Golang based Lambda function using CDK and TypeScript]]