2

Using CloudFormation template, CloudFormation service ask for a stack name(AWS::StackName) before applying the template.

Using AWS CDK, we run cdk synth to create cfn template & cdk deploy to deploy services based on the template.

Does AWS CDK create default stack name in Cloudformation service? after running cdk deploy

1 Answer 1

5

In order to create a stack you have to instantiate an object for that stack. When you do, you pass the stack name as a parameter. Example in Python:

class MyStackClass:
    (...)

# You have to have an app
app = core.App()
# Here's the stack
MyStack = MyStackClass(app, "StackName")

Other than that, see the docs:

The physical names of the AWS CloudFormation stacks are automatically determined by the AWS CDK based on the stack's construct path in the tree. By default, a stack's name is derived from the construct ID of the Stack object, but you can specify an explicit name using the stackName prop, as follows.

new MyStack(this, 'not:a:stack:name', { stackName: 'this-is-stack-name' });
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.