As AWS opens up new Regions, you may look to migrate workloads from existing Regions for reasons such as improving latency or meeting new compliance requirements. Embarking on such a migration would require you to go through the migration journey of assessing the source environment, mobilizing resources to lay the foundation for the migration and finally, migrating the workloads.
This Repository contains sample scripts to help you undertake analysis in AWS Region to Region Migrations, or when launching into a new Region.
These scripts are primarily written in Python utilising Boto3. You'll need to install it first, if you haven't already, using pip: pip install boto3
.
See each individual script description below
This script gets the EC2 instance families from two regions and compares them. It then prints the instance families that are in the first region, along with the Instance ID to help identify, but not in the second.
Please note that this script assumes that you have set up AWS credentials in your environment or in the ~/.aws/credentials
file. If not, you need to configure it by running aws configure
in your terminal and following the prompts.
Also, note that this script uses the describe_instance_types
API call which may have limitations on how many times you can call it within a certain period of time. If you are working with a large number of instances, you may need to handle rate limiting; pagination is catered for.
This script fetches the RDS instance classes and engine version in use in a specified region, checks if they are available in a second region, and prints out the classes versions and instance IDs that are not available in the second region.
This script handles pagination and assumes you have set up AWS credentials. It does not handle rate limits, so be aware of that if you are working with a large number of instances.
Raised and resolved PFR: boto/boto3#3752
This script fetches the EC2 instances in use in a specified region, checks if they are available in a second region, and looks up the pricing of each instance type (on-demand linux) to provide a total price impact of moving all available instances to the target region.
So, the AWSPricing API returns a very large and complex JSON structure that you need to navigate to find the specific price you are looking for. Alternatively, the download of the entire EC2 pricing file as a JSON from a URL provided by AWS is very large (around 70MB), and parsing it is non-trivial due to its structure.
Given these complexities, we've used third-party service https://instances.vantage.sh/ which you will need to create an account with a get a free API Token to use this script.
This script handles pagination and assumes you have set up AWS credentials. It does not handle rate limits, so be aware of that if you are working with a large number of instances.
This Python script takes as input an AWS calculator JSON file and a list of AWS region codes. For each region code in the list, it updates all "region" values in the JSON file to match the region code. The modified JSON data is then posted to a specified AWS URL, and the script prints out an updated AWS calculator URL for each region.
python aws_calc_region_swap.py <estimate_id> <region_1> <region_2> ... <region_n>
<estimate_id> is the ID of the source estimate.
<region_1>, <region_2>, ..., <region_n> is a space-separated list of AWS region codes.
This Python script takes as input two AWS Regions and compares the Service Quotas in each, printing out any differences
python compare_quotas.py <region_1> <region_2>
<region_1>, <region_2> Source and Target Region to compare
This Python script takes as input two AWS Regions and compares the Service Quotas related to Running EC2 Instances/Hosts in each, printing out any differences
python compare_running_ec2_quotas.py <region_1> <region_2>
<region_1>, <region_2> Source and Target Region to compare
To assist with quotas when the migration is also taking place across accounts, this Python script will take as input a single AWS Region and writes out to a CSV any applied Service Quotas that are different to the defined default. This resulting file can then be passed into the 2nd script that will check the values in the CSV against the target region defined and print out any differences. This can also help in other scenarios such as when promoting code from dev/test accounts to a production account
python python get_applied_quotas.py <region>
<region> Region to pull quotas
python check_applied_quotas.py <region> <csv_file>
<region> Region to check against
<csv_file> CSV file generated from get_applied_quotas.py
Identify Lambda functions with Graviton2 compatible and not-compatible runtimes versions. Looks in all regions where Graviton2 Lambda is currently available. Lambda runtimes support for Graviton2 docs: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
Compares Services and Features available between source and target region based on CFN Resource Spec
python compare_service_features.py <source_region> <target_region> [service]
<source_region> Source Region
<target_region> Target Region
[service] Optional Service
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.