AWS and SMS

Posted on Oct 21, 2022
tl;dr: smol code

Code to get stuff done quickly using the AWS golang SDK is often surprisingly easy.

For example, sending an SMS is as easy as the following….

package main

import (
        "fmt"

        "github.com/aws/aws-sdk-go/aws"
        "github.com/aws/aws-sdk-go/aws/session"
        "github.com/aws/aws-sdk-go/service/sns"
)

func main() {
        sess := session.Must(session.NewSession())
        svc := sns.New(sess)
        params := &sns.PublishInput{
                Message:     aws.String("Some Message Here"),
                PhoneNumber: aws.String("+44000000000"),
        }
        _, _ = svc.Publish(params)
}