go-lambda-url-bastion

command
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

README

Lambda URL Sample

This is a very simple example that uses Lambda Function URLs to return a JSON response. This sample uses the bastion deployed from the deploy folder, referencing the bastion IP by passing in the LB.

To run this sample, create a terraform.tfvars file that contains values for the variables (according to sample.tfvars). Then, build the lambda by typing make. Finally, deploy it via terraform apply --var-file={your-above-var-file}.tfvars.

You will also need to change the FUNCIE_REDIS_ADDR environment variable to point to the Redis instance you are using, such as my.remote.host:6379. This environment variable will need to be set both on your Lambda, and your local instance. Remember that both the Lambda and your local environment need to be able to connect to the Redis instance.

When running this locally, you may wish to use gow to watch for changes and rebuild the binary automatically. You can install gow using go get github.com/mitranim/gow.

For example, to run this locally and automatically restart on any change, you can use:

FUNCIE_REDIS_ADDR=10.1.1.1:6379 gow run main.go

Then you can simply hit the URL, apply some changes, and see the next invocation automatically pick up the changes.

If you close the local instance, the Lambda will simply respond using the last code you uploaded to the Lambda. Then when you start the local instance, it will automatically continue forwarding requests.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL