- Newest
- Most votes
- Most comments
Hello,
From your query it seems that you are talking about generating a template to import scanned resources into an existing stack via IaC generator.
When we create a template via IaC generator using the option ‘Update the template for an existing stack’, we can add the scanned resources and in the scanned resources list we can see the ‘Resource identifier’ and ‘Resource type’. From there we can select the resource we want to add. After adding the resource, we can proceed to creating a template and further we can import that template into our stack [1].
You want to know what is the Resource identifier for the EBS Volumes. So the Resource identifier for the EBS volumes is the “Volume ID” of that volume resource. You can find the volume Id under the EC2 console —> Volumes.
As you have mentioned in your query statement that: “If I list the resources for a stack it gives the resource type but not the resource identifier type?” My understanding of this is that you are saying when you list the resources, under the ‘Resources’ tab in the stack, then you can only see the resource type but not the resource identifier. The resource identifier will be the ‘Physical Id’ of the resource.
If you have any specific concerns OR if you are facing any issue’s in creating template for importing resources, so in order to answer your question, we might require details that are non-public information. In that case please consider opening a support case with AWS using the following link: https://support.console.aws.amazon.com/support/home#/case/create
References:
[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC.html
I apologize for not being clear. In the stack the pairing is key and value - "PhysicalId" and "MyTable" for dynamodb. In the template the pairing is key and value - "TableName" and "MyTable". However, what I have not found is what all the keys are for different aws resource types for the template.
We provide two values to identify the resource we are importing. One is the ‘identifier property’ which is basically the resource type, for ex, ‘AWS::DynamoDB::Table’. Second is the ‘identifier value’, which is the resource's actual property value, for ex, like you mentioned the ’TableName’- ‘MyTable’. See [1]. You can get the value of the identifier property from the service console for the resource.
Moreover, you can also check the “Return Values” by ‘Ref’ intrinsic function in the CloudFormation documentations for each resource type. ‘Ref’ function returns the physical Id of a resource. Let’s say for the ‘AWS::DynamoDB::Table’, the ‘Return Value’ for this resource when we use ‘Ref’ is ‘Table Name’. See [2]. For some resources, the resource identifier could be an ARN, for ex, 'AWS::SNS::Topic', the return value is an ARN. See [3].
For most of all resource types, you can check the “Return Value” in their respective documentations and you will find what value will be returned by ‘Ref’ and that could be the resource identifier value for the resource to be imported.
References: [1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html#resource-import-identifiers-unique-ids [2] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#aws-resource-dynamodb-table-return-values [3]https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html#aws-resource-sns-topic-return-values
This still does not help. On this link (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html#resource-import-identifiers-unique-ids) the value I am trying to find is the "identifier property". If I have a resource type, I see know way of looking up the "identifier property" outside of having that resource in an existing stack and using something like the https://docs.aws.amazon.com/cli/latest/reference/cloudformation/get-template-summary.html api. What do I do if I am working with resource types that are not in a stack.
Example: I am doing a DR recovery and want to import the recovered resources into the base stack/CDK for the DR account (and I have already used up my runs of Iac Generator runs - that would do this for me). I should be able to programmatically generate the template, BUT because I have no way of look of the "identifier property" I cannot. These should be documented.Autocorrect change "I see no way of looking up" to "I see know way of looking up".
Relevant content
- asked 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
Currently the only way I see to to do this. Is to pull the physical id from the stack resource list and then run list scanned resources where I filter on the physical id. This seems unnecessary.