Can you convert (as opposed to import) a CloudFormation template into CDK code?

1

Based on this documentation, which is all about importing an already deployed CloudFormation stack and referencing it, I'm guessing the answer is no, but just wanted to double-check, since I didn't see this question being asked before on re:Post.

If my CloudFormation template were this:

{
  "Resources": {
    "MyBucket": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "BucketName": "MyBucket",
      }
    }
  }
}

Instead of using:

import aws_cdk as cdk
from aws_cdk import cloudformation_include as cfn_inc
from constructs import Construct

class MyStack(cdk.Stack):

    def __init__(self, scope: Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        template = cfn_inc.CfnInclude(self, "Template",  
            template_file="my-template.json")

to reference the template, is there a way to generate from the template something kinda like:

# import statements blablabla
  bucket = cfnBucket(self, "myBucket")
AWS
질문됨 2년 전133회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠