<?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>Labs archivos - Geko Cloud</title>
	<atom:link href="https://geko.cloud/en/blog/labs/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Servicios de consultoría cloud y devops</description>
	<lastBuildDate>Thu, 12 Jan 2023 08:42:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.7</generator>

<image>
	<url>https://geko.cloud/wp-content/uploads/2021/08/cropped-geko-fav-150x150.png</url>
	<title>Labs archivos - Geko Cloud</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Patching equipment with Patch Manager</title>
		<link>https://geko.cloud/en/patching-equipment-with-patch-manager/</link>
					<comments>https://geko.cloud/en/patching-equipment-with-patch-manager/#respond</comments>
		
		<dc:creator><![CDATA[Xènia Adan]]></dc:creator>
		<pubDate>Thu, 12 Jan 2023 08:36:10 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=9401</guid>

					<description><![CDATA[<p>Patching equipment with Patch Manager Introduction to SSM SSM is the acronym for Systems Manager, a set of tools that make our lives easier, not only for accessing machines through a virtual console, but also for executing remote commands, extracting records from the equipment, and of course , apply updates. With the SSM software suite, [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/patching-equipment-with-patch-manager/">Patching equipment with Patch Manager</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Patching equipment with Patch Manager</h2>
<h2>Introduction to SSM</h2>
<p>SSM is the acronym for Systems Manager, a set of tools that make our lives easier, not only for accessing machines through a virtual console, but also for executing remote commands, extracting records from the equipment, and of course , apply updates.</p>
<p>With the SSM software suite, you can update not only EC2 instances, but also on-prem computers, as well as virtual machines, on-the-edge (IoT) computers such as raspberrys, etc.</p>
<p>Systems Manager is a service that runs an agent on the computer itself (ec2 / on-prem, etc), in the same way as virtual agents in VMware environments, used to extract metrics from the instances, but in the case of SSM the console management is remote, or what is the same, it is divided into different end-points. That is why the agent must communicate with the SSM service over the network. The computers that want to be managed must have not only the agent installed but also network connectivity to reach the AWS SSM endpoints.</p>
<p>In this article we have used a couple of EC2 instances, one Linux and one Windows:</p>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-9294 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen2-1.png" alt="" width="713" height="99" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen2-1.png 713w, https://geko.cloud/wp-content/uploads/2023/01/Imagen2-1-300x42.png 300w" sizes="(max-width: 713px) 100vw, 713px" /></p>
<p>&nbsp;</p>
<p>For Linux we have used a RedHat AMI, and in the case of the Windows computer, it is version 2019.</p>
<h2>Role for SSM</h2>
<p>In order for the computer to communicate with SSM, a role is required. For this reason we are going to generate a new &#8220;service role&#8221;, accessing the IAM section and selecting the &#8220;Roles&#8221; option and clicking on the &#8220;Create role&#8221; button:</p>
<p><img decoding="async" class="alignnone wp-image-9297 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen3-1.png" alt="" width="694" height="307" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen3-1.png 694w, https://geko.cloud/wp-content/uploads/2023/01/Imagen3-1-300x133.png 300w" sizes="(max-width: 694px) 100vw, 694px" /></p>
<p>We select the &#8220;AWS Service&#8221; as &#8220;Trusted entity&#8221;, and below in the &#8220;Use case&#8221; section, the EC2 service. We select the following and add the policies that are necessary:</p>
<p><img decoding="async" class="alignnone wp-image-9299 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen4m-1.png" alt="" width="452" height="105" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen4m-1.png 452w, https://geko.cloud/wp-content/uploads/2023/01/Imagen4m-1-300x70.png 300w" sizes="(max-width: 452px) 100vw, 452px" /></p>
<p>To do this, enter the name &#8220;ssm&#8221; in the search box, and choose from the options that appear the &#8220;AmazonSSMManagedInstanceCore&#8221;</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9301 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen5l.png" alt="" width="567" height="344" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen5l.png 567w, https://geko.cloud/wp-content/uploads/2023/01/Imagen5l-300x182.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></p>
<p>We assign the name we want and make sure that in the &#8220;trusted entities&#8221; section, the value of &#8220;principal&#8221; selected is the service &#8220;ec2.amazonaws.com&#8221;, the service with which this role is going to be invoked and to which we are giving permission:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9304 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen6z-1.png" alt="" width="715" height="256" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen6z-1.png 715w, https://geko.cloud/wp-content/uploads/2023/01/Imagen6z-1-300x107.png 300w" sizes="(max-width: 715px) 100vw, 715px" /></p>
<p>The next step will be to add this role to the instances. The easiest way is to mark the instance to be modified from the panel, as shown in the image.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9307 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen7a-1.png" alt="" width="691" height="171" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen7a-1.png 691w, https://geko.cloud/wp-content/uploads/2023/01/Imagen7a-1-300x74.png 300w" sizes="(max-width: 691px) 100vw, 691px" /></p>
<p>In the dropdown, assign it the role that we just created.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9309 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen8s-1.png" alt="" width="567" height="311" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen8s-1.png 567w, https://geko.cloud/wp-content/uploads/2023/01/Imagen8s-1-300x165.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></p>
<p><strong>EC2 instances / managed nodes</strong></p>
<p>In our case, we deployed a RedHat machine for the Linux variety for a reason: The official AMIs distributed by RedHat do not have the agent built-in, just like Windows AMIs distributed by Microsoft, or Amazon Linux AMIs do.</p>
<p>In case our distribution is agentless, it can be installed manually. Check the following link to see which distributions are supported:</p>
<p><a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html" target="_blank" rel="noopener">https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html</a></p>
<p>In the case of RedHat we will proceed to install it with a command like the following:</p>
<p>sudo yum install -y <a href="https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm">https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm</a></p>
<p>&nbsp;</p>
<p>There are also binaries available for installing the agents for Windows or MacOS environments.</p>
<p>&nbsp;</p>
<h2>Fleet Manager</h2>
<p>Now that we have the computers with the SSM agent installed and with the associated &#8220;service role&#8221;, we could access the &#8220;fleet manager&#8221; section, where the computers managed with SSM are displayed as a record, both EC2 computers and on-prem equipment, etc. This tool is within the SSM options:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9311 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen9-1.png" alt="" width="183" height="502" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen9-1.png 183w, https://geko.cloud/wp-content/uploads/2023/01/Imagen9-1-109x300.png 109w" sizes="(max-width: 183px) 100vw, 183px" /></p>
<p>&nbsp;</p>
<p>The devices managed through SSM are called nodes, which is why, in the view of this service, the registered devices are identified in the &#8220;Node Id&#8221; column:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9313 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen10-1.png" alt="" width="706" height="111" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen10-1.png 706w, https://geko.cloud/wp-content/uploads/2023/01/Imagen10-1-300x47.png 300w" sizes="(max-width: 706px) 100vw, 706px" /></p>
<p>The computers that appear are those that are registered in the current region. Keep in mind that AWS SSM is a regional service, which means that if we have an account in several regions, it will be necessary to repeat the process described in this article for each region independently.</p>
<p>Like all software, the SSM agent receives constant improvements. It is therefore recommended to enable automatic updating in the &#8220;settings&#8221; section:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9317 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen11-1.png" alt="" width="680" height="178" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen11-1.png 680w, https://geko.cloud/wp-content/uploads/2023/01/Imagen11-1-300x79.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>&nbsp;</p>
<h2 style="text-align: justify;"><span lang="ES-TRAD">Baselines</span></h2>
<p>Baselines are statements that define a certain level of compliance with a security policy. In the &#8220;patch manager&#8221; service there are different &#8220;baselines&#8221;, but it is highly recommended to create your own one with the configurations that interest us. It is a really simple process.<br />
To access the “baselines” section, go to “Node Management” and select the “Patch Manager” option:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-9319" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen12-1.png" alt="" width="174" height="279" /></p>
<p>And on the screen that appears, access the &#8220;View predefined baselines&#8221; button</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9321 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen13-1.png" alt="" width="641" height="229" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen13-1.png 641w, https://geko.cloud/wp-content/uploads/2023/01/Imagen13-1-300x107.png 300w" sizes="(max-width: 641px) 100vw, 641px" /></p>
<p>In the &#8220;baselines&#8221; view, there are a lot of them, each one for a different operating system. It is at this moment when we are going to create a personalized one. To do this, click on the “Create patch baseline” button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9323 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen14-1.png" alt="" width="567" height="119" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen14-1.png 567w, https://geko.cloud/wp-content/uploads/2023/01/Imagen14-1-300x63.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></p>
<p>&nbsp;</p>
<p>In the new section, select a name and an OS family that will be associated with the &#8220;baseline&#8221;:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9325 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen15-1.png" alt="" width="567" height="299" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen15-1.png 567w, https://geko.cloud/wp-content/uploads/2023/01/Imagen15-1-300x158.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></p>
<p>&nbsp;</p>
<p>Define the version of the OS, as well as other aspects that will define the level of compliance:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9328 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen17-1.png" alt="" width="507" height="398" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen17-1.png 507w, https://geko.cloud/wp-content/uploads/2023/01/Imagen17-1-300x236.png 300w" sizes="(max-width: 507px) 100vw, 507px" /></p>
<p>There are options such as “auto approval”, which allow you to approve the installation of a certain update, after a few days of its publication, or after a certain date, thus avoiding that day 0 patches, not very tested, could break stability of the teams. This would even allow PRE or TEST teams to install patches days before production teams as &#8220;canary testing&#8221;.</p>
<p>Just as important is the package exceptions section. This prevents the installation of certain packages that can break the service (systems with hand-compiled kernels, Windows packages that don&#8217;t get along with any other third-party program, etc).</p>
<p>To add exceptions the following format must be used:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9331 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen18-1.png" alt="" width="715" height="136" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen18-1.png 715w, https://geko.cloud/wp-content/uploads/2023/01/Imagen18-1-300x57.png 300w" sizes="(max-width: 715px) 100vw, 715px" /></p>
<p>&nbsp;</p>
<p>At this moment we already have our own “baseline”. When the &#8220;baselines&#8221; are your own, to find them later, you have to specify that we are the owner. To do this, in the baseline search engine, specify “Owner: Self” as shown below:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9333 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen19-1.png" alt="" width="713" height="113" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen19-1.png 713w, https://geko.cloud/wp-content/uploads/2023/01/Imagen19-1-300x48.png 300w" sizes="(max-width: 713px) 100vw, 713px" /></p>
<p>Otherwise the default view only shows standard baselines provided by AWS.</p>
<p>&nbsp;</p>
<h2 style="text-align: justify;"><span lang="ES-TRAD">Patch groups</span></h2>
<p>Once we have defined the &#8220;baselines&#8221;, we are going to define the &#8220;patch groups&#8221;. A &#8220;patch group&#8221; establishes the relationship between the &#8220;baselines&#8221; and the equipment on which they are going to be applied, depending on the value of a tag that we will specify later in the equipment.</p>
<p>To create a &#8220;patch group&#8221;, it is very simple, we just have to select the &#8220;baseline&#8221; that we have just created, we display the &#8220;Actions&#8221; menu and select the &#8220;Modify patch groups&#8221; option.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9406 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/1111.png" alt="" width="710" height="141" srcset="https://geko.cloud/wp-content/uploads/2023/01/1111.png 710w, https://geko.cloud/wp-content/uploads/2023/01/1111-300x60.png 300w" sizes="(max-width: 710px) 100vw, 710px" /></p>
<p>A section will open to generate the patch groups, entering a name. In our case “Windows_Production”</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9335 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen21-1.png" alt="" width="701" height="341" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen21-1.png 701w, https://geko.cloud/wp-content/uploads/2023/01/Imagen21-1-300x146.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></p>
<p>Once the name has been entered, taking care to respect the nomenclature, click on the &#8220;Add&#8221; button and close the wizard.</p>
<p>&nbsp;</p>
<h2 style="text-align: justify;"><span lang="ES-TRAD">Tags</span></h2>
<p>Tags are metadata that help us identify who owns a resource, a cost allocation unit, etc. In this case, with the tags we can also associate the nodes to the corresponding patch groups. For this, the same “Patch Group” tag value is always used. Eye! It is case sensitive</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9337 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen22-1.png" alt="" width="679" height="215" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen22-1.png 679w, https://geko.cloud/wp-content/uploads/2023/01/Imagen22-1-300x95.png 300w" sizes="(max-width: 679px) 100vw, 679px" /></p>
<p>We go to the instances section, select one of them, and edit the tags section to add the &#8220;Patch Group&#8221;:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9339 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen23-1.png" alt="" width="678" height="294" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen23-1.png 678w, https://geko.cloud/wp-content/uploads/2023/01/Imagen23-1-300x130.png 300w" sizes="(max-width: 678px) 100vw, 678px" /></p>
<p>If when entering the tag, we find an error of the type &#8220;&#8216;Patch Group&#8217; is not a valid tag key.&#8221;</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9341 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen24-1.png" alt="" width="688" height="103" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen24-1.png 688w, https://geko.cloud/wp-content/uploads/2023/01/Imagen24-1-300x45.png 300w" sizes="(max-width: 688px) 100vw, 688px" /></p>
<p>es necesario deshabilitar la check box de metadata tagging en la configuración de la instancia:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9344 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen25-1.png" alt="" width="520" height="456" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen25-1.png 520w, https://geko.cloud/wp-content/uploads/2023/01/Imagen25-1-300x263.png 300w" sizes="(max-width: 520px) 100vw, 520px" /></p>
<p>Dejar la casilla siguiente deseleccionada y volver a probar a añadir el tag en el equipo.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9346 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen26-1.png" alt="" width="567" height="198" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen26-1.png 567w, https://geko.cloud/wp-content/uploads/2023/01/Imagen26-1-300x105.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></p>
<p>&nbsp;</p>
<h2 style="text-align: justify;"><span lang="ES-TRAD">Maintainance Windows</span></h2>
<p>Let&#8217;s recap. At this moment we already have the instance with the SSM agent installed and the role to interact with the service. We have created our own “baseline”, and then we have assigned it to some “patch groups”. Finally we have &#8220;tagged&#8221; the instances with a tag that points directly to the &#8220;pach group&#8221; that interests us.</p>
<p>The maintenance windows are an important section because they not only contain the scheduling of the updates, but also the list of executions.</p>
<p>We are going to proceed by creating a maintenance window through the following section:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9348 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen27-1.png" alt="" width="567" height="241" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen27-1.png 567w, https://geko.cloud/wp-content/uploads/2023/01/Imagen27-1-300x128.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></p>
<p>We must enter the name for the window, and set the cron. You can establish cron expressions with the typical nomenclature or by selecting the pre-established ones of every hour or every day.</p>
<p>The values of &#8220;Duration&#8221; and &#8220;Stop initiating task&#8221; are mandatory, and it is recommended to leave them with values such as the following:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9350 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen28-1.png" alt="" width="421" height="201" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen28-1.png 421w, https://geko.cloud/wp-content/uploads/2023/01/Imagen28-1-300x143.png 300w" sizes="(max-width: 421px) 100vw, 421px" /></p>
<p>Finally, choose the time zone to match the schedules of the window with the one that interests us.</p>
<p>At the end we will have a list of the scheduled windows, and interesting data such as its next execution:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9352 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen29-1.png" alt="" width="696" height="87" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen29-1.png 696w, https://geko.cloud/wp-content/uploads/2023/01/Imagen29-1-300x38.png 300w" sizes="(max-width: 696px) 100vw, 696px" /></p>
<p>&nbsp;</p>
<h2>Patching configuration</h2>
<p>At this time we are going to carry out the process that brings together all the previous steps, and that enables the &#8220;patch manager&#8221; to carry out system updates. To do this, access the “Patch Manager” section and click on “Configure Patching”</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9354 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen30.png" alt="" width="684" height="291" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen30.png 684w, https://geko.cloud/wp-content/uploads/2023/01/Imagen30-300x128.png 300w" sizes="(max-width: 684px) 100vw, 684px" /></p>
<p>Choose the “patch groups” that you want to update:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9358 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen31-1.png" alt="" width="694" height="292" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen31-1.png 694w, https://geko.cloud/wp-content/uploads/2023/01/Imagen31-1-300x126.png 300w" sizes="(max-width: 694px) 100vw, 694px" /></p>
<p>Choose the maintenance window that was created in the previous step:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9360 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen32-1.png" alt="" width="671" height="299" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen32-1.png 671w, https://geko.cloud/wp-content/uploads/2023/01/Imagen32-1-300x134.png 300w" sizes="(max-width: 671px) 100vw, 671px" /></p>
<p>And leave the operation that best suits what we want to do. In this case we are going to choose “Scan and Install”</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9362 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen33-1.png" alt="" width="674" height="143" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen33-1.png 674w, https://geko.cloud/wp-content/uploads/2023/01/Imagen33-1-300x64.png 300w" sizes="(max-width: 674px) 100vw, 674px" /></p>
<p>At this moment, in the &#8220;dashboard&#8221; of &#8220;Patch Manager&#8221;, we should have a view of equipment pending update. The values in this section will change depending on whether there are pending packages, update failures, etc.<br />
In order to track the actions performed, we can consult them in the &#8220;Run Command&#8221;</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-9364" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen34-1.png" alt="" width="191" height="220" /></p>
<p>In this section there are two tabs. One with the commands currently running, which will come out with a clock next to it:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9366 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen35-1.png" alt="" width="689" height="104" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen35-1.png 689w, https://geko.cloud/wp-content/uploads/2023/01/Imagen35-1-300x45.png 300w" sizes="(max-width: 689px) 100vw, 689px" /></p>
<p>And another tab with the history of actions:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9368 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen36-1.png" alt="" width="686" height="187" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen36-1.png 686w, https://geko.cloud/wp-content/uploads/2023/01/Imagen36-1-300x82.png 300w" sizes="(max-width: 686px) 100vw, 686px" /></p>
<p>If in the process of installing updates, there is any package marked as restart required, the computer will restart immediately. Take this into account to establish the windows according to the needs of the business:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9370 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen37-1.png" alt="" width="676" height="471" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen37-1.png 676w, https://geko.cloud/wp-content/uploads/2023/01/Imagen37-1-300x209.png 300w" sizes="(max-width: 676px) 100vw, 676px" /></p>
<p>&nbsp;</p>
<p>After the installation of the patches, and the reboots if any, in the &#8220;dashboard&#8221; of &#8220;Patch Manager&#8221; the instances will now appear as compliant according to the &#8220;baselines&#8221; established:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9372 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen38-1.png" alt="" width="665" height="347" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen38-1.png 665w, https://geko.cloud/wp-content/uploads/2023/01/Imagen38-1-300x157.png 300w" sizes="(max-width: 665px) 100vw, 665px" /></p>
<p>&nbsp;</p>
<h2 style="text-align: justify;"><span lang="ES-TRAD">Cloudwatch</span></h2>
<p>In the command history console, we can see the executed tasks, as in this case. If we click on the id of the task, we can access its details:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9374 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen39-1.png" alt="" width="666" height="100" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen39-1.png 666w, https://geko.cloud/wp-content/uploads/2023/01/Imagen39-1-300x45.png 300w" sizes="(max-width: 666px) 100vw, 666px" /></p>
<p>Inside we can see the computers on which the action has been executed, and we can, by selecting one of those computers, see the details of the operations. To do this, select and click on the &#8220;View output&#8221; button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9376 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen40-1.png" alt="" width="686" height="206" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen40-1.png 686w, https://geko.cloud/wp-content/uploads/2023/01/Imagen40-1-300x90.png 300w" sizes="(max-width: 686px) 100vw, 686px" /></p>
<p>The operations are testing all the platforms, for this reason they will first try to execute the patching on a Windows, then on a Linux and finally on a MacOS. Therefore, to see the status of the updates, we choose the platform of the team we are consulting.</p>
<p>In the &#8220;Output&#8221; window we will see the record, but it is often truncated because it is excessively long:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9379 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen41-1.png" alt="" width="672" height="246" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen41-1.png 672w, https://geko.cloud/wp-content/uploads/2023/01/Imagen41-1-300x110.png 300w" sizes="(max-width: 672px) 100vw, 672px" /></p>
<p>If we want to consult this data, we can send it to a Cloudwatch “log group”. To do this, first we go to CloudWatch and create a &#8220;log group&#8221;:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9381 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen42-1.png" alt="" width="491" height="398" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen42-1.png 491w, https://geko.cloud/wp-content/uploads/2023/01/Imagen42-1-300x243.png 300w" sizes="(max-width: 491px) 100vw, 491px" /></p>
<p>&nbsp;</p>
<p>We put a name and specify the retention period.<br />
The second step is to modify the role of the machine so that it has permissions to write to Cloudwatch, so you will have to add an &#8220;in-line policy&#8221; like this:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9383 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen43-1.png" alt="" width="567" height="415" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen43-1.png 567w, https://geko.cloud/wp-content/uploads/2023/01/Imagen43-1-300x220.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></p>
<p>We put a name to this &#8220;policy&#8221; and save it:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9385 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen44-1.png" alt="" width="689" height="197" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen44-1.png 689w, https://geko.cloud/wp-content/uploads/2023/01/Imagen44-1-300x86.png 300w" sizes="(max-width: 689px) 100vw, 689px" /></p>
<p>Leaving the role of the team as:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9387 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen45-1.png" alt="" width="673" height="428" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen45-1.png 673w, https://geko.cloud/wp-content/uploads/2023/01/Imagen45-1-300x191.png 300w" sizes="(max-width: 673px) 100vw, 673px" /></p>
<p>We return to the system manager, section &#8220;Maintenance Window&#8221; and within the tasks (I mark the task and select edit):</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9389 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen46-1.png" alt="" width="695" height="152" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen46-1.png 695w, https://geko.cloud/wp-content/uploads/2023/01/Imagen46-1-300x66.png 300w" sizes="(max-width: 695px) 100vw, 695px" /></p>
<p>&nbsp;</p>
<p>And in the &#8220;Output Options&#8221; section, write the name of the log group where we are going to send it:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9391 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen47-1.png" alt="" width="596" height="250" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen47-1.png 596w, https://geko.cloud/wp-content/uploads/2023/01/Imagen47-1-300x126.png 300w" sizes="(max-width: 596px) 100vw, 596px" /></p>
<p>We save the changes, and from now on when selecting the output of the tasks, we will see that a link to Cloudwatch appears:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9393 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen48.png" alt="" width="667" height="292" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen48.png 667w, https://geko.cloud/wp-content/uploads/2023/01/Imagen48-300x131.png 300w" sizes="(max-width: 667px) 100vw, 667px" /></p>
<p>And if we consult that link, it will take us to the output information, but without truncating:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9395 size-full" src="https://geko.cloud/wp-content/uploads/2023/01/Imagen49-1.png" alt="" width="680" height="296" srcset="https://geko.cloud/wp-content/uploads/2023/01/Imagen49-1.png 680w, https://geko.cloud/wp-content/uploads/2023/01/Imagen49-1-300x131.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>&nbsp;</p>
<p>From Geko Cloud Consulting, we hope you liked this post and above all that you find it useful.<br />
If you need information about the Cloud and DevOps world, we invite you to contact us and keep checking our blog to find other useful posts.</p>
<p>&nbsp;</p>
<p>La entrada <a href="https://geko.cloud/en/patching-equipment-with-patch-manager/">Patching equipment with Patch Manager</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/patching-equipment-with-patch-manager/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ChatGPT: What is it and what are its implications?</title>
		<link>https://geko.cloud/en/chatgpt-what-is-it-and-what-are-its-implications/</link>
					<comments>https://geko.cloud/en/chatgpt-what-is-it-and-what-are-its-implications/#respond</comments>
		
		<dc:creator><![CDATA[Geko Cloud]]></dc:creator>
		<pubDate>Thu, 12 Jan 2023 08:35:49 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[Chatbot]]></category>
		<category><![CDATA[ChatGPT]]></category>
		<category><![CDATA[GPT-3]]></category>
		<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[Natural Language Processing]]></category>
		<category><![CDATA[NLP]]></category>
		<category><![CDATA[Social implications]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=9414</guid>

					<description><![CDATA[<p>Introduction The field of natural language processing (NLP) has made significant strides in recent years, and one of the most significant developments is the release of GPT-3 (Generative Pre-trained Transformer 3) by OpenAI. GPT-3 is the third iteration of the GPT series of models, and it has caused a significant amount of hype in the [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/chatgpt-what-is-it-and-what-are-its-implications/">ChatGPT: What is it and what are its implications?</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="flex flex-grow flex-col gap-3">
<div class="min-h-[20px] flex flex-col items-start gap-4 whitespace-pre-wrap">
<div class="markdown prose w-full break-words dark:prose-invert light">
<h2><strong>Introduction</strong></h2>
<p>The field of <a href="https://en.wikipedia.org/wiki/Natural_language_processing" target="_blank" rel="noopener">natural language processing</a> (NLP) has made significant strides in recent years, and one of the most significant developments is the release of <a href="https://en.wikipedia.org/wiki/GPT-3" target="_blank" rel="noopener">GPT-3</a> (Generative Pre-trained Transformer 3) by <a href="https://openai.com/" target="_blank" rel="noopener">OpenAI</a>. GPT-3 is the third iteration of the GPT series of models, and it has caused a significant amount of hype in the technology community due to its ability to generate human-like text with a high level of fluency and accuracy. The chatbot <a href="https://chat.openai.com" target="_blank" rel="noopener">ChatGPT</a> is one of the implementations of GPT-3, it is one of the applications in which the GPT-3 model is used.</p>
<h2><strong>Current situation</strong></h2>
<p>One of the main reasons for the hype around GPT-3 is its ability to perform a wide range of tasks with minimal fine-tuning. This includes writing coherent and well-written essays, articles, and even coding. It can also understand and respond to human language in a conversational context, making it a useful tool for chatbots and virtual assistants. This makes GPT-3 a powerful tool for a wide range of applications, from content creation to customer service.</p>
<p>Another reason for the hype is the sheer size of GPT-3. With 175 billion parameters, it is one of the largest language models to date. This large number of parameters allows GPT-3 to understand and generate text with a high level of accuracy and fluency, making it a powerful tool for language-based tasks.</p>
<p>However, it&#8217;s worth mentioning that GPT-3 also come with criticism and caution as well. One of the main concern is that since the model is so good at mimicking human writing, it could potentially be used to produce fake news and impersonate real people online. Additionally, GPT-3&#8217;s large number of parameters also makes it more prone to biases and errors that might exist in the training data. This is a concern that needs to be closely monitored and addressed, to make sure that GPT-3 is used ethically and for the benefit of society.</p>
</div>
<div class="markdown prose w-full break-words dark:prose-invert light">
<h2><strong>Future</strong></h2>
<p>The release of GPT-3 marks a significant step forward in the field of NLP and the capabilities of language models. However, this is just the beginning. As technology continues to advance, we can expect to see even larger and more advanced models in the future. These models will have even more impressive capabilities, and they will be used in an increasingly wide range of applications.</p>
<p>It is also possible that GPT-3-like models will be used to improve many other AI-related applications, such as image recognition, speech recognition and others. In addition, there could be a potential integration of GPT-3 with other AI technology such as Reinforcement learning to achieve an even more sophisticated AI system.</p>
<h2><strong>Implications</strong></h2>
<p>As AI technology continues to advance and more sophisticated language models like GPT-3 are developed, it is important to consider the broader societal implications of these trends. The ability for AI to understand and generate human-like text has the potential to revolutionize industries such as content creation, customer service, and education. However, it also raises ethical concerns about the potential for AI-generated text to be used to spread misinformation and impersonate real people.</p>
<p>Additionally, there is also the question of job displacement as AI-powered language generation becomes more advanced and more widely used. This could potentially lead to a reduction in the need for human content creators and customer service representatives, which could have significant economic consequences.</p>
<p>Another consequence is that the training data on which language models like GPT-3 is based could perpetuate any biases present in the data which could be replicated in the generated text, leading to biased output. This can have serious social implications especially when used in critical decision making applications.</p>
<h2><strong>Conclusion</strong></h2>
<p>The trend of developing sophisticated language models like GPT-3 has the potential to revolutionize many industries and improve our ability to interact with machines and use natural language. However, it&#8217;s important to consider the broader societal implications of these trends and address any ethical concerns that may arise. It&#8217;s vital to keep a close eye on the development and use of these models to ensure that they are used for the benefit of society and not to the detriment. This includes addressing the concerns about job displacement, biases in the model, and potential to spread misinformation. It&#8217;s also important to continue research on ways to mitigate these risks, such as creating more diverse training data and implementing robust veracity checking systems. Ultimately, the development of language models like GPT-3 has the potential to have a significant impact on society, and it&#8217;s essential to approach it with both excitement and caution.</p>
<h2><strong>Epilogue</strong></h2>
<p>Did you already guess it? Yes, this post was entirely written by ChatGPT! Of course we refined the results and we also gave directives to the AI about how we wanted the post to be written, but the result is purely here without any modifications <span class="HwtZe" lang="en"><span class="jCAhz ChMk0b"><span class="ryNqvb">beyond adding links to content (references)</span></span></span>. At Geko Cloud we hope this article has helped you to learn something new and continue to expand your knowledge. If you need information about <strong><a href="https://geko.cloud/en/" target="_blank" rel="noopener">Cloud and the DevOps</a> </strong>world, we invite you to <a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener"><strong>contact us</strong></a> and keep checking out <a href="https://geko.cloud/en/blog/labs/" target="_blank" rel="noopener"><strong>our blog</strong></a> in order to find other useful publications. See you soon!</p>
</div>
</div>
</div>
<p>La entrada <a href="https://geko.cloud/en/chatgpt-what-is-it-and-what-are-its-implications/">ChatGPT: What is it and what are its implications?</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/chatgpt-what-is-it-and-what-are-its-implications/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AWS: Enable EBS GP3 for eks by default</title>
		<link>https://geko.cloud/en/aws-enable-ebs-gp3-for-eks-by-default/</link>
					<comments>https://geko.cloud/en/aws-enable-ebs-gp3-for-eks-by-default/#respond</comments>
		
		<dc:creator><![CDATA[Xènia Adan]]></dc:creator>
		<pubDate>Mon, 12 Dec 2022 16:15:12 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=9257</guid>

					<description><![CDATA[<p>AWS: Enable EBS GP3 for eks by default By default when creating persistent volumes in AWS the GP2 type is created, however, for some time now we have had GP3 available, which provides us with different advantages, including cost savings. In the following table we can see a comparison of both versions: Volume type gp3 [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/aws-enable-ebs-gp3-for-eks-by-default/">AWS: Enable EBS GP3 for eks by default</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><strong>AWS: Enable EBS GP3 for eks by default</strong></h2>
<p>By default when creating persistent volumes in AWS the GP2 type is created, however, for some time now we have had GP3 available, which provides us with different advantages, including cost savings. In the following table we can see a comparison of both versions:</p>
<table>
<tbody>
<tr>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">Volume type</span></p>
</td>
<td style="text-align: center;"><span style="font-weight: 400;">gp3</span></td>
<td style="text-align: center;"><span style="font-weight: 400;">gp2</span></td>
</tr>
<tr>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">Volume size</span></p>
</td>
<td style="text-align: center;"><span style="font-weight: 400;">1 GiB – 16 TiB</span></td>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">1 GiB – 16 TiB</span></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">Baseline IOPS</span></p>
</td>
<td style="text-align: center;"><span style="font-weight: 400;">3000</span></td>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">3 IOPS/GiB (minimum 100 IOPS) to a maximum of 16,000 IOPS</span></p>
<p style="text-align: center;"><span style="font-weight: 400;">Volumes smaller than 1 TiB can also burst up to 3,000 IOPS.</span></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">Max IOPS/volume</span></p>
</td>
<td style="text-align: center;"><span style="font-weight: 400;">16,000</span></td>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">16,000</span></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">Baseline throughput</span></p>
</td>
<td style="text-align: center;"><span style="font-weight: 400;">125 MiB/s</span></td>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">Throughput limit is between 128 MiB/s and 250 MiB/s, depending on the volume size.</span></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">Max throughput/volume</span></p>
</td>
<td style="text-align: center;"><span style="font-weight: 400;">1,000 MiB/s</span></td>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">250 MiB/s</span></p>
</td>
</tr>
<tr>
<td style="text-align: center;"><span style="font-weight: 400;">Price</span></td>
<td style="text-align: center;"><span style="font-weight: 400;">$0.08/GiB-month</span></p>
<p><span style="font-weight: 400;">3,000 IOPS free and</span></p>
<p><span style="font-weight: 400;">$0.005/provisioned IOPS-month over 3,000;</span></p>
<p><span style="font-weight: 400;">125 MiB/s free and</span></p>
<p><span style="font-weight: 400;">$0.04/provisioned MiB/s-month over 125MiB/s</span></td>
<td>
<p style="text-align: center;"><span style="font-weight: 400;">$0.10/GiB-month</span></p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Here is a little howto on how we can change the default storageclass to Gp3 step by step.</p>
<p><strong>Create IAM Role</strong></p>
<p>Get OIDC provider url:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9239 size-full" src="https://geko.cloud/wp-content/uploads/2022/10/foto1-1024x96-1.png" alt="" width="1024" height="96" srcset="https://geko.cloud/wp-content/uploads/2022/10/foto1-1024x96-1.png 1024w, https://geko.cloud/wp-content/uploads/2022/10/foto1-1024x96-1-300x28.png 300w, https://geko.cloud/wp-content/uploads/2022/10/foto1-1024x96-1-768x72.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<p>&nbsp;</p>
<p>Create the following file to define the role by changing 111122223333 to our account ID, region-code to the aws region, and EXAMPLED539D4633E53DE1B71EXAMPLE with the value returned from the previous step:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9241 size-full" src="https://geko.cloud/wp-content/uploads/2022/11/foto2-1-1.png" alt="" width="760" height="640" srcset="https://geko.cloud/wp-content/uploads/2022/11/foto2-1-1.png 760w, https://geko.cloud/wp-content/uploads/2022/11/foto2-1-1-300x253.png 300w" sizes="(max-width: 760px) 100vw, 760px" /></p>
<p>&nbsp;</p>
<p>Create the role with the file created previously:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9243 size-full" src="https://geko.cloud/wp-content/uploads/2022/11/foto3-1-1.png" alt="" width="757" height="96" srcset="https://geko.cloud/wp-content/uploads/2022/11/foto3-1-1.png 757w, https://geko.cloud/wp-content/uploads/2022/11/foto3-1-1-300x38.png 300w" sizes="(max-width: 757px) 100vw, 757px" /></p>
<p>&nbsp;</p>
<p>Attach the policy to the role:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9245 size-full" src="https://geko.cloud/wp-content/uploads/2022/11/foto4-1-1.png" alt="" width="757" height="99" srcset="https://geko.cloud/wp-content/uploads/2022/11/foto4-1-1.png 757w, https://geko.cloud/wp-content/uploads/2022/11/foto4-1-1-300x39.png 300w" sizes="(max-width: 757px) 100vw, 757px" /></p>
<p>&nbsp;</p>
<p>Create the identity provider from the aws console by following these steps:<br />
1. Within IAM in the Access management section go to Identity provider &#8211; add provider &#8211; OpenID Connect<br />
2. In the Provider URL add the url obtained in point 1.a<br />
3. Click on Get thumbprint<br />
4. In audience put &#8220;sts.amazonaws.com&#8221; and click on save</p>
<p>&nbsp;</p>
<p><strong>Install aws ebs-csi-controller driver</strong></p>
<p>Create the following values.yaml</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9247 size-full" src="https://geko.cloud/wp-content/uploads/2022/11/foto5-1-2.png" alt="" width="763" height="394" srcset="https://geko.cloud/wp-content/uploads/2022/11/foto5-1-2.png 763w, https://geko.cloud/wp-content/uploads/2022/11/foto5-1-2-300x155.png 300w" sizes="(max-width: 763px) 100vw, 763px" /></p>
<p>Add the helm repo:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9249 size-full" src="https://geko.cloud/wp-content/uploads/2022/11/foto6-1-1.png" alt="" width="760" height="76" srcset="https://geko.cloud/wp-content/uploads/2022/11/foto6-1-1.png 760w, https://geko.cloud/wp-content/uploads/2022/11/foto6-1-1-300x30.png 300w" sizes="(max-width: 760px) 100vw, 760px" /></p>
<p>Install helm chart:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9251 size-full" src="https://geko.cloud/wp-content/uploads/2022/11/foto7-1-1.png" alt="" width="759" height="73" srcset="https://geko.cloud/wp-content/uploads/2022/11/foto7-1-1.png 759w, https://geko.cloud/wp-content/uploads/2022/11/foto7-1-1-300x29.png 300w" sizes="(max-width: 759px) 100vw, 759px" /></p>
<p>Once all the previous steps have been followed, we will be able to observe how the default storageclass is of the gp3 type, and from now on all the volumes will be created using this type of ebs:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-9253 size-full" src="https://geko.cloud/wp-content/uploads/2022/11/Captura-de-pantalla-2022-10-26-160544-1.png" alt="" width="1213" height="189" srcset="https://geko.cloud/wp-content/uploads/2022/11/Captura-de-pantalla-2022-10-26-160544-1.png 1213w, https://geko.cloud/wp-content/uploads/2022/11/Captura-de-pantalla-2022-10-26-160544-1-300x47.png 300w, https://geko.cloud/wp-content/uploads/2022/11/Captura-de-pantalla-2022-10-26-160544-1-1024x160.png 1024w, https://geko.cloud/wp-content/uploads/2022/11/Captura-de-pantalla-2022-10-26-160544-1-768x120.png 768w" sizes="(max-width: 1213px) 100vw, 1213px" /></p>
<p>La entrada <a href="https://geko.cloud/en/aws-enable-ebs-gp3-for-eks-by-default/">AWS: Enable EBS GP3 for eks by default</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/aws-enable-ebs-gp3-for-eks-by-default/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Dynamic nodes in Jenkins via AWS Spot Fleet</title>
		<link>https://geko.cloud/en/dynamic-nodes-in-jenkins-via-aws-spot-fleet/</link>
					<comments>https://geko.cloud/en/dynamic-nodes-in-jenkins-via-aws-spot-fleet/#respond</comments>
		
		<dc:creator><![CDATA[Miguel]]></dc:creator>
		<pubDate>Tue, 07 Jun 2022 07:27:32 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[Jenkins]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=8452</guid>

					<description><![CDATA[<p>Dynamic nodes in Jenkins via AWS Spot Fleet Provisionar nodos slave de jenkins dinámicamente gracias a aws spot fleet A few weeks ago, a customer contacted us. His request was simple: What can we do to further optimize our automated CI/CD process in Jenkins? After assesing the needs and the current infrastructure of the client, [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/dynamic-nodes-in-jenkins-via-aws-spot-fleet/">Dynamic nodes in Jenkins via AWS Spot Fleet</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Dynamic nodes in Jenkins via AWS Spot Fleet</h3>
<p>Provisionar nodos slave de jenkins dinámicamente gracias a aws spot fleet</p>
<p>A few weeks ago, a customer contacted us. His request was simple: What can we do to further optimize our automated CI/CD process in Jenkins?</p>
<p>After assesing the needs and the current infrastructure of the client, we decided to change the current paradigm in terms of task execution. Until now <a href="https://www.jenkins.io/" target="_blank" rel="noopener"><strong>Jenkins</strong></a> executed the tasks in its main node (the machine where Jenkins is running), by changing this paradigm to one based on dynamic provisioning of subordinate nodes we would gain the following benefits:</p>
<ul>
<li>Cost savings &#8211; By moving all the computational effort away from the main node. It can be hosted on a lower performance machine, reducing the overall cost of our infrastructure. The subordinate nodes would only be running during the execution of a task, also saving money while no task is running.</li>
<li>Security &#8211; As we will not execute any code on the main node, we ensure the system’s integrity even if the code has been compromised, and since it is only executed on an ephemeral instance the attacker will be isolated.</li>
<li>Performance &#8211; The subordinate node exists only to execute the task and can dedicate all of the node&#8217;s resources to it.</li>
</ul>
<p>&nbsp;</p>
<h2>Requirements</h2>
<p>For this change, we will perform the following tasks:</p>
<ul>
<li>Spot Fleet creation in AWS</li>
<li>Installation and configuration of the Jenkins plugin</li>
<li>Jenkinsfile adaptation</li>
</ul>
<p>For this publication we will make the following assumptions:</p>
<ul>
<li>We have an AWS account already set up</li>
<li>We host Jenkins on an EC2 server</li>
<li>We have knowledge of some basic Jenkins and AWS concepts</li>
</ul>
<p><span style="font-weight: 400;">That said, let&#8217;s get down to business.</span></p>
<p>&nbsp;</p>
<p>In this article on &#8220;Dynamic nodes in Jenkins via AWS Spot Fleet&#8221; we will develop all the necessary steps to obtain a good result.</p>
<h2>Creation of launch template and spot fleet</h2>
<p>An AWS Spot Fleet is nothing more than an AutoScaling Group of EC2 machines but with spot type instances &#8211; Amazon’s surplus hardware that nobody is using and that AWS sells cheaper than usual. The first step will be to create the Launch Template that the Spot Fleet will use:</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="wp-image-8409 aligncenter" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-0.png" alt="" width="795" height="413" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-0.png 1541w, https://geko.cloud/wp-content/uploads/2022/05/Spot-0-300x156.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-0-1024x532.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-0-768x399.png 768w, https://geko.cloud/wp-content/uploads/2022/05/Spot-0-1536x797.png 1536w" sizes="(max-width: 795px) 100vw, 795px" /></p>
<p>&nbsp;</p>
<p>The important items to be filled in will be:</p>
<ol>
<li>Name and description</li>
<li>AMI to use &#8211; For example Ubuntu 22</li>
<li>Type of instance to use &#8211; Choose one according to your performance needs</li>
<li>Key Pair &#8211; We will need to add it later in Jenkins</li>
<li>Network &#8211; Use the same Subnet as Jenkins if possible</li>
<li>Security Group &#8211; For the connection between nodes to be established, it is important that we give access to port 22 from the main node. The easiest way is to create a rule that allows access either from the IP of the main node (if we have a Elastic IP assigned) or from its Security Group</li>
<li>Storage &#8211; Allocate the storage according to your needs</li>
<li>User data &#8211; For the Jenkins worker to run on the subordinate node, we will need to install JRE, we also installed Docker as a requirement:</li>
</ol>
<p>&nbsp;</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:true,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}">#!/bin/bash
# Install docker
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
apt-get update
apt-get install -y docker-ce
usermod -aG docker ubuntu

# Install docker-compose
curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

#Install JRE
sudo apt install -y default-jre</pre>
</div>
<p>&nbsp;</p>
<p>Once created we will have a Launch template similar to this one:</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8413" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-2.png" alt="" width="795" height="501" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-2.png 1543w, https://geko.cloud/wp-content/uploads/2022/05/Spot-2-300x189.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-2-1024x646.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-2-768x484.png 768w, https://geko.cloud/wp-content/uploads/2022/05/Spot-2-1536x969.png 1536w" sizes="(max-width: 795px) 100vw, 795px" /></p>
<p>&nbsp;</p>
<p>Now it is time to create the Spot fleet as such:</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8411" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-1.png" alt="" width="795" height="383" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-1.png 1407w, https://geko.cloud/wp-content/uploads/2022/05/Spot-1-300x144.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-1-1024x493.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-1-768x370.png 768w" sizes="(max-width: 795px) 100vw, 795px" /></p>
<p>&nbsp;</p>
<p>In this case, the items to be filled in are:</p>
<ol>
<li>Launch parameters &#8211; Select our Launch Template created above<img loading="lazy" decoding="async" class="aligncenter wp-image-8415" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-3.png" alt="" width="795" height="245" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-3.png 1054w, https://geko.cloud/wp-content/uploads/2022/05/Spot-3-300x93.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-3-1024x316.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-3-768x237.png 768w" sizes="(max-width: 795px) 100vw, 795px" /></li>
<li>Target Capacity &#8211; Set total to 0 for now, as it will be controlled by the Jenkins plugin. Enable Maintain Target Capacity<img loading="lazy" decoding="async" class=" wp-image-8417 aligncenter" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-4.png" alt="" width="760" height="388" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-4.png 915w, https://geko.cloud/wp-content/uploads/2022/05/Spot-4-300x153.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-4-768x392.png 768w" sizes="(max-width: 760px) 100vw, 760px" /></li>
<li>Network &#8211; Assign the VPC in which the main node is hosted</li>
<li>Instance type requirements &#8211; Choose the desired instance types in Manually select instance types, a larger quantity gives a better pool from which to start Spot instances<img loading="lazy" decoding="async" class="aligncenter wp-image-8419" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-5.png" alt="" width="795" height="347" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-5.png 1060w, https://geko.cloud/wp-content/uploads/2022/05/Spot-5-300x131.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-5-1024x446.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-5-768x335.png 768w" sizes="(max-width: 795px) 100vw, 795px" /></li>
<li>Allocation strategy &#8211; Capacity Optimized</li>
</ol>
<p>And that&#8217;s it, we have created our Spot Fleet.</p>
<p>&nbsp;</p>
<h2>Installing and configuring the Jenkins plugin</h2>
<p>Before installing the plugin, we will have to create and assign a new IAM role to the instance hosting the main node so that it will be able to manage our Spot fleet:</p>
<p>&nbsp;</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;application/json&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:true,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}">{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "ec2:DescribeSpotFleetInstances",
            "ec2:ModifySpotFleetRequest",
            "ec2:CreateTags",
            "ec2:DescribeRegions",
            "ec2:DescribeInstances",
            "ec2:TerminateInstances",
            "ec2:DescribeInstanceStatus",
            "ec2:DescribeSpotFleetRequests"
         ],
         "Resource":"*"
      },
      {
         "Effect":"Allow",
         "Action":[
            "autoscaling:DescribeAutoScalingGroups",
            "autoscaling:UpdateAutoScalingGroup"
         ],
         "Resource":"*"
      },
      {
         "Effect":"Allow",
         "Action":[
            "iam:ListInstanceProfiles",
            "iam:ListRoles",
            "iam:PassRole"
         ],
         "Resource":"*"
      }
   ]
}</pre>
</div>
<p>&nbsp;</p>
<p>Once this is done, we will install the<a href="https://plugins.jenkins.io/ec2-fleet/" target="_blank" rel="noopener"><strong> ec2-fleet-plugin</strong></a> and configure it from Manage Jenkins &gt; Manage Nodes &gt; Configure Clouds &gt; Add New Cloud &gt; Amazon EC2 Fleet.</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8425" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-6.png" alt="" width="795" height="429" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-6.png 2102w, https://geko.cloud/wp-content/uploads/2022/05/Spot-6-300x162.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-6-1024x552.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-6-768x414.png 768w, https://geko.cloud/wp-content/uploads/2022/05/Spot-6-1536x829.png 1536w, https://geko.cloud/wp-content/uploads/2022/05/Spot-6-2048x1105.png 2048w" sizes="(max-width: 795px) 100vw, 795px" /></p>
<p>&nbsp;</p>
<ol>
<li>Assign a name</li>
<li>AWS Credentials &#8211; We leave this blank, since our machine already has the role described above.</li>
<li>Region &#8211; Select the region in which we host our servers.</li>
<li>EC2 Fleet &#8211;<strong> It will only appear when we assign the region and the role is assigned to the machine correct</strong>ly. Once filled in, we select our Spot fleet<img loading="lazy" decoding="async" class="aligncenter wp-image-8427" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-7.png" alt="" width="795" height="443" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-7.png 2100w, https://geko.cloud/wp-content/uploads/2022/05/Spot-7-300x167.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-7-1024x571.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-7-768x428.png 768w, https://geko.cloud/wp-content/uploads/2022/05/Spot-7-1536x856.png 1536w, https://geko.cloud/wp-content/uploads/2022/05/Spot-7-2048x1141.png 2048w" sizes="(max-width: 795px) 100vw, 795px" /></li>
<li>Upload the Private key generated in the Launch template as <strong>SSH Username with private key</strong></li>
<li>Private IP &#8211; Select if we want the main node to connect to the subordinate node using the private IP instead of the public one</li>
<li>Always Reconnect &#8211; We recommend not to enable it, as Spot instances are ephemeral by nature</li>
<li>Restrict Usage &#8211; Restrict the use of this Spot Fleet only to tasks that specify the assigned tag, regardless of the global Jenkins configuration</li>
<li>Label &#8211; The label that identifies this node cloud, useful for assigning which tasks will be executed in the Fleet<img loading="lazy" decoding="async" class="aligncenter wp-image-8429" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-8.png" alt="" width="795" height="287" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-8.png 2074w, https://geko.cloud/wp-content/uploads/2022/05/Spot-8-300x108.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-8-1024x370.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-8-768x278.png 768w, https://geko.cloud/wp-content/uploads/2022/05/Spot-8-1536x555.png 1536w, https://geko.cloud/wp-content/uploads/2022/05/Spot-8-2048x741.png 2048w" sizes="(max-width: 795px) 100vw, 795px" /></li>
<li>Number of executors &#8211; The number of simultaneous jobs that each Spot Fleet instance will be able to host</li>
<li>Max Idle Minutes Before Scaledown &#8211; The number of minutes Jenkins will keep an instance active with no pending tasks. <strong>If left at 0 Jenkins will never terminate instances, even if they are unused</strong></li>
<li>Minimum/Maximum cluster Size &#8211; The minimum and maximum quantity of instances we want the Spot fleet to have. Ideally, the minimum should be set to 0 to reduce costs</li>
</ol>
<p><span style="font-weight: 400;">Once the configuration is saved, we will have a new section in the Jenkins dashboard, which indicates the current status of our Spot Fleet.</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class=" wp-image-8431 aligncenter" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-9.png" alt="" width="336" height="349" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-9.png 700w, https://geko.cloud/wp-content/uploads/2022/05/Spot-9-289x300.png 289w" sizes="(max-width: 336px) 100vw, 336px" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2>Jenkinsfile adaptation</h2>
<p>Now that we have our Spot fleet configured, it is time to make some small changes so Jenkins uses this new type of nod. If we want it to be used systematically on a global level, we can disable the execution of tasks on the main node (the only other node in our case) from the node configuration screen.</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8433" src="https://geko.cloud/wp-content/uploads/2022/05/Spot-10.png" alt="" width="795" height="408" srcset="https://geko.cloud/wp-content/uploads/2022/05/Spot-10.png 1826w, https://geko.cloud/wp-content/uploads/2022/05/Spot-10-300x154.png 300w, https://geko.cloud/wp-content/uploads/2022/05/Spot-10-1024x526.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/Spot-10-768x395.png 768w, https://geko.cloud/wp-content/uploads/2022/05/Spot-10-1536x789.png 1536w" sizes="(max-width: 795px) 100vw, 795px" /></p>
<p>&nbsp;</p>
<p>If, on the other hand, we want certain tasks to be executed in the subordinate nodes, we will have to specify them at Jenkinsfile level, here is an example of how to do it:</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;groovy&quot;,&quot;mime&quot;:&quot;text/x-groovy&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;lineWrapping&quot;:true,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}">#!groovy
pipeline {
//Especificamos agente a nivel de Pipeline
  agent {
    label 'ec2-fleet'
  }

  stages {
        stage('Test') {
          agent {
            dockerfile {
              // Si usamos un agente en concreto, tendremos que volver a especificar la etiqueta
              label 'ec2-fleet'
              filename 'Dockerfile'
              dir 'docker/images/tests'
              args '-u root'
            }
          }
          steps {
            sh 'Hello World'
          }
        }
  }
}</pre>
</div>
<p>&nbsp;</p>
<p>With this last step, we are ready to execute any task on dynamically provisioned nodes within Spot Fleet instances.</p>
<p>&nbsp;</p>
<p>From Geko Consulting Cloud, we hope you liked this post and above all that you find it useful, nothing would make us happier.<br />
We invite you to contact us if you need information about the <a href="https://geko.cloud/en/" target="_blank" rel="noopener"><strong>Cloud and DevOps</strong></a> world and keep checking <a href="https://geko.cloud/en/blog/labs/" target="_blank" rel="noopener"><strong>our blog</strong> </a>to find other useful publications.</p>
<p>La entrada <a href="https://geko.cloud/en/dynamic-nodes-in-jenkins-via-aws-spot-fleet/">Dynamic nodes in Jenkins via AWS Spot Fleet</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/dynamic-nodes-in-jenkins-via-aws-spot-fleet/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Modsecurity and the OWASP Core Rule Set: is your web app secure?</title>
		<link>https://geko.cloud/en/modsecurity-and-the-owasp-core-rule-set-is-your-web-app-secure/</link>
					<comments>https://geko.cloud/en/modsecurity-and-the-owasp-core-rule-set-is-your-web-app-secure/#respond</comments>
		
		<dc:creator><![CDATA[Geko Cloud]]></dc:creator>
		<pubDate>Mon, 30 May 2022 07:53:34 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=8200</guid>

					<description><![CDATA[<p>Geko Cloud&#8217;s security team recently visited RootedCON, Spain&#8217;s most important security conference, and among other things, there was a lot of talk about one of the weakest links in application development pipelines: people. One of the most important mantras to remember when creating a cyber risk model for your company is that you&#8217;re never going [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/modsecurity-and-the-owasp-core-rule-set-is-your-web-app-secure/">Modsecurity and the OWASP Core Rule Set: is your web app secure?</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Geko Cloud&#8217;s security team <a href="https://geko.cloud/en/geko-cloud-attends-rooted-con-2022/" target="_blank" rel="noopener">recently visited RootedCON</a>, Spain&#8217;s most important<strong> security conference</strong>, and among other things, there was a lot of talk about one of the weakest links in application development pipelines: <strong>people</strong>.</p>
<p>One of the <strong>most important mantras</strong> to remember when creating a <strong>cyber risk model</strong> for your company is that you&#8217;re never going to have a completely secure application ecosystem. As many penetration tests you run and as many pipeline code quality tests you implement, <strong>something&#8217;s always left along the way</strong>. Sometimes it&#8217;s because the return of investment in fixing it is not worth the time, <strong>sometimes the tests don&#8217;t catch the problem</strong> because it&#8217;s dependant on the interaction of multiple errors on the system interacting with each other. <strong>Complex systems fail</strong>, that&#8217;s something you cannot avoid. You can control what software you use, what code runs, but a <strong>slip-up is only a matter of time</strong>.</p>
<p>&nbsp;</p>
<figure id="attachment_7524" aria-describedby="caption-attachment-7524" style="width: 600px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-7524" src="https://geko.cloud/wp-content/uploads/2022/03/RootedCON-comprimida-ENG.jpg" alt="RootedCON " width="600" height="270" srcset="https://geko.cloud/wp-content/uploads/2022/03/RootedCON-comprimida-ENG.jpg 1600w, https://geko.cloud/wp-content/uploads/2022/03/RootedCON-comprimida-ENG-300x135.jpg 300w, https://geko.cloud/wp-content/uploads/2022/03/RootedCON-comprimida-ENG-1024x461.jpg 1024w, https://geko.cloud/wp-content/uploads/2022/03/RootedCON-comprimida-ENG-768x346.jpg 768w, https://geko.cloud/wp-content/uploads/2022/03/RootedCON-comprimida-ENG-1536x691.jpg 1536w" sizes="(max-width: 600px) 100vw, 600px" /><figcaption id="caption-attachment-7524" class="wp-caption-text">Chema Alonso, considered one of the biggest cybersecurity experts in Spain, beside our cybersecurity specialist team from Geko Cloud in Rooted CON Madrid 2022.</figcaption></figure>
<h2></h2>
<h2>Why do I apply these security guardrails then?</h2>
<p>This is why your development and security plan needs to prioritize <strong>containment</strong> and <strong>isolation</strong>: if you assume that something is going to happen, prepare your environment so that the incident has as <strong>little impact as possible</strong>. A user got a chell to your website? Can&#8217;t do much as a well-scoped webserver user. Production database server access? Well, but only for some databases and tables, no administrator rights. <strong>Minimize impact area</strong> and <strong>prepare for damage control</strong>, those should be the cornerstones of your fight against cyberattacks.</p>
<p>One of the ways you can implement this security guardrail control is to use s<strong>pecialized security tools</strong> that <strong>protect against common attacks</strong> from threat actors, that in a simple and unattended way will <strong>detect</strong>, <strong>alert</strong> and <strong>stop</strong> external attacks, either from bots or from sophisticated threat actors. Another layer of protection that, if maybe it doesn&#8217;t stop every attack, it can save you more than one incident, or cut an exploit chain. Everything without the need of having your security team check every false positive and dedicate their time to more quality work.</p>
<p>&nbsp;</p>
<h2>What part of my environment do I begin with?</h2>
<p>In this case the <strong>biggest attack surface</strong> we usually need to aproach is <strong>websites</strong>. <strong>Every company today has a web application</strong> that they need to use, be it <strong>internal</strong> or a <strong>user-facing</strong> corporate site. Whichever it is, it can represent a <strong>pivoting point in an incident</strong>. To avoid this in web environments exposed to threat actors <strong>we need appropiate tools</strong> that detect common attacks and stop them. In our case, after an analysis of the available options for this scenario, we&#8217;ve found OWASP&#8217;s <strong>ModSecurity Core Rule Set</strong>.</p>
<p><strong>ModSecurity Core Rule Set</strong> is a <strong>pack of rules</strong> maintained by the Open Web Application Security Project Foundation that keeps a detection ruleset aligned with what this world-renowned organization considers the <strong>most dangerous attack vectors</strong> against modern web applications. These rules are loaded with the<strong> ModSecurity module</strong> on your web server (nginx, apache2, iis server) and <strong>intercepts and analyzes requests</strong> and <strong>responses</strong> that reach your site, then takes <strong>alert or block decisions</strong> based on its <strong>priorities</strong> and <strong>threat scores</strong>.</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8182" src="https://geko.cloud/wp-content/uploads/2022/04/OWASP-CRS-sponsorship_WAF-in-action-300x111.png" alt="" width="600" height="223" srcset="https://geko.cloud/wp-content/uploads/2022/04/OWASP-CRS-sponsorship_WAF-in-action-300x111.png 300w, https://geko.cloud/wp-content/uploads/2022/04/OWASP-CRS-sponsorship_WAF-in-action-1024x380.png 1024w, https://geko.cloud/wp-content/uploads/2022/04/OWASP-CRS-sponsorship_WAF-in-action-768x285.png 768w, https://geko.cloud/wp-content/uploads/2022/04/OWASP-CRS-sponsorship_WAF-in-action-1536x570.png 1536w, https://geko.cloud/wp-content/uploads/2022/04/OWASP-CRS-sponsorship_WAF-in-action.png 2048w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>&nbsp;</p>
<h2>Should I migrate my current webserver to one with ModSecurity?</h2>
<p>Thanks to the <strong>modular implementation</strong> of ModSecurity this tool can be applied in <strong>existing webservers</strong> in a <strong>simple</strong> with a <strong>low amount of overhead</strong> in the site&#8217;s architecture. It&#8217;s quickly implemented in the environment that you already have set up and allows you to immediately start processing alerts and blocking attacks. As it doesn&#8217;t modify the core functionality of your webserver you can <strong>reuse most of your current configuration</strong>, making its implementation in your existing environment a <strong>low-friction improvement</strong>.</p>
<p>&nbsp;</p>
<h2>How do I enable this in my pre-existing image?</h2>
<p>If you don&#8217;t have a monolithic webserver set-up, don&#8217;t fret, <strong>this isn&#8217;t a show stopper</strong>. Even in a microservice architecture you can still apply the <strong>pre-existing solutions</strong> created by the open-source community that actively contributes to the Core Rule Set project, you can use <strong>drop-in solutions</strong> for almost any environment you come from.</p>
<p>Starting up your site with <strong>docker-compose</strong>? the modsecurity-crs <strong>docker image</strong> that&#8217;s kept updated in the owasp docker repository implements the Core Rule Set set-up on top of the nginx container that you already know and love. <strong>Kubernetes</strong> fan? You probably already noticed at Geko we are too, and we recently discovered that the <strong>nginx-ingress-controller helm chart</strong> already implements ModSecurity and Core Rule Set <strong>support built-in</strong>, you just need to enable a feature flag and without downtime and a couple of tags added to your ingress objects you&#8217;ll sleep better knowing you just put one more stone in a cybercriminal&#8217;s path to your information.</p>
<p>&nbsp;</p>
<h2>How do these blocks work, exactly?</h2>
<p>ModSecurity handles every request through <strong>4 phases of security controls</strong>. In the first layer it applies the CoreRuleSet rules that look for compromise indicators on <strong>HTTP request headers</strong>. Details like using a PUT where only GETs should be accepted, unwanted protocols or <strong>SQL injections</strong> in the URL are examples of checks implemented on this first step. After this, if score isn&#8217;t high enough to drop the request, it will continue to check for the request body for alarms like <strong>malicious data in POST requests.</strong> If these checks raise no alarms, the request will be forwarded to the application for processing.</p>
<p>But that&#8217;s only the first half of communication, and<strong> some requests could get through</strong> if they&#8217;re obfuscated enough, like base64-encoded requests. To further avoid these potential detection leaks, <strong>response data from the application is also checked</strong>. Detection of headers with sensitive information, or an<strong> abnormally large body field</strong> that could be an <strong>SQL dump</strong> or a binary execution, would never get back to the attacker, as <strong>ModSecurity will discard this response </strong>before it got back to the threat actor<strong>.</strong></p>
<p>&nbsp;</p>
<h2>How sensitive are these detection rules? Can I tune them?</h2>
<p>ModSecurity implements two main elements to control the blocking sensitivity and handle false positives: <strong>Score</strong> and <strong>Paranoia Level</strong>. The first one is a stored <strong>score</strong> assigned to each rule on the CoreRuleSet that <strong>defines how critical the incident is</strong>: the alarm level from getting a PUT on a GET-only endpoint is not the same as detecting a log4java command injection on a form submit. Score is accumulated accros the communication, and if it goes over the limit, ModSecurity alerts about the incident or cuts the connection.</p>
<p>To <strong>control the needed score</strong> to alert about an incident or block a request ModSecurity uses <strong>Paranoia Level</strong>, an environment variable in the ModSecurity setup that, in a level from 1 to 4,, is configured as more or less sensitive to alerts, level 1 being the lowest that requires a score of 5 (the most critical score) to act on a request, and 4 being the highest paranoia level which only requires a score of 1, the lowest in any given rule. The higher the paranoia level, the<strong> more secure</strong> the environment is, but the <strong>more false positives</strong> we will get.</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8186" src="https://geko.cloud/wp-content/uploads/2022/04/owasp-vs-burpsuite-300x169.png" alt="" width="600" height="338" srcset="https://geko.cloud/wp-content/uploads/2022/04/owasp-vs-burpsuite-300x169.png 300w, https://geko.cloud/wp-content/uploads/2022/04/owasp-vs-burpsuite-1024x576.png 1024w, https://geko.cloud/wp-content/uploads/2022/04/owasp-vs-burpsuite-768x432.png 768w, https://geko.cloud/wp-content/uploads/2022/04/owasp-vs-burpsuite-1536x864.png 1536w, https://geko.cloud/wp-content/uploads/2022/04/owasp-vs-burpsuite.png 1920w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>&nbsp;</p>
<p>But <strong>we may not always want to block</strong> or allow the same rule level. Sometimes we want to debug without interrupting service. To help with this there&#8217;s a special environment variable: the <strong>Executing paranoia level</strong>. This variable establishes the score and paranoia level required to <strong>alert</strong> about a rule, but <strong>allowing the request to continue</strong>. For example, setting paranoia level to 5 and executing paranoia level to 1 will alert of every single rule trigger on the environment, but <strong>only interrupt communications for the most critical events</strong> that are detected so we can debug and <strong>tune rules without service interruption</strong>.</p>
<p>&nbsp;</p>
<h2>That sounds like a lot to take in&#8230;</h2>
<p>Here at geko we&#8217;ve already been fighting with ModSecurity tuning and configuration for a bit. If you want to implement this security suite in your environment but you don&#8217;t have the time to handle false positives let&#8217;s <a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener">have a chat</a> and <strong>we&#8217;ll take care</strong> of making your environment more secure so that your team can dedicate their time to their tasks without having to worry about a cybercriminal slipping into the cracks of your infrastructure. <strong><a href="https://www.modsecurity.org/" target="_blank" rel="noopener">ModSecurity</a> will catch and stop problems that you don&#8217;t even know exist</strong>.</p>
<p>La entrada <a href="https://geko.cloud/en/modsecurity-and-the-owasp-core-rule-set-is-your-web-app-secure/">Modsecurity and the OWASP Core Rule Set: is your web app secure?</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/modsecurity-and-the-owasp-core-rule-set-is-your-web-app-secure/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Cost Control in Cloud</title>
		<link>https://geko.cloud/en/cost-control-in-cloud/</link>
					<comments>https://geko.cloud/en/cost-control-in-cloud/#respond</comments>
		
		<dc:creator><![CDATA[Guillaume Brue]]></dc:creator>
		<pubDate>Thu, 12 May 2022 08:09:49 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Geko cloud]]></category>
		<category><![CDATA[Labs]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[geko cloud]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=8247</guid>

					<description><![CDATA[<p>AWS, Azure, Gcloud, DigitalOcean&#8230; Cloud is being used every day and offers (almost) unlimited capacity&#8230; as long as we pay the bill&#8230; And some time bill can give us some surprises. Cloud providers make it easy to configure instances, database, store data.. But it can be very costly if you don&#8217;t keep an eye on [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/cost-control-in-cloud/">Cost Control in Cloud</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>AWS, Azure, Gcloud, DigitalOcean&#8230; Cloud is being used every day and offers (almost) unlimited capacity&#8230; as long as we pay the bill&#8230; And some time bill can give us some surprises. Cloud providers make it easy to configure instances, database, store data.. But it can be very costly if you don&#8217;t keep an eye on it.<br />
In this article we&#8217;ll give you some tips and good practices that could be usefull to save money<br />
As a good start here are some general rules you should follow:</p>
<h2>General rules:</h2>
<ul>
<li>Configure a main account dedicated to billing, and then configure subaccounts/projects linking invoice to that account</li>
<li>In each account/project, configure a budget and an alert if consum exceeds a certain amount (to be defined depending on your usual consume) (<a href="https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-create.html" target="_blank" rel="noopener">AWS, </a><a href="https://cloud.google.com/billing/docs/how-to/budgets" target="_blank" rel="noopener">GCP, </a><a href="https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/tutorial-acm-create-budgets" target="_blank" rel="noopener">Azure</a>. This way you&#8217;ll be warned during the month&#8230; and not at the end receiving bill.</li>
<li> If your account has several projects/environments, use labels/tags to be able to identify each resource.</li>
<li>Export your billing to a database (<a href="https://docs.aws.amazon.com/cur/latest/userguide/use-athena-cf.html" target="_blank" rel="noopener">Athena /</a> <a href="https://cloud.google.com/billing/docs/how-to/export-data-bigquery-setup" target="_blank" rel="noopener">Bigquery</a> ) This has a cost (not really expensive if you don&#8217;t pass your day querying it) but allows you to have much more details in some cases. For instance in this AWS invoice we can see 595$ of datatransfer out without any details.</li>
</ul>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="size-large wp-image-8241 aligncenter" src="https://geko.cloud/wp-content/uploads/2022/05/01-Bill-1-1024x110.png" alt="" width="800" height="86" srcset="https://geko.cloud/wp-content/uploads/2022/05/01-Bill-1-1024x110.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/01-Bill-1-300x32.png 300w, https://geko.cloud/wp-content/uploads/2022/05/01-Bill-1-768x83.png 768w, https://geko.cloud/wp-content/uploads/2022/05/01-Bill-1.png 1358w" sizes="(max-width: 800px) 100vw, 800px" /></p>
<p>&nbsp;</p>
<p style="padding-left: 40px;"> If you go on Athena, we can see that this is mainly due to a loadbalancer.</p>
<p><img loading="lazy" decoding="async" class="size-large wp-image-8243 aligncenter" src="https://geko.cloud/wp-content/uploads/2022/05/01-Athena-1-1024x451.png" alt="" width="800" height="352" srcset="https://geko.cloud/wp-content/uploads/2022/05/01-Athena-1-1024x451.png 1024w, https://geko.cloud/wp-content/uploads/2022/05/01-Athena-1-300x132.png 300w, https://geko.cloud/wp-content/uploads/2022/05/01-Athena-1-768x339.png 768w, https://geko.cloud/wp-content/uploads/2022/05/01-Athena-1-1536x677.png 1536w, https://geko.cloud/wp-content/uploads/2022/05/01-Athena-1.png 1792w" sizes="(max-width: 800px) 100vw, 800px" /></p>
<p>&nbsp;</p>
<p>If we want to save money on that resource, we know where to start.</p>
<p>Finaly review periodically your bills (every 3/6/12 months)</p>
<p>&nbsp;</p>
<h2>Bill review:</h2>
<p>One of best automatic tool you could use is CloudCheckr. After configuring an account in your project it gives you instances that are oversized. Bad thing is that:</p>
<ul>
<li>It&#8217;s done checking CPU but not RAM. One instance with few CPU usage but full of RAM can&#8217;t be resized.</li>
<li>It doesn&#8217;t take into &#8220;auto-scalling&#8221; instances that are up and down automatically</li>
</ul>
<p>So another way is to check bill manually. Go to billing details, and review costs, starting by highest one to lowest. Here are some question you can ask yourself for each service</p>
<p>&nbsp;</p>
<h3>S3:</h3>
<ul>
<li>Is versioning active and needed? Versioning on a backup&#8217;s bucket can be very costly for instance</li>
<li>All files are regularly accessed? If not you can implement lifecycle to save money in buckets with lots of data</li>
<li>Files can be deleted after xx days? If so you can also implement a lifecycle</li>
</ul>
<p>&nbsp;</p>
<h3>Instances:</h3>
<ul>
<li>Check CPU / RAM use in your instances and resize your instances if possible</li>
<li>Is autoscalling correctly configured? You may not need that much instances always up.</li>
<li>Could you stop some instances at night / on week ends?</li>
</ul>
<p>&nbsp;</p>
<h3>Volums:</h3>
<ul>
<li> Check unmounted volums and delete them if they are useless</li>
</ul>
<p>&nbsp;</p>
<h3>Databases:</h3>
<ul>
<li>Check CPU / RAM use and resize them if possible</li>
</ul>
<p>&nbsp;</p>
<h3>Load balancer:</h3>
<ul>
<li>Check if loadbalancers could be group in a single one.</li>
<li>All loadbalancers are usefull? (one loabalancer with a single instance, or returning 200 could be useless)</li>
</ul>
<p>Those are example for some services. Obviously each case is diferent, so if you&#8217;re still lost with all of this, feel free to contact us. We could help you to configure everything.</p>
<p>&nbsp;</p>
<h2>Instance reservation</h2>
<p>Finally, once infrastructure is correctly provisioned (Instances with correct sizing, up/down xx hours per day) we can reserve instances. In other words you commit to keep instances for a certain time, and eventually paying upfront. In exchange you&#8217;ll have some discounts. The longest we commit and the most we pay upfront&#8230; The most will be our discount.<br />
But we&#8217;ll see that in an incoming article.</p>
<p>We hope that this article has been useful to you and we are very attentive that soon we will continue publishing more related content.</p>
<p>&nbsp;</p>
<p>From Geko we can adives you to maximize cost savings in your cloud system.</p>
<p>If you would like to get to know us better, check out <a href="https://geko.cloud/en/cloud-services/cloud-management/" target="_blank" rel="noopener"><strong>our services</strong>.</a> Please do not hesitate to<a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener"><strong> contact us</strong></a> if you require further information</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>La entrada <a href="https://geko.cloud/en/cost-control-in-cloud/">Cost Control in Cloud</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/cost-control-in-cloud/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Practical tips to improve your developments in CDK [Part 2]</title>
		<link>https://geko.cloud/en/practical-tips-improve-developments-in-cdk-part2consejos-para-sacar-mayor-provecho-a-cdk-parte-2/</link>
					<comments>https://geko.cloud/en/practical-tips-improve-developments-in-cdk-part2consejos-para-sacar-mayor-provecho-a-cdk-parte-2/#respond</comments>
		
		<dc:creator><![CDATA[Javier]]></dc:creator>
		<pubDate>Mon, 02 May 2022 07:24:06 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=8109</guid>

					<description><![CDATA[<p>Practical tips to improve your developments in CDK [Parte 2]. We&#8217;re back with our list of practical CDK tips. In the first article we talked about basic concepts, not related with CDK but any software project. We talk about naming convention, testing and tagging. Today we will talk about property management but, we are also [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/practical-tips-improve-developments-in-cdk-part2consejos-para-sacar-mayor-provecho-a-cdk-parte-2/">Practical tips to improve your developments in CDK [Part 2]</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Practical tips to improve your developments in CDK [Parte 2].<br />
We&#8217;re back with our list of practical CDK tips. In the first article we talked about basic concepts, not related with CDK but any software project. We talk about naming convention, testing and tagging. Today we will talk about property management but, we are also going to talk about topics that are strictly related with CDK like constructs and Stacks. Here we go.</p>
<p>&nbsp;</p>
<h2>Property management</h2>
<p>A very common practice in cloudformation involves add parameters in templates in order to customize them. In CDK, parameters already exist. However, it is not a good practice to use parameters as you can read in <strong><a href="https://docs.aws.amazon.com/cdk/v2/guide/identifiers.html#identifiers_paths" target="_blank" rel="noopener">official documentation</a></strong>. AWS recommends centralizing property management in the <strong><a href="https://docs.aws.amazon.com/cdk/v2/guide/context.html" target="_blank" rel="noopener">CDK context.</a></strong>  You should add the properties your app needs in context.json file or equivalent. In CDK there are so many ways to modify the context. In the below image you can see an example:</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8091 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-13.png" alt="CDK geko consultoría cloud - 13" width="862" height="728" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-13.png 862w, https://geko.cloud/wp-content/uploads/2022/04/image-13-300x253.png 300w, https://geko.cloud/wp-content/uploads/2022/04/image-13-768x649.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></p>
<p>These properties will be used within the application as shown in the following image:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8093 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-14.png" alt="CDK geko consultoría cloud - 14" width="1177" height="676" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-14.png 1177w, https://geko.cloud/wp-content/uploads/2022/04/image-14-300x172.png 300w, https://geko.cloud/wp-content/uploads/2022/04/image-14-1024x588.png 1024w, https://geko.cloud/wp-content/uploads/2022/04/image-14-768x441.png 768w" sizes="(max-width: 1177px) 100vw, 1177px" /></p>
<p>The stage property define which properties CDK have to use, pre, pro or dev:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-8095" src="https://geko.cloud/wp-content/uploads/2022/04/Captura-2.jpg" alt="" width="1000" height="85" srcset="https://geko.cloud/wp-content/uploads/2022/04/Captura-2.jpg 1188w, https://geko.cloud/wp-content/uploads/2022/04/Captura-2-300x26.jpg 300w, https://geko.cloud/wp-content/uploads/2022/04/Captura-2-1024x87.jpg 1024w, https://geko.cloud/wp-content/uploads/2022/04/Captura-2-768x65.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></p>
<p>&nbsp;</p>
<p>You can pass properties on the command line using the -c flag, so it is possible to deploy in any environment just changing the value of stage property. It is a good option, however, the greatest advantage of using CDK remains in use developer tools. So, why not use your favorite developer tools to manage properties? If you like manage your properties with YAML files then use them, if you store your properties in consul, use consul. Feel free to use any tool. Use a familiar tool will reduce learning curve, increase the quality of you developments, and it’s very likely you already implemented a properties management system in your company. Reuse you workflows it’s always a win-win.</p>
<p>If you don&#8217;t know how to manage secrets or you are considering new methods, we suggest you use <strong><a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html" target="_blank" rel="noopener">AWS Systems Manager</a></strong> <strong><a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html" target="_blank" rel="noopener">Parameter Store</a></strong> service. Parameter Store allows you to store configuration properties and secrets in a secure way. Retrieving values ​​stored in the parameter store using CDK is pretty easy as you can see in the <strong><a href="https://docs.aws.amazon.com/cdk/v2/guide/get_ssm_value.html" target="_blank" rel="noopener">CDK documentation</a></strong>. Here is an example:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-8097" src="https://geko.cloud/wp-content/uploads/2022/04/Captura-3.jpg" alt="CDK geko consultoría cloud " width="1000" height="85" srcset="https://geko.cloud/wp-content/uploads/2022/04/Captura-3.jpg 1189w, https://geko.cloud/wp-content/uploads/2022/04/Captura-3-300x25.jpg 300w, https://geko.cloud/wp-content/uploads/2022/04/Captura-3-1024x87.jpg 1024w, https://geko.cloud/wp-content/uploads/2022/04/Captura-3-768x65.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></p>
<h2></h2>
<p>&nbsp;</p>
<h2>Stacks</h2>
<p>In our experience working with CDK we have detected confusion about when and how to use stacks. A very typical question is to define the number of stacks that my CDK application should have. The answer to this question depends on several factors. We are going to see some guidelines that will help you structure your code, but bear in mind these guidelines are not set in stone.</p>
<p>Regarding the number of stacks, you should take into account what resources you will create and if it makes sense to group them within a stack or not. For example, if you need to create an infrastructure for a new software application, it is a good idea to create all resources that the application needs in just one stack. However, if you have to create resources shared for multiple applications or resources critical for your business, then consider creating those resources in their own stacks.</p>
<p>In short, you should group resources that are related to each other in some way, either because they are necessary for an application to work or because they are elements that work together, such as a VPC with its respective subnets and ACL networks. If a specific set of resources are critical for your company then create them into separate stack in order to avoid accidental updates. Then active stack termination protection and monitor it in some way, for instance, using cloudwatch events.</p>
<p>&nbsp;</p>
<h2>Constructs</h2>
<p><strong><a href="https://docs.aws.amazon.com/cdk/v2/guide/get_ssm_value.html" target="_blank" rel="noopener">Constructs</a></strong> are the base building blocks in CDK. Every resource is generated by a construct. There are different types of constructs, Level 1 (L1), Level 2 (L2) and Level 3 (L3). L1 constructs match 1 to 1 with Cloudformation resources. For each Cloudformation resource,  there is a construct that implements it. L1 constructs are always named with the prefix Cfn. L1 constructs will have the same attributes as their equivalent in Cloudformation.</p>
<p>The L2 are the &#8220;curated&#8221; constructs. They have default values and they are very easy to use even if you don&#8217;t have much knowledge of cloud formation. Finally, the L3 corresponds to patterns that are designed to solve common problems in AWS, such as an API Gateway with a Lambda and a BD Dynamo.</p>
<p>All constructs are maintained by the CDK team, however, you can create your own construct and customize it, adapting it to your needs. We don’t recommend this practice but sometimes it is useful in certain cases, especially when you use an L2 type construct that has default values ​​that don’t fit your needs. In any case, we recommend that you do not abuse this practice. Try to create as few custom constructs as possible.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8099 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-15.png" alt="CDK geko consultoría cloud - 15" width="721" height="730" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-15.png 721w, https://geko.cloud/wp-content/uploads/2022/04/image-15-296x300.png 296w" sizes="(max-width: 721px) 100vw, 721px" /></p>
<p>&nbsp;</p>
<p>Imagine the compliance of your company request that buckets cannot be publicly accessible and that all stored objects must be encrypted at rest. One way to satisfy those requirements would be to create your own custom construct and ask the DevOps team to use this construct instead of CDK L2 construct. Below we can see a custom implementation that meets compliance requirements. In the example you can see that the construct inherits from the Construct class instead of the Bucket class. We advise you to do it this way because in this way you can design more extensible constructs.</p>
<p>If you are looking for an alternative way to enforce the compliance in your CDK applications, then you should take a look at using <strong><a href="https://docs.aws.amazon.com/cdk/v2/guide/aspects.html" target="_blank" rel="noopener">Aspects</a></strong>. Aspects are the way to apply operations to all constructs for a given scope. With an Aspect you can verify that a certain resource is private, or it is already encrypted. In the following image, we can see a stack that creates a private S3 bucket using the custom construct from the previous example:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8101 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-16.png" alt="CDK geko consultoría cloud - 16" width="860" height="598" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-16.png 860w, https://geko.cloud/wp-content/uploads/2022/04/image-16-300x209.png 300w, https://geko.cloud/wp-content/uploads/2022/04/image-16-768x534.png 768w" sizes="(max-width: 860px) 100vw, 860px" /></p>
<p>The kms_key attribute is empty, so objects stored within the bucket will not be encrypted. For this reason, we have created an Aspect called BucketChecker that checks that the buckets of the GekoPrivateBucket class have the encryption_key attribute defined. In case they do not have it defined, an exception will be thrown. In this way, making checks on the created resources is easier.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8103 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-17.png" alt="" width="1298" height="329" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-17.png 1298w, https://geko.cloud/wp-content/uploads/2022/04/image-17-300x76.png 300w, https://geko.cloud/wp-content/uploads/2022/04/image-17-1024x260.png 1024w, https://geko.cloud/wp-content/uploads/2022/04/image-17-768x195.png 768w" sizes="(max-width: 1298px) 100vw, 1298px" /></p>
<h2></h2>
<p>&nbsp;</p>
<h2>Resume</h2>
<p>We have dealt with various topics, however, we have given priority to two key concepts. The first key concept is how to structure the code of a CDK application, that is, the number of stacks that an application should have, when and how to create a custom construct, how to create tests in CDK or how to deal with identifiers. A good structure helps save technical debt and improves the quality of the delivered code.</p>
<p>The second key concept is the compliance. Throughout both posts, we have provided ideas on how to meet the hypothetical requirements of a compliance. One of the most important lessons we have learned managing our clients&#8217; infrastructure is that meet compliance requirements are really important. Defining a compliance could be painful at first, however the pros outweigh the cons. Compliance allows reducing IT risks, improves infrastructure governance and creates a framework that helps the different teams of a company (SRE, Development, SecOps, &#8230;) to interact and reach agreements. For that reason the code you generate in CDK should always keep in mind how to satisfy your company&#8217;s compliance.</p>
<p>We hope that you have enjoyed reading  both posts and you have learned something useful, nothing would make us happier. If you need information about <strong><a href="https://geko.cloud/en/" target="_blank" rel="noopener">Cloud and the DevOps</a> </strong>world, we invite you to <a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener"><strong>contact us</strong></a> and keep checking out <a href="https://geko.cloud/en/blog/labs/" target="_blank" rel="noopener"><strong>our blog</strong></a> in order to find other useful publications. See you soon!</p>
<p>&nbsp;</p>
<p>La entrada <a href="https://geko.cloud/en/practical-tips-improve-developments-in-cdk-part2consejos-para-sacar-mayor-provecho-a-cdk-parte-2/">Practical tips to improve your developments in CDK [Part 2]</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/practical-tips-improve-developments-in-cdk-part2consejos-para-sacar-mayor-provecho-a-cdk-parte-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Practical tips to improve your developments in CDK [Part 1]</title>
		<link>https://geko.cloud/en/consejos-practicos-para-sacar-mayor-provecho-a-cdk-parte-1/</link>
					<comments>https://geko.cloud/en/consejos-practicos-para-sacar-mayor-provecho-a-cdk-parte-1/#respond</comments>
		
		<dc:creator><![CDATA[Javier]]></dc:creator>
		<pubDate>Tue, 19 Apr 2022 07:46:45 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=8071</guid>

					<description><![CDATA[<p>Introduction Practical tips to improve your developments in CDK The new AWS infrastructure as code framework, CDK, it’s awakening interest in the DevOps world due to its multiple advantages. At Geko we are already using CDK and we can say that it is a very interesting alternative to both Cloudformation and Terraform. For those who [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/consejos-practicos-para-sacar-mayor-provecho-a-cdk-parte-1/">Practical tips to improve your developments in CDK [Part 1]</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Practical tips to improve your developments in CDK<br />
The new AWS infrastructure as code framework, <a href="https://docs.aws.amazon.com/cdk/index.html" target="_blank" rel="noopener"><strong>CDK,</strong></a> it’s awakening interest in the DevOps world due to its multiple advantages. At Geko we are already using CDK and we can say that it is a very interesting alternative to both Cloudformation and Terraform. For those who want to introduce in the DevOps world or those companies that want to implement a DevOps model, CDK is the perfect tool since, it allows the use of programming languages already used by developers, reducing the learning curve and facilitating its adoption.</p>
<p>However, after using CDK in production we can say that adopting CDK is not as easy as it might appear. For this reason, we have created this post with the intention of explaining some basic concepts of CDK and at the same time sharing with you advices based on our experience, for all those who are considering starting to use CDK or those who are already using it and they want to improve its use.</p>
<p>&nbsp;</p>
<h2>Naming convention for identifiers</h2>
<p>In CDK there are many types of identifiers and each one has a purpose. Our first recommendation is that you inform yourself about how <strong><a href="https://docs.aws.amazon.com/cdk/v2/guide/identifiers.html#identifiers_paths" target="_blank" rel="noopener">identifiers</a></strong> work and the importance they have in order to create resources in cloudformation. Identifiers in CDKs must be unique within the context in which they are created. This has many notable implications.</p>
<p>For example, the same ID can be used for two constructs that are on two different stacks. However, if you try to use the same ID for two constructs on the same Stack, the application will return an error synthesizing or deploying in AWS. Our advice is to centralize, somehow, the generation of all identifiers, following the same nomenclature. This will help you to avoid repeat identifiers and it will make easier to read the cloudformation templates created with the CDK. You can use a helper function that, given a set of parameters, returns the identifier to be used in the constructs, as shown below.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8040 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-1.png" alt="CDK geko consultoría cloud" width="676" height="426" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-1.png 676w, https://geko.cloud/wp-content/uploads/2022/04/image-1-300x189.png 300w" sizes="(max-width: 676px) 100vw, 676px" /></p>
<p style="text-align: left;">Try to simplify the naming convention that you define for the identifiers as much as possible, since the <strong><a href="https://docs.aws.amazon.com/cdk/index.html" target="_blank" rel="noopener">logical and physical identifiers</a></strong> generated by CDK are usually very long and include hash codes that make them difficult to read. Always keep in mind that, once you have defined resource identifiers, you should not change them unless it is completely and absolutely necessary. Once you have deployed a resource with an identifier, if the identifier changes, the resource will be replaced with a new one. Imagine you&#8217;ve created an RDS instance in production and assigned an ID to it. If you change the RDS instance identifier in your CDK code, the next time you deploy to production the RDS instance will be removed and replaced with a new one. An RDS instance is created in the following CDK code snippet:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8042 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-2.png" alt="CDK geko consultoría cloud" width="761" height="484" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-2.png 761w, https://geko.cloud/wp-content/uploads/2022/04/image-2-300x191.png 300w" sizes="(max-width: 761px) 100vw, 761px" /></p>
<p style="text-align: left;">By deploying this code, an RDS instance will automatically deployed in a cloudormation stack:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8042 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-2.png" alt="CDK geko consultoría cloud" width="761" height="484" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-2.png 761w, https://geko.cloud/wp-content/uploads/2022/04/image-2-300x191.png 300w" sizes="(max-width: 761px) 100vw, 761px" /></p>
<p style="text-align: left;">This RDS instance has been created with the identifier Pro-Geko-Cloud-RDS, the values ​​defined for the environment and project attributes are the following:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-8046" src="https://geko.cloud/wp-content/uploads/2022/04/image-4-300x81.png" alt="CDK geko consultoría cloud" width="300" height="81" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-4-300x81.png 300w, https://geko.cloud/wp-content/uploads/2022/04/image-4.png 362w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p style="text-align: left;">The cloudformation template generated by CDK is as follows:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8048 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-5.png" alt="CDK geko consultoría cloud" width="586" height="404" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-5.png 586w, https://geko.cloud/wp-content/uploads/2022/04/image-5-300x207.png 300w" sizes="(max-width: 586px) 100vw, 586px" /></p>
<p style="text-align: left;">The logical name of the RDS instance is ProGekoCloudRDS and a concatenated hash identifier as suffix. We will now modify the static get_identifier method to add the dpt attribute, as shown below:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-8050" src="https://geko.cloud/wp-content/uploads/2022/04/image-6-300x50.png" alt="CDK geko consultoría cloud" width="300" height="50" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-6-300x50.png 300w, https://geko.cloud/wp-content/uploads/2022/04/image-6-768x127.png 768w, https://geko.cloud/wp-content/uploads/2022/04/image-6.png 775w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>We also set a value for the static attribute department:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8052 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-7.png" alt="CDK geko consultoría cloud" width="350" height="115" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-7.png 350w, https://geko.cloud/wp-content/uploads/2022/04/image-7-300x99.png 300w" sizes="(max-width: 350px) 100vw, 350px" /></p>
<p style="text-align: left;">If we execute a cdk diff command we can see that there are pending changes. Changes include replacing the RDS instance with a new instance called ProGekoCloudsalesRDS:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-8054 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-8.png" alt="CDK geko consultoría cloud" width="1239" height="463" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-8.png 1239w, https://geko.cloud/wp-content/uploads/2022/04/image-8-300x112.png 300w, https://geko.cloud/wp-content/uploads/2022/04/image-8-1024x383.png 1024w, https://geko.cloud/wp-content/uploads/2022/04/image-8-768x287.png 768w" sizes="(max-width: 1239px) 100vw, 1239px" /></p>
<p>As we have seen, identifiers are vital for a CDK application. Before you start generating source code, define a naming convention and follow it. One way to avoid unwanted identifier changes is to run the CDK diff command in your deploy pipeline, prior to deploying your infrastructure.</p>
<p>Finally, try not to define names for any resource you provision in your application, let the CDK choose the names of the resources. <strong>Keep in mind that I&#8217;m talking about resource names, not identifiers.</strong> Every time you make changes in  a cloudformation resource, it is possible that resource will be <strong><a href="https://docs.aws.amazon.com/cdk/index.html" target="_blank" rel="noopener">replaced</a></strong> due to the changes you want to make are not compatible with the update of the resource. then, it is possible the update fails due to you defined a name for a resource that has to be replaced. AWS CloudFormation doesn&#8217;t replace a resource that has a custom name unless that custom name is changed to a different name. If you allow CDK to handle resource naming, in case you make any changes that involve replacing a resource, CDK automatically replaces the resource and assigns it a new name, <strong><a href="https://aws.amazon.com/es/premiumsupport/knowledge-center/cloudformation-custom-name/" target="_blank" rel="noopener">avoiding errors.</a></strong></p>
<p>&nbsp;</p>
<h2 style="text-align: left;">Tagging</h2>
<p style="text-align: left;">Adding tags to AWS resources is a must. The <a href="https://aws.amazon.com/es/blogs/apn/how-better-tagging-can-help-organizations-optimize-expenses-and-improve-roi/" target="_blank" rel="noopener">advantages of using tags</a> are many and there aren’t drawbacks. Adding tags in CDK is very easy, as shown in the following image:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8056 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-9.png" alt="CDK geko consultoría cloud" width="733" height="482" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-9.png 733w, https://geko.cloud/wp-content/uploads/2022/04/image-9-300x197.png 300w" sizes="(max-width: 733px) 100vw, 733px" /></p>
<p style="text-align: left;">Regarding which tags to use, it depends on several factors, however, the tag Name is essential especially because, as we have seen in the previous section, identifiers that CDK assigns to resources are unintelligible. Adding a tag Name to all resources makes it much easier to easily identify resources. We could also use the Owner tag in order to identify which department owns  the infrastructure. The Project tag is a classic example, it is usually used to identify which resources belong to a project. In any case, even if you don’t agree with the recommended tags, you should define a tagging policy aligned with the compliance of your company because it will greatly facilitate the management of your infrastructure, either to locate resources or to identify costs.</p>
<p>&nbsp;</p>
<h2 style="text-align: left;">Testing</h2>
<p style="text-align: left;">Testing your application is always a best practice and good advice to follow. It helps us find bugs more easily, deliver higher quality software, and it can even help us develop faster if we use development methodologies like TDD. In CDK there are two types of <a href="https://docs.aws.amazon.com/cdk/v2/guide/testing.html" target="_blank" rel="noopener">tests</a> that we are going to see.</p>
<p>On the one hand, there are fine-grained tests, that are very similar to unit tests. In a fine-grained test you can perform various checks. For instance, you can check that your application is creating a certain type of resource, for example an RDS instance. You can also verify the properties of your resources. For example, it’s possible to verify that the RDS instance that we have seen in the identifiers section are using MySQL version 8.0.16 as database engine:</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8058 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-10.png" alt="CDK geko consultoría cloud" width="682" height="372" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-10.png 682w, https://geko.cloud/wp-content/uploads/2022/04/image-10-300x164.png 300w" sizes="(max-width: 682px) 100vw, 682px" /></p>
<p style="text-align: left;">To implement test in CDK you will need to import the <a href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.assertions-readme.html" target="_blank" rel="noopener">assertions</a> module. If you use Python you can use <a href="https://docs.pytest.org/en/7.1.x/" target="_blank" rel="noopener">Pytest</a> to implement your tests.</p>
<p style="text-align: left;">On the other hand are the snapshot tests. These tests are used when you want to refactor the code of your CDK application. Use snapshot tests to check you don’t introduce changes when refactoring your applications. In order to run snapshot tests in Python, you have to install the <strong><a href="https://github.com/tophat/syrupy" target="_blank" rel="noopener">Syrupy</a></strong> python library. Once installed you can start creating your snapshot tests:</p>
<p><img loading="lazy" decoding="async" class="wp-image-8061 size-full aligncenter" src="https://geko.cloud/wp-content/uploads/2022/04/image-11.png" alt="CDK geko consultoría cloud" width="578" height="252" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-11.png 578w, https://geko.cloud/wp-content/uploads/2022/04/image-11-300x131.png 300w" sizes="(max-width: 578px) 100vw, 578px" /></p>
<p style="text-align: left;">This test has two parameters, the first one is the CDK <strong><a href="https://docs.aws.amazon.com/cdk/v2/guide/environments.html" target="_blank" rel="noopener">environment</a></strong> and the second one is the snapshot parameter that represents the cloudformation template used as a reference to execute the snapshot test. Snapshot parameter is managed by the Syrupy library, you just have to define it. The test creates the stack to check in the first place. It obtains the cloudformation template of the stack and compares it with the snapshot parameter. If the template doesn’t match with the snapshot parameter, the test fails. When executing a snapshot type test for the first time, you must define the –snapshot-update flag, like this:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-8074" src="https://geko.cloud/wp-content/uploads/2022/04/Captura-1024x70.jpg" alt="" width="1000" height="69" srcset="https://geko.cloud/wp-content/uploads/2022/04/Captura-1024x70.jpg 1024w, https://geko.cloud/wp-content/uploads/2022/04/Captura-300x21.jpg 300w, https://geko.cloud/wp-content/uploads/2022/04/Captura-768x53.jpg 768w, https://geko.cloud/wp-content/uploads/2022/04/Captura.jpg 1264w" sizes="(max-width: 1000px) 100vw, 1000px" /></p>
<p style="text-align: left;">When you run this command, Syrupy library will create a folder called __snapshots__ in your tests folder.</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-8063 size-full" src="https://geko.cloud/wp-content/uploads/2022/04/image-12.png" alt="CDK geko consultoría cloud" width="385" height="355" srcset="https://geko.cloud/wp-content/uploads/2022/04/image-12.png 385w, https://geko.cloud/wp-content/uploads/2022/04/image-12-300x277.png 300w" sizes="(max-width: 385px) 100vw, 385px" /></p>
<p style="text-align: left;">The cloudformation template generated by the CdkGekoStack stack will be saved in __snapshot__ folder. The next time you want to run the snapshot type test, you have to run the python -m pytest command without the –snapshot-update flag. If the CdkGekoStack stack returns a template that doesn’t match with the template that Syrupy has already saved in the __snapshot__ folder, the test will fail.</p>
<p>&nbsp;</p>
<h2 style="text-align: left;">Resume</h2>
<p style="text-align: left;">In this post we have talked about naming convention, tagging and testing. Concepts as basic as important. We promise that in the<strong> next post, we are going to talk about more complex concepts such as property management and constructs.</strong> So far, we say goodbye. See you!</p>
<p>If you require any further information, feel free to<strong><a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener"> contact us.</a></strong></p>
<p>&nbsp;</p>
<p>La entrada <a href="https://geko.cloud/en/consejos-practicos-para-sacar-mayor-provecho-a-cdk-parte-1/">Practical tips to improve your developments in CDK [Part 1]</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/consejos-practicos-para-sacar-mayor-provecho-a-cdk-parte-1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Kubernetes security &#8211; microservices, macrothreats</title>
		<link>https://geko.cloud/en/kubernetes-security-microservices-macrothreats/</link>
					<comments>https://geko.cloud/en/kubernetes-security-microservices-macrothreats/#respond</comments>
		
		<dc:creator><![CDATA[Geko Cloud]]></dc:creator>
		<pubDate>Mon, 11 Apr 2022 14:58:16 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=7320</guid>

					<description><![CDATA[<p>Apparently migrating your application to a microservice model didn&#8217;t solve all your problems. Who could have predicted this would hapen? Kubernetes is a platform that has revolutionized the world of application development, from lifecycle management to scalability architecture. All of thhe components that you used to manage with a fleet of VM instances about as [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/kubernetes-security-microservices-macrothreats/">Kubernetes security &#8211; microservices, macrothreats</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Apparently migrating your application to a microservice model didn&#8217;t solve all your problems. <strong>Who could have predicted this would hapen?</strong></p>
<p>Kubernetes is a platform that has revolutionized the world of application development, from <strong>lifecycle management</strong> to <strong>scalability architecture</strong>. All of thhe components that you used to manage with a fleet of VM instances about as big as your EC2 monthly bill, now lives inside of a group of containers that scale up and down on capacity (and costs!) as necessary. The dream scenario of pay-as-you-go. But as it&#8217;s always the case, a <strong>new design pattern implies a new cyberattack front to defend</strong>.</p>
<p>Let&#8217;s explore what can happen in a microservices-oriented model, and how we can find out about it and prevent it from affecting us.</p>
<h2>Why does microservice isolation not stop attacks?</h2>
<p>This is only partially correct. As everything we find on this industry today, a good part of that <strong>depends on how you manage it</strong>. For example, after getting rid of the traditional monolith model, an attacker with shell access from your web server (or <em>web container</em>, in this case) <strong>doesn&#8217;t have automatic access to your database backend</strong>, because it&#8217;s in a <strong>completely different container</strong>. Why doesn&#8217;t that completely stop attacks that involve accessing your database? Well, the problem is that <strong>your web application still needs access to your database backend</strong>, and thus still neets to have a<strong>ccess credentials mounted on the system</strong> to be able to use them.</p>
<h2>Does this mean the microservice architecture is useless and I should go back to the monolith?</h2>
<p>Not exactly. It is true that <strong>a potential attack vector still exists</strong> in the microservice architecture, but this atack model is <strong>very different compared to the ones used against a monolithic system</strong>. It hasn&#8217;t solved all of your problms, and it&#8217;s not worse than the last design you had, it&#8217;s just that <strong>your security paradigm has changed</strong>. It requires more access layers to execute an attack, which helps you defend using the<strong> onion layer model</strong>, a more powerful defense than the alternative. Think it <strong>as a compromise</strong> that requires you to learn a new threat landscape, in exchange of letting your application scale much faster and better as required for a better adjusted cost.</p>
<h2>I like the idea. Can I use the defense tools I already know?</h2>
<p>At the application level, for example a web application or site, the tools are the same you already know and love. <strong>A WordPress is a WordPress</strong>, wether you install it in a LAMP stack on a Raspberry Pi or in a horizontally scalable container cluster. <strong>At an infrastructure level, however, it&#8217;s a different story</strong>. New stack, new defense. If you use a managed Kubernetes cluster from a cloud provider like AWS, you probably <strong>can&#8217;t even access your cluster nodes through SSH</strong>. The bruteforce threat disappears, but in exchange, what is an attacker finds your Kubernetes API endpoint and manages to start a malicious container? <strong>Would your current monitoring stack alert you?</strong></p>
<h2>What parts of the paradigm do I need to protect?</h2>
<p>Kubernetes is a container orchestration tool that at first glance <strong>can seem like an impossible to assume level of complexity</strong>, but if we separate it in its simple purposes to make it into manageable pieces (like with microservices!) we end up discovering that there are <strong>two main pillars to protect</strong>:<strong> resources</strong> (what you deploy in your cluster), and <strong>infrastructure</strong> (how you configure your cluster). Let&#8217;s tackle these topics one by one.</p>
<p>The first one, more developer-oriented, covers what do we need to check when we speak <strong>about application design and how we deploy it</strong>. For example, Kubernetes configures a <strong>flat non-segmented network</strong> for all pods, where all containers can reach any other container in the cluster. If you don&#8217;t allow your VM fleet to live in a flat unmanaged network, <strong>you should not let your microservices do either</strong>. Check what secrets and credentials can your resources see from production and development. Check what the service account attached to your web pod can do, because it might surprise you. <strong>Good permission management</strong> will allow you to use the Kubernetes horizontal scalability capability <strong>without sacrificing security or isolation</strong>.</p>
<p>On the other hand we have the <strong>cluster configuration</strong>. If an attacker finds your <strong>Kubernetes cluster API endpoint</strong>, think about <strong>what they can do with it</strong>. If anonymous authentication is enabled, your attacker can do <strong>a very strong first information gathering step</strong> that will be very useful for future attacks. Any information discovered about your cluster can be used against you.</p>
<h2>I should check all of this, but it&#8217;s a big task to handle by hand&#8230;</h2>
<p>The Open Source community has your back. You <strong>don&#8217;t need to check all your resources</strong> looking for risks that you may not understand, or that don&#8217;t even know they exist. Let <strong>specialized tools</strong> do the hard work for you and focus on makin your infrastructure more secure. The tool list is long for any part of the development cycle you need to check.</p>
<p>Are the images coming out of your CICD pipeline secure? <strong>Snyk</strong> and <strong>Trivy</strong> will give you the CVE alerts you need in a neat and categorized report. Doubts about what the third-party stacks on your cluster are doing? <strong>Falco</strong> is on the lookout for any suspicious behavior inside your cluster to give you actionable alerts. Is your cluster properly configured?<strong> kube-bench</strong> will show you what security improvements need to be applied to your API server, plus some quality recommendations you can use to step up your security posture. The list of tools to protect your new infrastructure model is endless and they deserve a good look, wether they are community-driven or require a license.</p>
<h2>Learning these tools looks like a learning curve</h2>
<p>Geko can <strong>take that weight off of your shoulders</strong>. Instead of investing valuable work time in learning a series of constantly evolving tools and rules, you can let the Geko team the task of finding this information and giving you actionable reports to act upon. Like the idea? <strong><a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener">Let&#8217;s have a chat</a> </strong>and find out how we can give you peace of mind while you keep working on what matters to you.</p>
<p>La entrada <a href="https://geko.cloud/en/kubernetes-security-microservices-macrothreats/">Kubernetes security &#8211; microservices, macrothreats</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/kubernetes-security-microservices-macrothreats/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to recover an accidentally-deleted AWS elastic IP</title>
		<link>https://geko.cloud/en/recover-accidentally-deleted-aws-elastic-ip/</link>
					<comments>https://geko.cloud/en/recover-accidentally-deleted-aws-elastic-ip/#respond</comments>
		
		<dc:creator><![CDATA[Geko Cloud]]></dc:creator>
		<pubDate>Mon, 07 Feb 2022 17:31:52 +0000</pubDate>
				<category><![CDATA[Labs]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[DevOps specialist]]></category>
		<category><![CDATA[DevOps Support]]></category>
		<guid isPermaLink="false">https://geko.cloud/?p=7201</guid>

					<description><![CDATA[<p>Introduction Recover accidentally deleted AWS elastic IP. It may not be the most common thing for the average AWS user but for those who work in the cloud industry it&#8217;s an everyday task to manage several AWS accounts. Either through a catalog of login links or through a list of account IDs (and their matching [&#8230;]</p>
<p>La entrada <a href="https://geko.cloud/en/recover-accidentally-deleted-aws-elastic-ip/">How to recover an accidentally-deleted AWS elastic IP</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p style="text-align: justify;">Recover accidentally deleted AWS elastic IP. It may not be the most common thing for the average AWS user but for those who work in the cloud industry it&#8217;s an everyday task to manage several AWS accounts. Either through a catalog of login links or through a list of account IDs (and their matching credentials), or through a role impersonation manager <span class="ILfuVd"><span class="hgKElc">—</span></span> the fact is that sooner or later it could happen that one account is mistakenly confused with another and an unwanted action is carried out.</p>
<p style="text-align: justify;">That&#8217;s the case it&#8217;s being exposed today, in which some tasks were being done on a new account and the created infra there was disposable. It happened that by mistake this new account was mistook with the base account <span class="ILfuVd"><span class="hgKElc">—</span></span> the Geko&#8217;s one <span class="ILfuVd"><span class="hgKElc">— where the elastic IP for the company&#8217;s bastion is hosted. Yes, indeed, that key point used to access other infrastructures in a secure way, and which these other infrastructures consider as a safe origin. In other words, that particular IP was used as one of the security measures when verifying the origin of the connections. An IP which was placed in many configurations, and which was not trivial to replace. Well, that IP was released by mistake. In AWS the word &#8220;release&#8221; is used to refer to the action of removing the IP from the account, leaving it available to the rest of the provider&#8217;s users.</span></span></p>
<p style="text-align: justify;"><span class="ILfuVd"><span class="hgKElc">It&#8217;s not necessary to describe the moments of maximum alert that followed the IP&#8217;s release but the possibility of having lost that address forever because it had been assigned to another user, began to take over the tension of the moment. </span></span>However, there&#8217;s a reason to have crisis cabinets, and above all there&#8217;s a big importance to be able to count on a team composed by professionals in the area. Brainstorming was fogging up the windows when suddenly a lightning of hope made everything to stop.  There was still a chance. AWS had foreseen this catastrophic event and Geko found the way to recover what had always been its own but which it had never valued that much.</p>
<p style="text-align: justify;">Has it happened to you? Would you like to know how it was solved? Keep reading and don&#8217;t miss out how this epic story ended!</p>
<h2>Recover the AWS elastic IP which was accidentally deleted</h2>
<p style="text-align: justify;">Recover accidentally deleted AWS elastic IP. As it was previously stated, once an elastic IP is released it then belongs to the pool of available IPs for the users, so recover it could be impossible in the case it was reassigned. Nonetheless, AWS realized this situation could cause troubles so <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html#using-eip-recovering">they developed a procedure to recover from this scenario</a>. Despite this is not something you can do through the web console, recover the lost IP can be achieved by running <a href="https://docs.aws.amazon.com/cli/latest/reference/ec2/allocate-address.html">just one command</a>.</p>
<div class="wp-block-codemirror-blocks code-block ">
<pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:true,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}">MY_IP=48.151.62.342
aws ec2 allocate-address --domain vpc --address $MY_IP</pre>
</div>
<p style="text-align: justify;">Yes, you need to know the IP address you want to recover but <span class="ILfuVd"><span class="hgKElc">—</span></span> if it&#8217;s critical enough to make you want to get it again <span class="ILfuVd"><span class="hgKElc">—</span></span> it should be something you should be able to retrieve.</p>
<p><img loading="lazy" decoding="async" class="n3VNCb aligncenter" src="https://c.tenor.com/A-ozELwp694AAAAC/thumbs-thumbs-up-kid.gif" alt="Thumbs Up Kid" width="498" height="373" data-noaft="1" data-pagespeed-url-hash="958420522" /></p>
<h2>What else could go wrong?</h2>
<p style="text-align: justify;">It happens that in this case there was an additional factor that could add more complexity to the situation, and in fact it did. At Geko <span class="ILfuVd"><span class="hgKElc">— in order to have credentials for the AWS CLI </span></span><span class="ILfuVd"><span class="hgKElc">— temporary keys are generated after going through a multi-factor verification process (which can also be revoked at any time), and these credentials are retrieved from the aforementioned</span></span> bastion. Connecting the dots it can be concluded that the situation had fallen into cyclic dependency since to fix the problem a credentials set needed to be generated while the problem itself was preventing us to do so. Of course there were alternative methods to get out of the loop, but in the end it was enough to use some not-yet-expired credentials we were able to obtain.</p>
<h2>Conclusion</h2>
<p style="text-align: justify;">Throughout this short <span class="ILfuVd"><span class="hgKElc">— but intense </span></span><span class="ILfuVd"><span class="hgKElc">— story, the importance of having a team around you has been shown</span></span>. Keeping aside pride and rising the alarm was what made the solution to appear in a matter of a few minutes. As it&#8217;s commonly said <span class="ILfuVd"><span class="hgKElc">—</span></span> <em>Two pair of eyes can see more than one</em>.</p>
<p style="text-align: justify;">On the other hand, we learned and reinforced a set of good practices which could be the key next time. They are the following ones.</p>
<ol>
<li style="text-align: justify;">Ensure you have some emergency credentials in case something happens in the bastion.</li>
<li style="text-align: justify;">Ensure the account you&#8217;re trying to modify is the one you actually want to modify. It&#8217;s better to spend a little bit more time checking twice than to be sorry later.</li>
<li style="text-align: justify;">Protect valuable resources at all cost, such as creating IAM policies to deny any harmful actions.</li>
</ol>
<p>&nbsp;</p>
<p style="text-align: justify;">We hope this article has helped you to learn something new and continue to expand your knowledge. If you need information about <strong><a href="https://geko.cloud/en/" target="_blank" rel="noopener">Cloud and the DevOps</a> </strong>world, we invite you to <a href="https://geko.cloud/en/contact/" target="_blank" rel="noopener"><strong>contact us</strong></a> and keep checking out <a href="https://geko.cloud/en/blog/labs/" target="_blank" rel="noopener"><strong>our blog</strong></a> in order to find other useful publications. See you soon!</p>
<p>La entrada <a href="https://geko.cloud/en/recover-accidentally-deleted-aws-elastic-ip/">How to recover an accidentally-deleted AWS elastic IP</a> se publicó primero en <a href="https://geko.cloud/en/">Geko Cloud</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://geko.cloud/en/recover-accidentally-deleted-aws-elastic-ip/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
