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
demandé il y a 2 ans133 vues
Aucune réponse

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions