<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Xi Group Ltd. Company Blog &#187; Xi Group Ltd. Company Blog &#187; names</title>
	<atom:link href="http://blog.xi-group.com/tag/names/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xi-group.com</link>
	<description>High-quality DevOps Services</description>
	<lastBuildDate>Tue, 09 Jun 2015 11:38:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.2</generator>
	<item>
		<title>Small Tip: AWS tools are case sensitive, AWS Web Interface is not</title>
		<link>http://blog.xi-group.com/2014/06/small-tip-aws-tools-are-case-sensitive-aws-web-interface-is-not/</link>
		<comments>http://blog.xi-group.com/2014/06/small-tip-aws-tools-are-case-sensitive-aws-web-interface-is-not/#comments</comments>
		<pubDate>Mon, 02 Jun 2014 07:42:26 +0000</pubDate>
		<dc:creator><![CDATA[Ivo Vachkov]]></dc:creator>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Small Tip]]></category>
		<category><![CDATA[AWS CLI]]></category>
		<category><![CDATA[case sensitive]]></category>
		<category><![CDATA[filters]]></category>
		<category><![CDATA[instances]]></category>
		<category><![CDATA[names]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://blog.xi-group.com/?p=27</guid>
		<description><![CDATA[In a recent investigation, we found an interesting difference between AWS command line tools (based on Boto library) and AWS Web interface. Apparently, command line tools are case sensitive while AWS Web interface is not. This can potentially lead to automated scaling issues. Tooling may not get &#8216;the full picture&#8217; if tags are mixed-case and [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;">In a recent investigation, we found an interesting difference between AWS command line tools (based on Boto library) and AWS Web interface. Apparently, command line tools are case sensitive while AWS Web interface is not. This can potentially lead to automated scaling issues. Tooling may not get &#8216;the full picture&#8217; if tags are mixed-case and software does not account for that.</p>
<p style="text-align: justify;">Lets start with simple example &#8230;</p>
<p style="text-align: justify;">We have the following EC2 instances in AWS Account:<br />
<a href="http://blog.xi-group.com/wp-content/uploads/2014/06/Screen-Shot-2014-06-02-at-10.03.04-AM.png"><img class="alignnone size-full wp-image-28 img-thumbnail img-responsive" src="http://blog.xi-group.com/wp-content/uploads/2014/06/Screen-Shot-2014-06-02-at-10.03.04-AM.png" alt="Screen Shot 2014-06-02 at 10.03.04 AM" width="1385" height="300" /></a></p>
<p style="text-align: justify;">Search for the term &#8216;TEST-NODE&#8217; yields the same results as searching for &#8216;test-node&#8217; in the AWS Web interface.</p>
<p style="text-align: justify;">Searching for &#8216;TEST-NODE':<br />
<a href="http://blog.xi-group.com/wp-content/uploads/2014/06/Screen-Shot-2014-06-02-at-10.03.27-AM.png"><img class="alignnone size-full wp-image-29 img-thumbnail img-responsive" src="http://blog.xi-group.com/wp-content/uploads/2014/06/Screen-Shot-2014-06-02-at-10.03.27-AM.png" alt="Screen Shot 2014-06-02 at 10.03.27 AM" width="1385" height="270" /></a></p>
<p>Searching for &#8216;test-node':<br />
<a href="http://blog.xi-group.com/wp-content/uploads/2014/06/Screen-Shot-2014-06-02-at-10.03.49-AM.png"><img class="alignnone size-full wp-image-30 img-thumbnail img-responsive" src="http://blog.xi-group.com/wp-content/uploads/2014/06/Screen-Shot-2014-06-02-at-10.03.49-AM.png" alt="Screen Shot 2014-06-02 at 10.03.49 AM" width="1385" height="270" /></a></p>
<p style="text-align: justify;">&#8230; it behaves the same way. It is case-insensitive.</p>
<p style="text-align: justify;">However, commend line tools will produce totally different output.</p>
<p style="text-align: justify;">Searching for &#8216;TEST-NODE':</p>
<p></p><pre class="crayon-plain-tag">:~&gt; aws ec2 describe-instances --filters "Name=tag:Name,Values=*TEST-NODE*" --query 'Reservations[*].Instances[*].Tags[?Key==`Name`].Value[]' --output text
TEST-NODE-1
:~&gt;</pre><p>Searching for &#8216;test-node':</p><pre class="crayon-plain-tag">:~&gt; aws ec2 describe-instances --filters "Name=tag:Name,Values=*test-node*" --query 'Reservations[*].Instances[*].Tags[?Key==`Name`].Value[]' --output text
test-node-5
:~&gt;</pre><p></p>
<p style="text-align: justify;">Python + Boto shows the same behavior (not surprisingly, AWS CLI uses Boto):</p>
<p style="text-align: justify;">Searching for &#8216;TEST-NODE':</p>
<p></p><pre class="crayon-plain-tag">:~&gt; python
Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import boto
&gt;&gt;&gt; import boto.ec2
&gt;&gt;&gt; conn = boto.ec2.connect_to_region('us-east-1', aws_access_key_id='', aws_secret_access_key='')
&gt;&gt;&gt; reservations = conn.get_all_instances(filters = {'instance-state-name' : 'running', "tag:Name": "*" + 'TEST-NODE' + "*"})
&gt;&gt;&gt; for r in reservations:
...     for i in r.instances:
...             print i.tags['Name']
...
TEST-NODE-1
&gt;&gt;&gt; ^D
:~&gt;</pre><p>Searching for &#8216;test-node':</p><pre class="crayon-plain-tag">:~&gt; python
Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import boto
&gt;&gt;&gt; import boto.ec2
&gt;&gt;&gt; conn = boto.ec2.connect_to_region('us-east-1', aws_access_key_id='', aws_secret_access_key='')
&gt;&gt;&gt; reservations = conn.get_all_instances(filters = {'instance-state-name' : 'running', "tag:Name": "*" + 'test-node' + "*"})
&gt;&gt;&gt; for r in reservations:
...     for i in r.instances:
...             print i.tags['Name']
...
test-node-5
&gt;&gt;&gt; ^D
:~&gt;</pre><p></p>
<p style="text-align: justify;">Moral of the story: <strong>ALWAYS VERIFY/ENFORCE THAT DATA IS PROPERLY FORMATTED!</strong></p>
<p style="text-align: justify;">There are multiple possible solutions to this issue. With the cost of few extra cycles one can make sure proper comparison is implemented:</p>
<p></p><pre class="crayon-plain-tag">:~&gt; python
Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import boto
&gt;&gt;&gt; import boto.ec2
&gt;&gt;&gt; conn = boto.ec2.connect_to_region('us-east-1', aws_access_key_id='', aws_secret_access_key='')
&gt;&gt;&gt; reservations = conn.get_all_instances(filters = {'instance-state-name' : 'running'})
&gt;&gt;&gt; for r in reservations:
...     for i in r.instances:
...             if 'test-node'.upper() in i.tags['Name'].upper():
...                     print i.tags['Name']
...
TEST-NODE-1
TEST-Node-2
TEST-node-3
test-node-5
&gt;&gt;&gt; ^D
:~&gt;</pre><p>References</p>
<ul>
<li><a href="http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html" target="_blank">http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html</a></li>
</ul>
<div class="rpbt_shortcode">
<h3>Related Posts</h3>
<ul>
					
			<li><a href="http://blog.xi-group.com/2015/01/small-tip-how-to-use-aws-cli-filter-parameter/">Small Tip: How to use AWS CLI &#8216;&#8211;filter&#8217; parameter</a></li>
					
			<li><a href="http://blog.xi-group.com/2014/11/small-tip-how-to-use-block-device-mappings-to-manage-instance-volumes-with-aws-cli/">Small Tip: How to use &#8211;block-device-mappings to manage instance volumes with AWS CLI</a></li>
					
			<li><a href="http://blog.xi-group.com/2014/07/small-tip-how-to-use-aws-cli-to-start-spot-instances-with-userdata/">Small Tip: How to use AWS CLI to start Spot instances with UserData</a></li>
					
			<li><a href="http://blog.xi-group.com/2014/07/small-tip-aws-announces-t2-instance-types/">Small Tip: AWS announces T2 instance types</a></li>
					
			<li><a href="http://blog.xi-group.com/2014/06/small-tip-ebs-volume-allocation-time-is-linear-to-the-size-and-unrelated-to-the-instance-type/">Small Tip: EBS volume allocation time is linear to the size and unrelated to the instance type</a></li>
			</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.xi-group.com/2014/06/small-tip-aws-tools-are-case-sensitive-aws-web-interface-is-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
