Importing Existing Resources into a SAM Template - IAM Role Edition -

Previously I imported a CloudWatch LogGroup, but this time it is an example of configuring the import of an IAM Role.
The basic procedure is the same as for the CloudWatch LogGroup, so I will only describe the parts that differ.
Procedure
Retrieve the CloudFormation template and add the resource you want to import to template.yml
1 | ... |
We import the IAM Role used to deliver logs to the log group that manages the API Gateway access logs.
Describe the resource you want to import in import.json
1 | [ |
Add the resource to be imported to import.json and save it in the same directory as the template.yml from earlier.
1 | aws cloudformation create-change-set \ |
The capabilities must be set to CAPABILITY_NAMED_IAM. This is used when you want to give an IAM Role resource a custom name.
After that, proceed with the rest of the steps in the same way.
That’s all.
I hope this is helpful.
Importing Existing Resources into a SAM Template - IAM Role Edition -
https://kenzo0107.github.io/en/2023/06/20/aws-sam-import-iam-role/