Hi, I am deploying a serverless stack app and need...
# help
a
Hi, I am deploying a serverless stack app and need some help with the following issues I am facing: 1. While deploying the app, I am having this s3 bucket issue ->
StagingBucket cdk-hnb659fds-assets-741386957827-ap-south-1 already exists
. How to get around with this ? (or why this might be happening?) 2. SST is also creating resources prefixed with
cdk-*
for iam roles and bucket names (in addition to the resources prefixed with stage name). Can I rename them somehow in my code ? So I can use prefixes like
dev-*
for these resources based on the stage name ? 3. What is the role of aws ssm in serverless stack deployment ? -> I was not giving ssm permissions earlier, as I did not think it is necessary, but getting this error
user is not authorized to perform: ssm:PutParameter on resource: arn:aws:ssm:ap-south-1:741386957827:parameter/cdk-bootstrap/hnb659fds/version
. Do I have to give these permissions to the user too then ? Please let me know if any more clarification is needed.
a
1. I have that issue too sometimes, not sure if that's a bug or misconfiguration in the stack file but doing 
sst remove
 and 
sst deploy
 again resolves that issues for me, sometimes I have to manually remove the resources from aws console though. 2. You should be able to give custom names to your resources, like for example you can set the value of 
functionName
 for functions or 
queueName
 for queues. You can append stage to the name with something like functionName:
${scope.stage}-your-function-name
3. Not sure about this one, I think we had to create those roles manually (I'm not the devops guy)) )
a
Thanks @Aram . I was able to manually delete the s3 bucket and resolved the issue. I am able to give custom names for function, but still some resources seems to be getting created, like with name cdktoolkit. I was hoping to avoid it.
f
Thanks for chiming in @Aram.
Hey @Anupam Dixit Let me add some background. So SST is built on top AWS CDK, which allows you to define ur infrastructure in code. And CDK needs to bootstrap and deploy some resources into your AWS account to facilitate the deployment.
1.
StagingBucket cdk-hnb659fds-assets-741386957827-ap-south-1 already exists
This often happens when the CDK bootstrapped CloudFormation stack is removed. To get around this issue, remove the bucket manually. 2. The bootstrap stack is not tied to your app. CDK just needs to bootstrap once per Account/Region, even if you deploy multiple apps/stages into the same Account/Region. Prefixing the resources with the stage name is often not desired. 3. CDK stores the bootstrapped version in an SSM parameter. That requires the
ssm:PutParameter
permission.
a
Thanks @Frank for the clarification. I was also under the impression that I am missing something with CDK knowledge. This clears up this aspect.