22 Jun 2023
Build full-stack applications on AWS with SST
Configuring and deploying app on AWS is a nightmare for some of us. Thankfully, a new open-source framework called SST came to life to help us all.
What's wrong with AWS ?
The problem with Amazon Web Services (AWS) is that it has too many web services. Putting them all together can be extremely difficult, not only for beginners, but for experts too.
Well, as said earlier, it has too much services (238 exactly). The services are awesome, and often cheap, but interacting with AWS seems like what happens when you let the developers write the platform AND the UI.
Another problem: outdated and confusing documentation. The solutions of your problems are often found on Reddit or Stack Overflow.
Current solutions to AWS nightmare
Because AWS is complicated, many solutions were created: Vercel, Heroku, DigitalOcean, Netlify, etc... They all use AWS under the hood.
The drawback: the price, you pay more than if you used AWS directly.
SST: the perfect match
SST fixes all these issues for web developers by representing back-end infrastructure as Typescript code, making it possible to integrate features like:
- S3 storage buckets
- Lamba functions (with API Gateway)
- RDS & DynamoDB
- Cognito user authentication
- Many other features, without touching the AWS console
It also has built-in deployment support for frameworks like:
- Static website
How does it work ?
Under the hood, this code is based on Amazon's Cloud Development Kit and Cloud Formation. It provides a local development environment, along with a web-based console to manage your stack.
Get started with SST
First things first, you'll need the AWS CLI with credentials set-up locally:
Next, run the following command to start a new SST project:
npx create-sst@latest --template=graphql/rds
You have now a scaffolded monorepo like this:
The /packages directory is where you write the code to power the back-end. Run the npm run dev command to automatically deploy the required resources to the cloud. Thanks to live reload, your code is immediately updated in the cloud when you change it.
Going to production requires a single command line:
npx sst deploy --stage prod
For more information, check the SST's documentation.