{"id":1628,"date":"2016-08-15T10:30:08","date_gmt":"2016-08-15T09:30:08","guid":{"rendered":"http:\/\/www.tekhead.org\/blog\/?p=1628"},"modified":"2016-10-11T10:59:57","modified_gmt":"2016-10-11T09:59:57","slug":"amazon-aws-tips-and-gotchas-part-7","status":"publish","type":"post","link":"http:\/\/tekhead.it\/blog\/2016\/08\/amazon-aws-tips-and-gotchas-part-7\/","title":{"rendered":"Amazon AWS Tips and Gotchas &#8211; Part 7 &#8211; AWS EMR, Spot Instances &#038; PGs"},"content":{"rendered":"<p>Continuing in this series of blog posts taking a bit of a \u201cwarts and all\u201d view of a few Amazon AWS features, below are a handful more tips and gotchas when designing and implementing solutions on Amazon AWS, including EMR, Spot Instances and Placement Groups.<\/p>\n<p>For the first post in this series with a bit of background on where it all originated from, see here:<br \/>\n<a href=\"http:\/\/tekhead.it\/blog\/2016\/02\/amazon-aws-tips-and-gotchas-part-1\/\" target=\"_blank\">Amazon #AWS Tips and Gotchas \u2013 Part 1<\/a><\/p>\n<p>For more posts in this series, see here:<br \/>\n<a href=\"http:\/\/tekhead.it\/blog\/2016\/07\/index-of-tekhead-it-blog-posts-on-amazon-aws\/#gotchas\" target=\"_blank\">Index of AWS Tips and Gotchas<\/a><\/p>\n<h4 class=\"p1\"><span class=\"s1\"><b>AWS Tips and Gotchas \u2013 Part 7<\/b><\/span><\/h4>\n<ol start=\"13\">\n<li>As detailed in the <a href=\"https:\/\/aws.amazon.com\/elasticmapreduce\/faqs\/#managing-your-cluster\" target=\"_blank\">EMR FAQ<\/a>, EMR does not support multi-master config, only one master node per EMR cluster (plus of course, multiple slaves). If that master node goes offline, you lose your cluster and all data which is being processed at the time. The AWS recommended workaround for this is to checkpoint your EMR cluster regularly, which allows resuming of the cluster from the last checkpoint\u00a0in the event of a failure.\u00a0<a href=\"http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/04\/emr.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1908\" src=\"http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/04\/emr.jpg\" alt=\"AWS EMR\" width=\"220\" height=\"220\" srcset=\"http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/04\/emr.jpg 250w, http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/04\/emr-150x150.jpg 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/a><\/li>\n<li>Spot instances and sticky sessions do not play well together!!! If you use spot instances as a method for providing cheap burst resources, make sure your application is not dependent on sticky sessions.<br \/>\nIf it is, you risk losing user sessions when the spot instances are terminated with only <a href=\"https:\/\/aws.amazon.com\/blogs\/aws\/new-ec2-spot-instance-termination-notices\/\" target=\"_blank\">2 minutes notice<\/a>.<br \/>\nThere are a couple of\u00a0mitigation methods for this, the best of which is simply to not use sticky sessions, and store your session data in another system such as ElastiCache or DynamoDB (or both!).<br \/>\nAlternatively, you could setup a script within the EC2 guest OS to monitor the Spot Instance Termination Notifications (<a href=\"http:\/\/169.254.169.254\/latest\/meta-data\/spot\/termination-time\">http:\/\/169.254.169.254\/latest\/meta-data\/spot\/termination-time<\/a>) and devise a\u00a0method to cleanly migrate off any remaining sessions from your instance and remove it from the load balancer.<br \/>\n<em><em>NOTE: It is best to avoid terminating your spot instances yourself, as AWS will not charge you for the hour in which they terminate your\u00a0instance, so you can save some budget\u00a0over shutting your own instances down.<\/em><\/em><\/li>\n<li>Placement groups were designed specifically for high bandwidth applications, which require low latency, 10Gbps connectivity between instances.<br \/>\n<a href=\"http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/08\/pgs.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1909\" src=\"http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/08\/pgs-300x210.jpg\" alt=\"AWS Placement Groups\" width=\"250\" height=\"175\" srcset=\"http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/08\/pgs-300x210.jpg 300w, http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/08\/pgs-150x105.jpg 150w, http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/08\/pgs.jpg 715w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a>If you do not start all instances in a placement group at the same time, you cannot guarantee that they will end up optimally close to each other later. Indeed, as stated in the placement groups KB &#8220;If you try to add more instances to the placement group later, or if you try to launch more than one instance type in the placement group, you increase your chances of getting an insufficient capacity error&#8221;.<br \/>\nIf you do want to add more instances to your placement group later, the best thing to do is stop and restart all of your instances concurrently.<\/li>\n<\/ol>\n<p>Find\u00a0more posts in this series here:<br \/>\n<a href=\"http:\/\/tekhead.it\/blog\/2016\/07\/index-of-tekhead-it-blog-posts-on-amazon-aws\/#gotchas\" target=\"_blank\">Index of AWS Tips and Gotchas<\/a><\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"XDcjtanF94\"><p><a href=\"https:\/\/tekhead.it\/blog\/2016\/09\/amazon-aws-tips-and-gotchas-part-8-reserved-instances\/\">Amazon AWS Tips and Gotchas \u2013 Part 8 \u2013 AWS EC2 Reserved Instances<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Amazon AWS Tips and Gotchas \u2013 Part 8 \u2013 AWS EC2 Reserved Instances&#8221; &#8212; Tekhead.it\" src=\"https:\/\/tekhead.it\/blog\/2016\/09\/amazon-aws-tips-and-gotchas-part-8-reserved-instances\/embed\/#?secret=QznIjWwb7u#?secret=XDcjtanF94\" data-secret=\"XDcjtanF94\" width=\"590\" height=\"332\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuing in this series of blog posts taking a bit of a \u201cwarts and all\u201d view of a few Amazon AWS features, below are a handful more tips [..]<\/p>\n","protected":false},"author":1,"featured_media":1549,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_focuskw":"EMR","_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"AWS is awesome, but this series describes common issues you may come across and provides tips, workarounds & fixes. Part 7 covers EMR, Spot Instances & PGs!","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New Blog Post: Amazon #AWS Tips and Gotchas \u2013 Part 7 #EMR","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[688,725],"tags":[270,709,699,706,707,891,702,890,886,887,888,885,889,710,892,66],"class_list":["post-1628","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","category-cloud","tag-amazon","tag-architecture","tag-aws","tag-awsgotchas","tag-awstips","tag-dynamodb","tag-ec2","tag-elasticache","tag-emr","tag-hadoop","tag-master","tag-placement-groups","tag-slave","tag-solution-architect","tag-spot-instances","tag-tips"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"http:\/\/tekhead.it\/wp-uploads\/www.tekhead.org\/2016\/02\/amazon-web-services-logo.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2l3lU-qg","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/posts\/1628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/comments?post=1628"}],"version-history":[{"count":1,"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/posts\/1628\/revisions"}],"predecessor-version":[{"id":1938,"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/posts\/1628\/revisions\/1938"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/media\/1549"}],"wp:attachment":[{"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/media?parent=1628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/categories?post=1628"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tekhead.it\/blog\/wp-json\/wp\/v2\/tags?post=1628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}