Oh look another post about SST. I'm currently in the middle of moving a big Next.js repo from GitLab to GitHub and off DigitalOcean and onto AWS. Naturally I've used SST to do this. It did take me a little while to get this setup properly though.
sst.config.ts
The first step is defining your profile correctly. If you don't set it to undefined when running a GitHub Action it ain't gonna work.
Here's an example config:
Allowing GitHub Access To AWS
To allow GitHub access to AWS, you can Configure OpenID Connect in Amazon Web Services. We can actually do this in our infra code, rather than through our AWS account by using some of the Pulumi constructs built into SST.
Define the following in your sst.config.ts (or in an /infra directory), where GITHUB_ORG and GITHUB_REPO are your values:
Then deploy this.
The GitHub Action
Once GitHub has access to your AWS resources, you can add a workflow file to your repo (again, make sure you add your app name, expected stage and AWS account number):