Serverless best way of using generated lambda endpoint into static javascript code

Viewed 39

I have a serverless project which deploys a lambda function and also a static web page. The js code on the static web page has the hard-coded endpoint of the lambda function.

Whats the proper way to deploy the lambda and then use the generated endpoint in the static js code before deploy.

Is there any templating method so

Thanks!

1 Answers

This is how i defined the IoT Endpoint on aws-sdk-go-v2

  config, _ := external.LoadDefaultAWSConfig()
  config.EndpointResolver = aws.ResolveWithEndpointURL("https://xxxxxx")
  
  dataplaneClient := iotdataplane.New(config)

On the original aws-sdk-go you set it on the aws.Config struct directly:

svc := iotdataplane.New(session.New(), &aws.Config {Endpoint: aws.String("http://xxxx")})

I found the solution on a test case on https://github.com/aws/aws-sdk-go-v2

Related