#Serverless

55 messages · Page 1 of 1 (latest)

south cave
#

Whole day im trying to setup serveless go demo, but no tutorial is working

AWS-SDK

I tried this last time:
https://www.youtube.com/watch?v=KyDWCyDqMLE&t=610s

Welcome to our comprehensive tutorial on deploying Go code to a serverless AWS Lambda function! 🚀

In this video, we'll walk you through the entire process, from setting up your AWS environment to writing and deploying your Go code. Whether you're a seasoned developer looking to dive into serverless computing or a Go enthusiast eager to explore ...

▶ Play video
#

runtime: lambda.Runtime.GO_1_X,

#

but it says that runtime is wrong, however intlisence dont show other the provided.al2

cobalt mica
#
Amazon Web Services

Lambda is deprecating the go1.x runtime in line with Amazon Linux 1 end-of-life, scheduled for December 31, 2023. Customers using Go with Lambda should migrate their functions to the provided.al2 runtime. Benefits include support for AWS Graviton2 processors with better price-performance, and a streamlined invoke path with faster performance.

#

Looks like maybe his tutorial is a bit out of date?

#

Your best bet will be to read the official AWS lambda docs for Golang

south cave
#

Serverless

i also tryed Serverless framework tutorial
https://www.youtube.com/watch?v=y6uYE62cp9g&t=296s
Buy i couldnt fix

GET /testing/ping (λ: getPing)
✖ Unhandled exception in handler 'getPing'.
✖ Error: Command failed with exit code 2: ./tmp
panic: interface conversion: interface {} is func(context.Context, events.APIGatewayProxyRequest) (main.Response, error), not func(context.Context, events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)

goroutine 1 [running]:
github.com/icarus-sullivan/mock-lambda.Start({0x56aaa0, 0x5bd870})
        /home/edems/go/pkg/mod/github.com/icarus-sullivan/[email protected]/processor.go:30 +0x2a9
main.main()
        /mnt/c/Users/root/Desktop/fuck-server/tmp/main.go:20 +0x25
    at makeError (file:///mnt/c/Users/root/Desktop/fuck-server/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///mnt/c/Users/root/Desktop/fuck-server/node_modules/execa/index.js:124:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async GoRunner.run (file:///mnt/c/Users/root/Desktop/fuck-server/node_modules/serverless-offline/src/lambda/handler-runner/go-runner/GoRunner.js:162:32)
    at async HandlerRunner.run (file:///mnt/c/Users/root/Desktop/fuck-server/node_modules/serverless-offline/src/lambda/handler-runner/HandlerRunner.js:114:14)
    at async LambdaFunction.runHandler (file:///mnt/c/Users/root/Desktop/fuck-server/node_modules/serverless-offline/src/lambda/LambdaFunction.js:309:16)
    at async file:///mnt/c/Users/root/Desktop/fuck-server/node_modules/serverless-offline/src/events/http/HttpServer.js:632:18
....

How to test your serverless application with lambda and api-gateway locally in golang with the help of serverless offline

The code is available here: https://github.com/mohokh67/serverless-offline-golang

▶ Play video
south cave
#

what do you think about serverles (framework?)

cobalt mica
#

I've never used it, personally

#

Never needed to

#

these two projects are linked from AWS' documentation

south cave
#

Im creating browser extension for which i need proxy server to hide openai api key and save/cache some things in db. Do you think serverless is ok for this job?

cobalt mica
#

Could be

#

I'd be worried about the cost of it ballooning once you reach a given threshold of users

#

And also potential malicious attacks, that could cause it to balloon too

#

I'd want to put it behind cloudflare, at the very least

south cave
#

( Im still student so i want something for free, and like that lambda fucntion are free for zero users not like vps which cose same even when there is zero traffic)

cobalt mica
#

Google Cloud offer a free e2 micro instance

#

You get one month of e2 micro usage, per month, free of charge

#

render also have a free instance, but it gets suspended after 15 minutes of inactivity

old egret
cobalt mica
#

ko looks pretty neat!

south cave
old egret
#

just a diff way of wrapping prev you compile and creaded a zip pkg that was uploaded into AWS lambda and now you can build a container and push it into a registry - lambda will pull and start when needed

old egret
south cave
#

I never used cloud before, only onclick sulution from vercel XD. So this is kinda overwhalming. I know docker on local development.

What would reccomend me for app need: I have simple browser extenseon which solve scrape and solve quiz. I need server to hide openai api key and save answer into db so it dont have regen every time. I like to learn from existing simple projec but all videos on yt and articles on medium seems to be outdated.

I will look at links you sent first, but i feel litle bit lost

old egret
south cave
#

||
e2-micro VM - this is like free full fledge VPS (i can run anything i want i gues)
render- 24/7 container which go to sleep after 15m? a start on hit?
ko - crates go coitaner wihnout docker?Y
||

#

Probably simplest way to host the go api would be buy VPS and run there?
As student i have on Digital Ocean 200$

old egret
#

yes KO is just for building container images with your binary inside (no need for docker files etc), DigitalOcean (DO) with a simple VM (droplet) should be perfect for start, aws and gcp give new users credits to run a small VM but there UI are quite complex

south cave
#

what about heroku what they provide XD

#

i can find what type of hosting it is

old egret
# south cave https://www.heroku.com/go

ahh they are still around 😄 you just need configure your git repo - they will compile the binary and run it - its a "small / micro VM" you can't ssh into the box

south cave
#

Heroku is proprably the simplest? I will propably try it tommorow, but now im going to bed. 6h of aws deploy error took of my energy 😄

#

thanks for your time and hekp ❤️

#

(bruteforcing technology about which i dont know anything is not the greatest idea XD)

sharp pebble
#

also... don't do serverless it's more expensive and kinda pointless for go

old egret
#

try heroku if it fails just go for a DO and a cheap VPS / droplet no point of over engineering the deployment part

cobalt mica
#

A free VPS

#

If you don't plan on exceeding the usage limits, it's a good option

sharp pebble
#

oracle's free is beefier/nicer btw

cobalt mica
#

True

#

And you get two of them, damn!