I did spent weeks of time learning ins and outs of expressjs and converting into typescript classes and learning all express compatible packages. All of that time was wasted because I didn't study patterns. Because what I really want is single purpose function pattern with HTTP API. Thanks a lot Matt.
It took me couple days but I am now sshing into EC2 via locally installed VSCode. And I got rid of Cloud9 editor. This fixed my dev environment issue. However I was not able to use building lambda inside docker container. But I was able to build lambda written in golang and deploy with cdk.
So I have api gateway lambda and static site cashed with cloudfront at same domain. "/*" static site and "/api/*" for api gateway. How do I route traffic from cloudfront to api gateway with CDK? Right now I am getting 404 not found.
@@DeconstructingAWSCDKPatterns Also please add any example of lambda built in golang. Without expressjs there is no reason to use nodejs anymore. That is my personal opinion. I will be exclusively buidling single purpose pattern in golang lambda. I don't think lambda layer supports golang. But that's the way I am going.
What is happening. I spend a week learning golang and it turns out CDK doesn't support golang for lambda yet. They have the option of golang runtime and I deployed it. Then I am getting 500 error. And in the log it says there is no file. More time wasted now going back to nodejs lambda
I don't personally code in golang but you can checkout the latest blogpost here from Ari Palo aripalo.com/blog/2020/building-lambda-functions-inside-docker-containers-with-cdk/
@@DeconstructingAWSCDKPatterns Thanks for the link. I have been working on it for last 4 hours. The blog author didn't explain the code very well so I just copy pasted it. Then the go path is wrong somehow. Because I use homebrew for installing go. And its looking for go in usr/local. I don't really understand how PATH works in Linux. So its not working. Also I tried your code for nodejs from cdk pattern also and tried sample code from aws cdk sample. None of them are getting deployed. Can't get simple hello world lambda via CDK.
@@ApoorvMote if you run "npx cdkp init the-simple-webservice" then cd into the-simple-webservice folder and run "npm run deploy". That uses a node lambda and I have deployed it many times, If that doesn't work, something is configured different on your machine
@@DeconstructingAWSCDKPatterns Long story long. I have 2 computers 1) powerful PC desktop and 2) MacBook. I got tired of cross platform development so I moved to cloud9 IDE with code-server also. AWS tells me its my responsibility to update Golang, nodejs and other stuff. But it has preinstalled aws cli v1, older Golang and nodejs. Its nightmare to get rid of old stuff and use home-brew for everything. So I may go back to my wsl2 on desktop. In your code you use lambda.code.asset this is or will be deprecated soon. New version is lambda.code.fromAsset. Its taking long to replicate the nodejs error. But its something along the lines that the file doesn't exist. Code is not uploaded.I need to dig deep into my bundler for it. And my development environment is mess. I really wanted cloud9 IDE to work out but its just creating more problems.