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 Answers
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.
You can import existing resources in your new stack ! https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-existing-stack.html
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.
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!
This is now possible with an update from AWS, see here for more details
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html