Saturday, May 11, 2013

EC2 AMI Cross Region Migration Best Practices

An Amazon Machine Image (AMI) is a pre-configured operating system image that is used to create an EC2 instance within the Amazon cloud environment.  AMI’s are unique per region and they not span across multiple regions, But AMI’s can be migrated across regions using the EC2 AMI copy function available as part of AWS Console, API and CLI.  This feature helps customers to maintain consistent Multi region deployments and achieve higher availability. Since user-created AMIs are assigned a unique AMI ID within the region, when you configure Auto Scaling Launch configuration or AWS CloudFormation templates in target Amazon EC2 region, it is recommended to update the AMI ID references in these configurations/templates to match the ones that exist in the target region. 

Important points to note while implementing this are:
  • Permissions and user-defined tags applied to the AMI in source region will not be copied to the target region during the AMI copy process. You will have to apply the permissions and tags in the target region after the copy process is completed.
  • Imagine you have stored the database connection strings, ElastiCache End points, external IP address and other Integration end points in the AMI of the source region. When you migrate this AMI to the target region these end points might not exist. Worst scenario, if these source end points are accessible over internet like S3, CloudSearch assets etc, you will end up accessing resources from target region itself. This will cause latency issues, performance problems and cost leakage.  
  • Some best practices to be followed are:
    • Prior to copying an AMI from Source region, you must manually ensure that the contents of the source AMI are updated to support running in a different region. It is recommended to add this step as part of your operation process during Cross region migration activities to avoid problems
    • Automate the download of configuration information to EC2 from S3 using user data and other scripts in the respective regions. This way when the migration happens to target region, the configuration files and scripts can be downloaded to EC2 instance from the S3 of the target region. This mechanism keeps the end points in tune with respective regions.
    • If you are running Java based environment, use NetFlix Archaius to dynamically source properties from multiple configuration stores inside an Amazon EC2 region. Archaius includes a set of java configuration management APIs and is primarily implemented as an extension of Apache's Commons Configuration Library.  Refer

No comments:

Need Consulting help ?


Email *

Message *

All posts, comments, views expressed in this blog are my own and does not represent the positions or views of my past, present or future employers. The intention of this blog is to share my experience and views. Content is subject to change without any notice. While I would do my best to quote the original author or copyright owners wherever I reference them, if you find any of the content / images violating copyright, please let me know and I will act upon it immediately. Lastly, I encourage you to share the content of this blog in general with other online communities for non-commercial and educational purposes.