AWS Serverless Infrastructure with Go for SaaS Startups

The flexibility of AWS, its serveleress infrastructure and its fantastic API with a Go SDK provide the ingredients for a startup to start, grow and scale. Because we are Golang engineers first and not devops engineers, AWS allows us to be great software engineers while they manage the infrastructure for your startups.

The SaaS Startup Kit includes a complete build pipeline that relies on AWS for serverless infrastructure and GitLab for CI/CD. This build and deployment pipeline is part of the tool called DevOps in the repository.

The DevOps tool handles creating AWS resources and deploying your SaaS services with minimal additional configuration. You can customize any of the configuration in the code. While AWS is already a core part of the SaaS Startup Kit, keeping the deployment in GoLang limits the scope of additional technologies required to get your project successfully up and running. If you understand Golang, then you will be a master at devops with this tool.


The DevOps tool uses the AWS SDK for Go:

The diagram below outlines the AWS services that the SaaS Startup Kit leverages to create business value for you and your customers. The main components is deploying the services to serverless compute with ECS. In order for the Docker containers to be seamlessly deployed with ECS, the Docker images are managed with ECR.

Bootstrap UI for SaaS Go Web App

Amazon Elastic Container Service (ECS)

Amazon Elastic Container Service (ECS) for SaaS startup screen capture

Amazon ECS is a highly scalable, high-performance container orchestration service that supports Docker containers and allows you to easily run and scale containerized applications on AWS. It eliminates the need for you to install and operate your own container orchestration software.

Amazon Elastic Container Service for SaaS startup screen capture

The SaaS Startup Kit by default has two example services running: one for the web app and the other the web api. The example deployment process creates on Fargate cluster (serverless ECS) to run the two services.


Amazon Elastic Container Registry (ECR)

Amazon Elastic Container Registry (ECR) for SaaS startup screen capture

Amazon Elastic Container Registry (ECR) is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images. It is integrated with ECS in order to simplifying your development to production workflow.

Each time the deployment process builds a docker container for a service, it stores in with ECR. The deployment process then uses these images for deployment to ECS.


Amazon ElastiCache for Redis

Amazon ElastiCache for Redis for SaaS startup screen capture

Amazon ElastiCache for Redis is a blazing fast in-memory data store that provides sub-millisecond latency to power internet-scale real-time applications.

The SaaS Startup Kit implements ElastiCache for storing ephemeral key/value pairs in memory including user sessions for both the web app and web API. Upon authentication, the session for the user is stored in ElastiCache and read as necessary to provide appropriate access.


Amazon Relational Database Service (RDS)

Amazon Relational Database Service (RDS) for SaaS startup screen capture

Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks.

Since transactional data is an important aspect of SaaS, the SaaS Starter Kit relies on RDS to provide and manage a relational database using the PostgreSQL engine.


AWS Identity and Access Management (IAM)

AWS Identity and Access Management (IAM) for SaaS startup screen capture

AWS Identity and Access Management (IAM) enables you to manage access to AWS services and resources securely. Using IAM, you can create and manage AWS users and groups, and use permissions to allow and deny their access to AWS resources.

Since IAM is a core administration and security component of AWS, the example deployment process for the SaaS Startup Kit relies on it to manage access to AWS services. Roles are used by default when possible to eliminate hard coding access keys. (Unable to use roles for dev env when running project locally.)


Amazon S3

Amazon S3 for SaaS startup screen capture

Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance. Data is segregated on S3 into buckets.

The example deployment script uses both public and private S3 buckets. The public bucket is used for storage of static files like images for the web app. The private bucket is used for temporary files to facilitate deployment.


Amazon S3 bucket for SaaS startup screen capture

The deployment script also leverages S3 Lifecycle policies to transfer objects to lower-cost storage classes. The main implementation of Lifecycle policies is for managing cache files and file exports by deleting them after a specified expiration date.


Amazon CloudFront

Amazon CloudFront for SaaS startup screen capture

Amazon CloudFront is a fast content delivery network (CDN) service that securely delivers media content to customers globally with low latency and high transfer speeds.

For production environment, the deployment scripts pushes the static files to the public S3 bucket, which is the origin domain for this CDN service. While the static files are referenced locally in development, for production environment the static files reference their location on CloudFront.


Amazon Route 53

Amazon Route 53 for SaaS startup screen capture

Amazon Route 53 is a highly available and scalable cloud Domain Name System (DNS) web service.

The DNS for the domain name(s) specified for your SaaS services leverage Route53. Each time a container for a service is deployed as a new ECS task, the DNS records are updated seamlessly.


Amazon Simple Email Service (SES)

Amazon Simple Email Service (SES) for SaaS startup screen capture

Amazon Simple Email Service (Amazon SES) is a cloud-based email sending service designed to help digital marketers and application developers send marketing, notification, and transactional emails.

The SaaS Startup Kit provides examples of SES to send emails for forgot password functionality as well as user invitations.