This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| import re | |
| # Clean instance name by removing non-alphanumeric characters | |
| # So if you have an instance named "AWS-Instance-(2)", it will be written as "AWSInstance2" | |
| def clean_name(name): | |
| return re.sub(r'[^a-zA-Z0-9]', '', name) | |
| # Get the instance list | |
| def get_ec2_instances(region): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Ctrl+F | |
| 2. Toggle regex to on (ALT+R) | |
| 3. Search (.*\n){N}. Replace N with the number of lines to select. For example enter 2 to select every 2 lines. | |
| 4. Select All Occurrences of find Match (ALT+Enter) |