Go Serverless Functions with Ember and SST on AWS

By Jared Galanis 07.15.2022

Introduction

In this article, we will explore how to utilize Go serverless functions with Ember and SST on AWS. This allows developers to build scalable applications without managing server infrastructure.

Prerequisites

Before starting, ensure you have the following installed:

  • Node.js
  • AWS CLI
  • SST (Serverless Stack)

Setting Up Your SST Project

To get started, create a new SST project with the following command:

npx create-sst@latest my-sst-app
cd my-sst-app

Creating a Go Function

You can create a Go function by adding a new file in the functions/ directory. For example, create a file named hello.go:

package main

import (
    "fmt"
    "github.com/aws/aws-lambda-go/lambda"
)

func Handler() (string, error) {
    return fmt.Sprintf("Hello from Go!"), nil
}

func main() {
    lambda.Start(Handler)
}

Deploying Your Function

Run the following command to deploy your SST project:

npx sst deploy

Conclusion

Using Go serverless functions with Ember and SST provides an efficient way to develop applications while minimizing infrastructure management. With AWS's powerful tools, you can focus on writing code and building features.