Skip to content
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

Created example for creating an AWS Lambda in Go #553

Merged
merged 6 commits into from
Feb 13, 2020
Merged

Conversation

tasiah
Copy link

@tasiah tasiah commented Feb 12, 2020

Added an example for aws-go-lambda for #442.

Copy link
Contributor

@EvanBoyle EvanBoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@tasiah tasiah merged commit 1aa6acf into master Feb 13, 2020
@pulumi-bot pulumi-bot deleted the tasiah/aws-go-lambda branch February 13, 2020 00:53
Copy link
Member

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

build::
GOOS=linux GOARCH=amd64 go build -o ./handler/handler ./handler/handler.go
zip -j ./handler/handler.zip ./handler/handler
go build -o go-lambda main.go
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this last line?

Copy link
Author

@tasiah tasiah Feb 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the example I was referring to, the first step was to build go, but to be honest, I've never tried not building it.

EDIT: Just tried it on a different example, and seems like the changes to main.go don't persist unless I build it first.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: Just tried it on a different example, and seems like the changes to main.go don't persist unless I build it first.

My understanding is that if you have the binary there, then it will be used, but if you don't, then we will effectively go run main.go. So what you are seeing might happen if you still have the binary there from a previous go build?

@EvanBoyle Is that right? And if so, is it documented yet?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested, and you're right that pulumi builds for us. I'll make this change with #554.

@@ -0,0 +1,4 @@
build::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be inevitable - but having a Makefile here means this may not work well on Windows. There are some notes on doing this in a cross platform compatible way in https://github.com/aws/aws-lambda-go/blob/master/README.md#for-developers-on-windows.

1. Build the go files:

```bash
make build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw - I’m hopeful that once we fix pulumi/pulumi#3593 we can automate this directly within the Pulumi program so that the separate step is not needed - but today I think it is so I like having this example as is until then.

@joeduffy
Copy link
Member

Wow, nice! 🎉

dixler pushed a commit that referenced this pull request Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants