<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ECS Compose-X - Blog (Posts about AWS CloudFormation)</title><link>https://blog.compose-x.io/</link><description></description><atom:link href="https://blog.compose-x.io/categories/aws-cloudformation.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2021 &lt;a href="mailto:JohnPreston@users.noreply.github.com"&gt;https://github.com/johnpreston&lt;/a&gt; </copyright><lastBuildDate>Sat, 24 Jul 2021 16:39:04 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Distributed tracing with AWS X-Ray</title><link>https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html</link><dc:creator>https://github.com/johnpreston</dc:creator><description>&lt;div&gt;&lt;div class="section" id="new-feature-release-enable-aws-x-ray-for-your-containers"&gt;
&lt;h2&gt;New feature release: Enable AWS X-Ray for your containers&lt;/h2&gt;
&lt;div class="contents local topic" id="contents"&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#aws-x-ray-overview" id="id1"&gt;AWS X-Ray overview&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#how-x-ray-is-added-to-your-ecs-task" id="id2"&gt;How X-Ray is added to your ECS Task&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#secrets-are-kept-secret" id="id3"&gt;Secrets are kept secret&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#iam-policy" id="id4"&gt;IAM policy&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference internal" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#enable-x-ray-for-your-service" id="id5"&gt;Enable X-Ray for your service&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="admonition hint"&gt;
&lt;p class="admonition-title"&gt;Hint&lt;/p&gt;
&lt;p&gt;This is available since version 0.2.3&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;This post simply visits the new feature implemented in &lt;a class="reference external" href="https://pypi.org/project/ecs-composex/"&gt;ECS ComposeX&lt;/a&gt; which allows you to turn on X-Ray for your container out of the box.&lt;/p&gt;
&lt;div class="section" id="aws-x-ray-overview"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#id1"&gt;AWS X-Ray overview&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a class="reference external" href="https://aws.amazon.com/xray/"&gt;AWS X-Ray&lt;/a&gt; is what's now one of my very favorite service on AWS. It integrates very well to pretty much any language and has some predefined integration with frameworks such as &lt;a class="reference external" href="https://pypi.org/project/Flask/"&gt;Flask&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In essence, X-Ray will capture the application metrics which will enable you to identify performances issues, and also provide you with an understanding of how your services communicate
together.&lt;/p&gt;
&lt;p&gt;It will also allow you to see how your application integrates to AWS Services.&lt;/p&gt;
&lt;p&gt;The &lt;a class="reference external" href="https://aws.amazon.com/xray/"&gt;AWS X-Ray&lt;/a&gt; team also made available a Docker image that you can use in your local environments (laptops, Cloud9 etc.) and it will report metrics captured from your local environment,
so it really is flexible to integrate anywhere.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="how-x-ray-is-added-to-your-ecs-task"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#id2"&gt;How X-Ray is added to your ECS Task&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Presently, when &lt;a class="reference external" href="https://pypi.org/project/ecs-composex/"&gt;ECS ComposeX&lt;/a&gt; parses the configuration and services, it will for each service create a task definition which will contain a single container definition.
Adding X-Ray was very straight forward, using the pre-defined Docker image provided by AWS, which also comes with recommened compute reservations.&lt;/p&gt;
&lt;p&gt;When you enable X-Ray for your service in ECS ComposeX, it simply is going to add that extra container definition.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="secrets-are-kept-secret"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#id3"&gt;Secrets are kept secret&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Because I care about security, and I am sure you do too, in the code is implemented to ensure that the X-Ray container will not be exposed with Secrets.
For example, if you service was linked to a RDS DB, which would expose the secret as an environment variable to the container, the X-Ray container is specifically identified
to not have access to that secret too.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="iam-policy"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#id4"&gt;IAM policy&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The IAM policy that allows the X-Ray container / app to communicate with the X-Ray service is added to the IAM Task Role.&lt;/p&gt;
&lt;pre class="code json"&gt;&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-1" name="rest_code_a6728494602848d7b1a25d780a48e0a1-1"&gt;&lt;/a&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-2" name="rest_code_a6728494602848d7b1a25d780a48e0a1-2"&gt;&lt;/a&gt;    &lt;span class="nt"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-3" name="rest_code_a6728494602848d7b1a25d780a48e0a1-3"&gt;&lt;/a&gt;    &lt;span class="nt"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-4" name="rest_code_a6728494602848d7b1a25d780a48e0a1-4"&gt;&lt;/a&gt;        &lt;span class="p"&gt;{&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-5" name="rest_code_a6728494602848d7b1a25d780a48e0a1-5"&gt;&lt;/a&gt;            &lt;span class="nt"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-6" name="rest_code_a6728494602848d7b1a25d780a48e0a1-6"&gt;&lt;/a&gt;                &lt;span class="s2"&gt;"xray:PutTraceSegments"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-7" name="rest_code_a6728494602848d7b1a25d780a48e0a1-7"&gt;&lt;/a&gt;                &lt;span class="s2"&gt;"xray:PutTelemetryRecords"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-8" name="rest_code_a6728494602848d7b1a25d780a48e0a1-8"&gt;&lt;/a&gt;                &lt;span class="s2"&gt;"xray:GetSamplingRules"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-9" name="rest_code_a6728494602848d7b1a25d780a48e0a1-9"&gt;&lt;/a&gt;                &lt;span class="s2"&gt;"xray:GetSamplingTargets"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-10" name="rest_code_a6728494602848d7b1a25d780a48e0a1-10"&gt;&lt;/a&gt;                &lt;span class="s2"&gt;"xray:GetSamplingStatisticSummaries"&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-11" name="rest_code_a6728494602848d7b1a25d780a48e0a1-11"&gt;&lt;/a&gt;            &lt;span class="p"&gt;],&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-12" name="rest_code_a6728494602848d7b1a25d780a48e0a1-12"&gt;&lt;/a&gt;            &lt;span class="nt"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-13" name="rest_code_a6728494602848d7b1a25d780a48e0a1-13"&gt;&lt;/a&gt;                &lt;span class="s2"&gt;"arn:${AWS::Partition}:xray:${AWS::Region}:${AWS::AccountId}:group/*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-14" name="rest_code_a6728494602848d7b1a25d780a48e0a1-14"&gt;&lt;/a&gt;                &lt;span class="s2"&gt;"arn:${AWS::Partition}:xray:${AWS::Region}:${AWS::AccountId}:sampling-rule/*"&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-15" name="rest_code_a6728494602848d7b1a25d780a48e0a1-15"&gt;&lt;/a&gt;            &lt;span class="p"&gt;],&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-16" name="rest_code_a6728494602848d7b1a25d780a48e0a1-16"&gt;&lt;/a&gt;            &lt;span class="nt"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-17" name="rest_code_a6728494602848d7b1a25d780a48e0a1-17"&gt;&lt;/a&gt;        &lt;span class="p"&gt;}&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-18" name="rest_code_a6728494602848d7b1a25d780a48e0a1-18"&gt;&lt;/a&gt;    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;a id="rest_code_a6728494602848d7b1a25d780a48e0a1-19" name="rest_code_a6728494602848d7b1a25d780a48e0a1-19"&gt;&lt;/a&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="enable-x-ray-for-your-service"&gt;
&lt;h3&gt;&lt;a class="toc-backref" href="https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html#id5"&gt;Enable X-Ray for your service&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Enable or disable locally for a specific service&lt;/p&gt;
&lt;pre class="code yaml"&gt;&lt;a id="rest_code_68241095b39d404fb37f3edcd50e66c0-1" name="rest_code_68241095b39d404fb37f3edcd50e66c0-1"&gt;&lt;/a&gt;&lt;span class="nt"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_68241095b39d404fb37f3edcd50e66c0-2" name="rest_code_68241095b39d404fb37f3edcd50e66c0-2"&gt;&lt;/a&gt;  &lt;span class="nt"&gt;serviceA&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_68241095b39d404fb37f3edcd50e66c0-3" name="rest_code_68241095b39d404fb37f3edcd50e66c0-3"&gt;&lt;/a&gt;    &lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;link_to_image&lt;/span&gt;
&lt;a id="rest_code_68241095b39d404fb37f3edcd50e66c0-4" name="rest_code_68241095b39d404fb37f3edcd50e66c0-4"&gt;&lt;/a&gt;    &lt;span class="nt"&gt;configs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_68241095b39d404fb37f3edcd50e66c0-5" name="rest_code_68241095b39d404fb37f3edcd50e66c0-5"&gt;&lt;/a&gt;      &lt;span class="nt"&gt;x-ray&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_68241095b39d404fb37f3edcd50e66c0-6" name="rest_code_68241095b39d404fb37f3edcd50e66c0-6"&gt;&lt;/a&gt;        &lt;span class="nt"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;true&lt;/span&gt;
&lt;/pre&gt;&lt;p&gt;Enable for all services from the top level:&lt;/p&gt;
&lt;pre class="code yaml"&gt;&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-1" name="rest_code_c6f1325819d54b76b13761c95f5215af-1"&gt;&lt;/a&gt;&lt;span class="nt"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-2" name="rest_code_c6f1325819d54b76b13761c95f5215af-2"&gt;&lt;/a&gt;  &lt;span class="nt"&gt;serviceA&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-3" name="rest_code_c6f1325819d54b76b13761c95f5215af-3"&gt;&lt;/a&gt;    &lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;link_to_image&lt;/span&gt;
&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-4" name="rest_code_c6f1325819d54b76b13761c95f5215af-4"&gt;&lt;/a&gt;
&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-5" name="rest_code_c6f1325819d54b76b13761c95f5215af-5"&gt;&lt;/a&gt;&lt;span class="nt"&gt;configs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-6" name="rest_code_c6f1325819d54b76b13761c95f5215af-6"&gt;&lt;/a&gt;  &lt;span class="nt"&gt;composex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-7" name="rest_code_c6f1325819d54b76b13761c95f5215af-7"&gt;&lt;/a&gt;    &lt;span class="nt"&gt;x-ray&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;a id="rest_code_c6f1325819d54b76b13761c95f5215af-8" name="rest_code_c6f1325819d54b76b13761c95f5215af-8"&gt;&lt;/a&gt;      &lt;span class="nt"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="l l-Scalar l-Scalar-Plain"&gt;true&lt;/span&gt;
&lt;/pre&gt;&lt;p&gt;And yes, it is as simple as that.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="what-is-next"&gt;
&lt;h2&gt;What is next ?&lt;/h2&gt;
&lt;p&gt;Currently working on implement some more fundamentals features coming from the Docker compose definition and implementing helpers that will simplify Scaling defintions of the services.&lt;/p&gt;
&lt;p&gt;Your feedback is most welcome and this project features will be prioritized based on what's needed from its users.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</description><category>AWS</category><category>AWS CloudFormation</category><category>AWS ECS</category><category>AWS X-Ray</category><category>ECS ComposeX</category><guid>https://blog.compose-x.io/posts/get-your-apm-with-aws-x-ray/index.html</guid><pubDate>Tue, 19 May 2020 11:44:18 GMT</pubDate></item></channel></rss>