4
votes

I initially created all my resources in AWS manually. Now I'm trying to use CloudFormation (SAM) templates to create all my new resources. Is there any way I can all my old (manually created) resource to this CF template and hence forth use this CF to make modification to those old resources?

5
I dont think so it is possible...but not sure if there are any hacks :). cfn manages the instances using automatically created tags.error404

5 Answers

1
votes

Not possible to add existing resources to a cloudformation template and have them managed from there on in with Cloudformation - but you can have a look at using CloudFormer (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-using-cloudformer.html) to create a cloudformation template for you from existing resources.

It won't manage the existing resources, but it will create a template so that you can launch the same resources again.

0
votes

This is unfortunately not possible.

To manage resources with CloudFormation, they have to be created first by CloudFormation.

You will need to find some sort of "migration path" from your existing resources to the ones created by CloudFormation.

0
votes

It is not possible to add existing resources to CloudFormation template directly, but you can deploy a CloudFormer stack to create a template from existing resources.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-using-cloudformer.html

After successful creation of that template, you can use the cross-stack reference in which you can define parameters to import/export values of existing resources.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html

Also, for more details of how to define parameters and import/export values, you can go through the below link: https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-reference-resource/

Note: After deployment of the template created by CloudFormer, you can vanish your existing resources as it newly deployed through the stack.

Hope this helps!

0
votes