Hello guys, I have 2 questions 1. how to set autoP...
# help
a
Hello guys, I have 2 questions 1. how to set autoPublishAlias 2. how to set provisionedConcurrencyConfig or should that be done through CDK?
f
Hey @Aram,
sst.Function
extends CDK’s Function, so you can do
Copy code
new sst.Function(this, "MyFunction", {
  autoPublishAlias: true,
  provisionedConcurrencyConfig: ...
});
a
@Frank thanks for the reply, I tried that already but sst start complains about those properties
also I don't seem to be able to find that in FunctionOptions interface
f
oops sorry I was looking at the wrong doc (CfnFunction) doc
Can you see if the
FunctionOptions.currentVersionOptions
help?
a
found that one and gave it a try but sst did not detect any infrastructure change and I thought that might be something that's already done under the hood?
what I exactly tried is this
Copy code
currentVersionOptions: {
  provisionedConcurrentExecutions: 1,
},
didn't find anything for aliases
although it seemed like the properties on the
currentVersionOptions
are almost the same with
Alias
with a difference that it lacks
aliasName
f
Oh I see. I can give this a try tomorrow. (A bit late today)
a
@Frank Sure, thanks a bunch!
@Frank we did this as a workaround
Copy code
myFunction.currentVersion.addAlias('live', {
  provisionedConcurrentExecutions: 1,
});
f
@Aram, thanks for the update. I was looking at the AWS docs and it seems provisioned concurrency has to be tied to an alias or version.
I’m trying something out now.. I will let you know if I find a way to set it to a version instead without having to create an alias.
Hey @Aram, so I figured it out. So by configuring
currentVersionOptions
, no version is actually created. That’s why u didn’t see any change in ur CFN template
You’d have to reference
currentVersion
to actually create the version. The behavior is a bit weird. Here’s a discussion around on topic https://github.com/aws/aws-cdk/issues/8149
Any how, here’s how you’d set Provisioned Concurrency without creating an alias https://docs.serverless-stack.com/constructs/Function#configuring-provisioned-concurrency
a
@Frank thanks for getting back to me