<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.2.0">Jekyll</generator><link href="http://0.0.0.0:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://0.0.0.0:4000/" rel="alternate" type="text/html" /><updated>2022-11-19T00:46:45-06:00</updated><id>http://0.0.0.0:4000/feed.xml</id><title type="html">Adam Yells at Cloud</title><subtitle>This is my general purpose tech blog. I sincerly hope you find what you&apos;re looking for here...</subtitle><author><name>Adam Kierstein</name><email>abkierstein@gmail.com</email></author><entry><title type="html">SRERC</title><link href="http://0.0.0.0:4000/blog/2022/11/18/srerc.html" rel="alternate" type="text/html" title="SRERC" /><published>2022-11-18T21:34:00-06:00</published><updated>2022-11-18T21:34:00-06:00</updated><id>http://0.0.0.0:4000/blog/2022/11/18/srerc</id><content type="html" xml:base="http://0.0.0.0:4000/blog/2022/11/18/srerc.html">&lt;blockquote&gt;
  &lt;p&gt;My collection of shareable code, snippets, documentation, etc.
https://github.com/abkierstein/srerc&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I decided to host a few sharable tips &amp;amp; tricks I’ve picked up outside of this blog in the srerc repo.&lt;/p&gt;

&lt;p&gt;Check it out for references like…&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/abkierstein/srerc/blob/main/aws/secrets_manager/secrets_manager_kms.md#define-a-kms-key-for-use-with-secrets-manager&quot;&gt;Define a KMS key for use with Secrets Manager&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/abkierstein/srerc/blob/main/aws/iam/admin_user.md#reusble-admin-user&quot;&gt;Reusble IAM admin user&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/abkierstein/srerc/blob/main/shell/ssh.md#generate-an-ssh-key-with-no-input&quot;&gt;Generate an SSH key without input&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Adam Kierstein</name><email>abkierstein@gmail.com</email></author><category term="blog" /><summary type="html">My collection of shareable code, snippets, documentation, etc. https://github.com/abkierstein/srerc</summary></entry><entry><title type="html">Blog Init</title><link href="http://0.0.0.0:4000/blog/2021/01/17/blog-init.html" rel="alternate" type="text/html" title="Blog Init" /><published>2021-01-17T15:17:00-06:00</published><updated>2021-01-17T15:17:00-06:00</updated><id>http://0.0.0.0:4000/blog/2021/01/17/blog-init</id><content type="html" xml:base="http://0.0.0.0:4000/blog/2021/01/17/blog-init.html">&lt;h1 id=&quot;yet-another-tech-blog&quot;&gt;Yet another tech blog…&lt;/h1&gt;

&lt;p&gt;I’ve wanted to start a blog as a place to document things I couldn’t easily find answers to on the internet. I’d also like to use this opportunity to document personal projects and potentially rant about this and that. This post falls under documenting a personal project as there’s nothing here I’m covering that isn’t mostly covered in references below.&lt;/p&gt;

&lt;h2 id=&quot;blog-backend&quot;&gt;Blog backend&lt;/h2&gt;
&lt;p&gt;I specifically searched for a static hosting technology for the blog so I could serve something out of s3 and not worry about a complex site backend. A short amount of research later and &lt;a href=&quot;https://jekyllrb.com/&quot;&gt;jekyll&lt;/a&gt; seemed to be:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Widely used&lt;/li&gt;
  &lt;li&gt;Well documented&lt;/li&gt;
  &lt;li&gt;Allows pages to be written in markdown&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So far, I’m fairly happy with jekyll. There’s a bit of learning curve to it and I claim no mastery of it yet but this blog is as good enough as a reason as any to kick the tires on it.&lt;/p&gt;

&lt;h2 id=&quot;stack-overview&quot;&gt;Stack Overview&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/assets/images/2021-01-17-blog-init_stack-diagram.jpg&quot; alt=&quot;diagram&quot; /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Jekyll: static website technology&lt;/li&gt;
  &lt;li&gt;S3: AWS hosted static object store for jekyll contents&lt;/li&gt;
  &lt;li&gt;Cloudfront: AWS hosted distribution network used to front S3 and for SSL termination.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As of writing this post, the blog and all of its infrastructure are &lt;a href=&quot;https://gitlab.com/abkierstein/blog&quot;&gt;publicly visible on my Gitlab&lt;/a&gt;. Along with the desire to host a static site in s3, I wanted the site to have a valid SSL cert and of course it was going to be defined in &lt;a href=&quot;https://gitlab.com/abkierstein/blog/-/tree/master/terraform&quot;&gt;Terraform&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While I didn’t find an end-to-end guide on how to achieve my goal here, the blogs below helped me out a good amount:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.learnaws.org/2017/10/22/create-site-aws-using-s3/&quot;&gt;learnaws.org&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.deployawebsite.com/static-sites/s3-terraform/dns/&quot;&gt;deployawebsite.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I may write up a full guide on how I’ve implemented the blog once I get a better handle on Jekyll.&lt;/p&gt;

&lt;h2 id=&quot;getting-indexed&quot;&gt;Getting Indexed&lt;/h2&gt;

&lt;p&gt;I’m showing my hand a little bit here but this is the first site I’ve hosted for public consumption. I didn’t even know I needed to opt-in to google’s indexing…
The link below was a huge help in getting this setup:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://victor2code.github.io/blog/2019/07/04/jekyll-github-pages-appear-on-Google.html&quot;&gt;victor2code.github.io&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This view into a site’s performance and usage is super interesting. I didn’t expect to get so much data or insight into the site and am kinda tickled about it. The screenshot below shows some of the information provided.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/2021-01-17-blog-init_google-analytics.jpg&quot; alt=&quot;google-analytics&quot; /&gt;&lt;/p&gt;</content><author><name>Adam Kierstein</name><email>abkierstein@gmail.com</email></author><category term="blog" /><summary type="html">Yet another tech blog…</summary></entry><entry><title type="html">AWS Elasticsearch Maximum Shards Per Index</title><link href="http://0.0.0.0:4000/blog/2021/01/11/AWS-ES-MAX-SHARDS.html" rel="alternate" type="text/html" title="AWS Elasticsearch Maximum Shards Per Index" /><published>2021-01-11T19:30:00-06:00</published><updated>2021-01-11T19:30:00-06:00</updated><id>http://0.0.0.0:4000/blog/2021/01/11/AWS-ES-MAX-SHARDS</id><content type="html" xml:base="http://0.0.0.0:4000/blog/2021/01/11/AWS-ES-MAX-SHARDS.html">&lt;p&gt;The intent of this post is to help answer the question: How many shards per index can a multi-az/zone-aware AWS Elasticsearch with ‘routing.allocation.total_shards_per_node’ enabled handle? Heck of a question, I’m not sure of another way to phrase that as a one-liner…&lt;/p&gt;

&lt;p&gt;As you may already know visiting this post, with the elasticsearch index setting ‘routing.allocation.total_shards_per_node’, assigning more shards than can be routed in the cluster will result in an index going yellow (replica shards can’t be allocated) or even red (if primary shards can’t be allocated).&lt;/p&gt;

&lt;p&gt;Background: I use AWS ES as the E in an ELK stack. My log indices can get REALLY busy and since AWS ES &lt;a href=&quot;https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-es-operations.html#es_version_api_notes&quot;&gt;severly limits options on manually routing/balancing shards&lt;/a&gt;, using ‘routing.allocation.total_shards_per_node’ is one way I can distribute R/W load among the nodes of the cluster. I also operate this cluster AZ aware across 3 AZs, so AWS ES auto-configures zone/shard awareness and I’ve yet to find a good white paper on how AWS ES specifically implements this shard awareness in opendistro &lt;a href=&quot;https://aws.amazon.com/blogs/opensource/open-distro-elasticsearch-shard-allocation/&quot;&gt;this is about as good as I’ve found&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Problem: In a multi-AZ AWS ES cluster, what is the maximum number of shards I can request in an index and have AWS allocate them appropriately?&lt;/p&gt;

&lt;p&gt;This deserves some testing…&lt;/p&gt;

&lt;p&gt;Goal: Create a repeatable formula that tells me exactly how many shards I can request from a multi-az aware ES cluster.&lt;/p&gt;

&lt;p&gt;Approach: Create real multi-AZ zone aware clusters, and with an index setting of ‘routing.allocation.total_shards_per_node: 1’, create indices with more and more shards until an index when yellow. At that point, I know with a cluster of size X, an index can have Y - 1 shards and allocate primary and replicas just fine.&lt;/p&gt;

&lt;p&gt;Here’s an example CURL to create an index&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;curl &lt;span class=&quot;nt&quot;&gt;--request&lt;/span&gt; PUT &lt;span class=&quot;s1&quot;&gt;&apos;http://&amp;lt;yourclusteraddresshere&amp;gt;:&amp;lt;port&amp;gt;/index-foo&apos;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;--header&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;Content-Type: application/json&apos;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;--data-raw&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;
{
    &quot;settings&quot; : {
        &quot;index&quot; : {
            &quot;number_of_shards&quot; : 5,
            &quot;routing.allocation.total_shards_per_node&quot;: 1,
            &quot;number_of_replicas&quot; : 1

        }
    }
}
&apos;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Time to break out the spreadsheet…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/2021-01-11-es-max-shards-per-index-spreadsheet.jpg&quot; alt=&quot;spreadsheet&quot; /&gt;&lt;/p&gt;

&lt;p&gt;First attempt I went a little off the deep end with my theory… It didn’t hold up on trial 2 but a new formula was derived which did!&lt;/p&gt;

&lt;p&gt;Result:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Number of Nodes / 2&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Shards Per Node

&lt;span class=&quot;c&quot;&gt;# Or what I assume actually is...&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;Number of Nodes / &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;1 primary shard + N replica shards&lt;span class=&quot;o&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;*&lt;/span&gt; Shards Per Node&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So given a cluster of 40 nodes, I could request a maximum of 20 shards before the index went yellow. Please note that increasing shards adds additional lucine indices for ES to keep track of, and there’s a balancing point I won’t get into regarding optimal &amp;amp; consistent sizes for ALL indices in your cluster.&lt;/p&gt;

&lt;p&gt;Documentation dump:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-bp.html&quot;&gt;AWS ES Best Practices&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://aws.amazon.com/blogs/opensource/open-distro-elasticsearch-shard-allocation/&quot;&gt;Open Distro Shard Allocation&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cluster.html#shard-allocation-awareness&quot;&gt;ES Allocation Awareness&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Adam Kierstein</name><email>abkierstein@gmail.com</email></author><category term="blog" /><summary type="html">The intent of this post is to help answer the question: How many shards per index can a multi-az/zone-aware AWS Elasticsearch with ‘routing.allocation.total_shards_per_node’ enabled handle? Heck of a question, I’m not sure of another way to phrase that as a one-liner…</summary></entry><entry><title type="html">Hello, World!</title><link href="http://0.0.0.0:4000/blog/2021/01/09/First-Post.html" rel="alternate" type="text/html" title="Hello, World!" /><published>2021-01-09T18:44:58-06:00</published><updated>2021-01-09T18:44:58-06:00</updated><id>http://0.0.0.0:4000/blog/2021/01/09/First-Post</id><content type="html" xml:base="http://0.0.0.0:4000/blog/2021/01/09/First-Post.html">&lt;p&gt;Example post&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/sh&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;</content><author><name>Adam Kierstein</name><email>abkierstein@gmail.com</email></author><category term="blog" /><summary type="html">Example post</summary></entry></feed>