Ari Becker
05/13/2022, 12:04 PM/info
or /meta
API endpoint that, with caching (even minimal, one-minute caching) set up in a CloudFront distribution, basically guarantees nearly free usage (basically actually guaranteed after setting up enforcement, e.g. https://www.wellarchitectedlabs.com/security/300_labs/300_multilayered_api_security_with_c[…]and_waf/3_prevent_requests_from_accessing_api_directly/ ).
From reading the SST book, and what I'm finding in the SST docs, that SST would rely on CDK escape hatching to set most of this up? In other words, that I should forget the higher-level Api
abstraction that SST offers and basically only use the core/required App
, Stack
, and Function
constructs?
If I use the CDK escapes, can I still add stuff like the CDK-created API Gateway to the SST Console? It seems like the pattern is to use the "import an existing Http Api" https://docs.serverless-stack.com/constructs/Api#importing-an-existing-http-api option, thus a) create the API Gateway through CDK and then b) create an Api
, relying on the CDK-created API Gateway as the canonical API Gateway code, and import it from the CDK, therefore c) because it was imported, now it will be visible in the SST Console?
Basically I want to try and find a way to get the core value of SST - Live Lambda Development, the SST Console, using Seed for CI/CD, while architecting to take full advantage of the above patterns. It seems to me like the high-level constructs (Api
) are well-documented and serve as a great way for developers who aren't as well-versed in advanced AWS architectures to hit the ground running, but the more advanced approaches aren't so clear. To be clear - I don't expect the higher-level constructs like Api
to fully track AWS upstream and support every tiny feature immediately (I don't think that's a reasonable expectation for anyone who builds abstractions), and if SST's core value fits well into advanced architectures then I'm really excited about it.
Thanks!Derek Kershner
05/13/2022, 2:11 PMand basically only use the core/requiredLater,,App
, andStack
constructs?Function
NextJsSite
showed up, and I was using Amplify at the time which was a terrible CDK experience, so I switched (this is the other 10%). This is a unique offering that no one else in the market has in the CDK.
v1 changed the interfaces some, and made the CDK escape hatch much more prominent, but aside from maybe the code looking a bit ugly, there is no real downside to this over the CDK itself, and you can always switch back and forth so long as you are in a sst.Stack
. Our workplace choice has been to draw the line at alpha
, as in, we use CDK constructs for most infrastructure (including App
and Stack
), especially things like persistence that MUST never change and there only be one of, but when using something with stages or a package in alpha
, we are likely to use SST. Also when SST has a unique offering, of course, like Next. All of this means we basically use your 3 listed, plus Api
, and use lots of escape hatching on Api
.
FWIW while getting the team spun up, I havent regretted a single decision thus far, and the developer productivity curve is much steeper than other processes I have seen. SST learning curve was near zero, setting up AWS profiles was far worse. 🙂Derek Kershner
05/13/2022, 2:14 PMstage
system of App
and Stack
, its very, very helpful for staging
environments (where persistence is prod but code is separate).Ari Becker
05/13/2022, 2:20 PMNextJsSite
and its web frontend similars aren't relevant. I saw the SST + Flutter guide: https://serverless-stack.com/examples/how-to-create-a-flutter-app-with-serverless.html which looks fantastic.Ari Becker
05/13/2022, 2:23 PMTable
automatically inserts the stage
, it doesn't mean that I can't put the stage into a CDK-managed DynamoDB table, I just have to be deliberate about adding it into the table name etc.. Sounds like that delivers the best of both worlds - SST-stage management + get immediate updates from upstream, at a slight cost of boilerplate, basically?Derek Kershner
05/13/2022, 2:24 PMDerek Kershner
05/13/2022, 2:26 PMAlso, seeing as how e.g.I recommend not doing this, and instead splitting by account for persistence. Stages for us are code-only splits, and persistence is consistent among them. You can, of course, definitely do this though.automatically inserts theTable
, it doesn’t mean that I can’t put the stage into a CDK-managed DynamoDB tablestage
Ari Becker
05/13/2022, 2:27 PMstage
only for code-only splits, I'll have to think about that a little more closely in the design. Anyway, another reason not to use the SST Table
it seems.thdxr
05/13/2022, 2:28 PMthdxr
05/13/2022, 2:30 PMDerek Kershner
05/13/2022, 2:31 PMAri Becker
05/13/2022, 2:31 PMAri Becker
05/13/2022, 2:32 PMAri Becker
05/13/2022, 2:32 PMDerek Kershner
05/13/2022, 2:33 PMDerek Kershner
05/13/2022, 2:42 PMDerek Kershner
05/13/2022, 2:44 PMAri Becker
05/13/2022, 2:44 PMDerek Kershner
05/13/2022, 2:48 PMprovisioned concurrency
to be your escape hatch for scaling lambdas. There is now a little machine learner that can actually help set this for you. It takes the cost of a lambda more or less down to the cost of Fargate, which is pretty cheap.
We also take the extra steps of using HTTP API from APIG, SNS instead of EventBridge, etc. to make things cheaper. Tradeoffs.Ari Becker
05/13/2022, 2:58 PMDerek Kershner
05/13/2022, 3:00 PMI’ll take another look at replacing EventBridge with SNS where appropriate (no seeming need for complicated event rule logic), thanks.Dont take my word as gospel here, we just didnt need the extra features and the 300 rule limit was going to hurt us.
Derek Kershner
05/13/2022, 3:02 PMDo you have a link to the automatic setting of provisioned concurrency? Sounds interestingGetting Started with Amazon DevOps Guru for RDS – Amazon Web Services (name not accurate)
Drew
05/16/2022, 3:47 AMDrew
05/16/2022, 5:04 PMAri Becker
05/16/2022, 5:06 PMDrew
05/16/2022, 5:13 PM