<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Paul Micheli</title>
    <description>The latest articles on DEV Community by Paul Micheli (@paulmicheli).</description>
    <link>https://dev.to/paulmicheli</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F463569%2F6e14d753-53ab-409b-9e8e-c6d4b7830c53.jpeg</url>
      <title>DEV Community: Paul Micheli</title>
      <link>https://dev.to/paulmicheli</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/paulmicheli"/>
    <language>en</language>
    <item>
      <title>DevOps Study Roadmap</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Mon, 02 Aug 2021 09:05:16 +0000</pubDate>
      <link>https://dev.to/paulmicheli/devops-study-roadmap-4j2i</link>
      <guid>https://dev.to/paulmicheli/devops-study-roadmap-4j2i</guid>
      <description>&lt;h4&gt;
  
  
  1. Learning a programming language
&lt;/h4&gt;

&lt;p&gt;You need to get a good grasp of a programming language. It doesn't matter which one, but it's needed for writing automation code. Automation is a key part of DevOps. You can learn Python, Java, Ruby, Golang etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Understand different OS concepts
&lt;/h4&gt;

&lt;p&gt;As suggested in the roadmap, you need to learn about process management, threads &amp;amp; concurrency, sockets, I/O management, virtualization, memory system, etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Learn to Live in terminal
&lt;/h4&gt;

&lt;p&gt;Terminal commands are essential for a DevOps engineer, especially if you are working on linux. You need to learn commands for process monitoring, text manipulation, system performance, etc. When you practice these commands, you can become a master at shell scripting.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Network, Security &amp;amp; Protocols
&lt;/h4&gt;

&lt;p&gt;You need to be familiar with various types of protocols which play a major role in communicating with different devices across the network like TCP/IP, HTTP, HTTPS, SMTP, FTP etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. What is and how to setup
&lt;/h4&gt;

&lt;p&gt;In general, a DevOps engineer should know how to set up a web server like IIS, Nginx, Apache and Tomcat. They should also know about Caching Server, Load balancer, Reverse Proxy, and Firewall, etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  6. Learn Infrastructure as code
&lt;/h4&gt;

&lt;p&gt;This is one of the most critical component in the learning path of a DevOps engineer. You need to learn about app containerization and have thorough understand of container tools like Docker and Kubernetes. Infrastructure provisioning tools such as Cloudformation, CDK, Terrafor,. Configuration management tools like Ansible, Chef, Salt &amp;amp; Puppet. Other areas include container orchestration and infrastructure provisioning.&lt;/p&gt;

&lt;h4&gt;
  
  
  7. Learn some Continuous Integration and Delivery (CI/CD) tools
&lt;/h4&gt;

&lt;p&gt;Continuous Integration/Continuous Deployment is now a core part of setting a DevOps culture. So you should get familiar with CI/CD tools like Jenkins, Github actions etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  8. Learn to monitor software and infrastructure
&lt;/h4&gt;

&lt;p&gt;When you have thousands of services running, it's important to make sure that the system is running in fine health. Both your infrastructure and application should be continuously monitored. &lt;/p&gt;

&lt;h4&gt;
  
  
  9. Learn about Cloud Providers
&lt;/h4&gt;

&lt;p&gt;Most of the apps today are built as cloud-native. So you need to make yourself familiar with major cloud providers. AWS, Azure and Google Cloud are the leading players.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>study</category>
    </item>
    <item>
      <title>SSH Key Best Practices</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Thu, 22 Apr 2021 11:00:52 +0000</pubDate>
      <link>https://dev.to/paulmicheli/ssh-key-best-practices-2cb7</link>
      <guid>https://dev.to/paulmicheli/ssh-key-best-practices-2cb7</guid>
      <description>&lt;h2&gt;
  
  
  Ensure Separation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Ensure SSH Keys Are Associated With a Single Services
&lt;/h3&gt;

&lt;p&gt;Tie SSH keys back to an individual services, rather than just a generic key that is associated with multiple services github / acquia /aws etc . This will provide an effective SSH audit trail and more direct oversight.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use a separate key per client you SSH from
&lt;/h3&gt;

&lt;p&gt;So don’t copy the private key from your laptop to another laptop for use in parallel. Each client system should have only one key, so in case a key leaks, you know which client system was compromised. If you stop using your old laptop and start using a new one it is naturally another case and then you can copy the key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comments
&lt;/h2&gt;

&lt;p&gt;Adding comments to keys can allow you to organize your keys more easily. The comments are stored in end of the public key file and can be viewed in clear text. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; ~/.ssh/&lt;span class="o"&gt;{&lt;/span&gt;keyservice&lt;span class="o"&gt;}&lt;/span&gt;_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDG..........qiaWxRUdk0UKU0c5ZqQYHRCw&lt;span class="o"&gt;==&lt;/span&gt; username@hostname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Choose different SSH algorithm
&lt;/h2&gt;

&lt;p&gt;Once a key pair is generated, its algorithm cannot be changed. So you need to be careful about the algorithm. Some of the options are as below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RSA – Default and most popular algorithm. It is based on the difficulty of factoring large numbers. A key size of at least 4096 bits is recommended for RSA. RSA is getting old and significant advances are being made in factoring. Choosing a different algorithm is advisable where possible.&lt;/li&gt;
&lt;li&gt;DSA – An old US government Digital Signature Algorithm. It is based on the difficulty of computing discrete logarithms. A key size of 1024 would normally be used with it. DSA in its original form is no longer recommended.&lt;/li&gt;
&lt;li&gt;ECDSA – A new Digital Signature Algorithm standardized by the US government, using elliptic curves. This is the recommended algorithm for current applications/service if supported. Only three key sizes are supported: 256, 384, and 521 (sic!) bits. Most SSH clients now support this algorithm.&lt;/li&gt;
&lt;li&gt;ED25519 – This is one of the new algorithms added in OpenSSH. Support for it in clients is not yet universal. You need to check the documentation of the SSH clients and servers, if they support this algorithm. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Generation
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;NOTE:&lt;/em&gt;&lt;/strong&gt; Only use RSA if it is the only option for the service offers, follow "Choose different SSH algorithm"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The algorithm is selected using the -t option and key size using the -b option. &lt;/p&gt;

&lt;p&gt;If you do not want the ssh-keygen to prompt you for the filename, you can supply it using -f option. &lt;/p&gt;

&lt;p&gt;To add a comment to the public key file when generating the key add to the key generation command -C "username@hostname". The following commands illustrate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/github_rsa &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"username@hostname"&lt;/span&gt;

ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; dsa &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/github_dsa &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"username@hostname"&lt;/span&gt;

ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ecdsa &lt;span class="nt"&gt;-b&lt;/span&gt; 521 &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/github_rsa &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"username@hostname"&lt;/span&gt;

ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/github_ed &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"username@hostname"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Stay vigilant
&lt;/h2&gt;

&lt;p&gt;If running ssh remote.example.com yields some error messages, don’t ignore them! SSH has an opportunistic key model, which is convenient, but it also means that if you are confronted with warnings that the connection might be eavesdropped you should really take note and not proceed.&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>devops</category>
      <category>linux</category>
      <category>security</category>
    </item>
    <item>
      <title>Simplify Your Life With an SSH Config File</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Thu, 22 Apr 2021 10:53:47 +0000</pubDate>
      <link>https://dev.to/paulmicheli/simplify-your-life-with-an-ssh-config-file-411g</link>
      <guid>https://dev.to/paulmicheli/simplify-your-life-with-an-ssh-config-file-411g</guid>
      <description>&lt;p&gt;If you're anything like me, you probably log in and out of a half dozen remote servers (or these days, local virtual machines) on a daily basis. And if you're even more like me, you have trouble remembering all of the various usernames, remote addresses and command line options for things like specifying a non-standard connection port or forwarding local ports to the remote machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell Aliases
&lt;/h2&gt;

&lt;p&gt;Let's say that you have a remote server named dev.example.com, which has not been set up with public/private keys for password-less logins. The username to the remote account is fooey, and to reduce the number of scripted login attempts, you've decided to change the default SSH port to 2200 from the normal default of 22. This means that a typical command would look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ssh paulmicheli@dev.example.com &lt;span class="nt"&gt;-p&lt;/span&gt; 22000

password: &lt;span class="k"&gt;*************&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not too bad.&lt;/p&gt;

&lt;p&gt;We can make things simpler and more secure by using a public/private key pair; I highly recommend using ssh-copy-id for moving your public keys around. It will save you quite a few folder/file permission headaches.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ssh paulmicheli@dev.example.com &lt;span class="nt"&gt;-p&lt;/span&gt; 22000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assuming your keys are properly setup…&lt;/p&gt;

&lt;p&gt;Now this doesn't seem all that bad. To cut down on the verbosity you could create a simple alias in your shell as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;dev&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'ssh paulmicheli@dev.example.com -p 22000'&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;dev &lt;span class="c"&gt;# To connect&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works surprisingly well: Every new server you need to connect to, just add an alias to your .bashrc (or .zshrc if you hang with the cool kids), and voilà.&lt;/p&gt;

&lt;h2&gt;
  
  
  ~/.ssh/config
&lt;/h2&gt;

&lt;p&gt;However, there's a much more elegant and flexible solution to this problem. Enter the SSH config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# contents of $HOME/.ssh/config&lt;/span&gt;

Host dev
    HostName dev.example.com
    Port 22000
    User paulmicheli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that I can simply $ ssh dev, and the options will be read from the configuration file. Easy peasy. Let's see what else we can do with just a few simple configuration directives.&lt;/p&gt;

&lt;p&gt;Personally, I use quite a few public/private keypairs for the various servers and services that I use, to ensure that in the event of having one of my keys compromised the damage is as restricted as possible. For example, I have a key that I use uniquely for my Github account. Let's set it up so that that particular private key is used for all my github-related operations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Host dev
    HostName dev.example.com
    Port 22000
    User paulmicheli

Host github.com
    IdentityFile ~/.ssh/github_ecdsa

Host prod.ssh.hostingservice.com
    user user.prod
    IdentityFile ~/.ssh/hosting_service_rsa

Host dev.ssh.hostingservice.com
    user user.dev
    IdentityFile ~/.ssh/hosting_service_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The use of IdentityFile allows me to specify exactly which private key I wish to use for authentification with the given host. You can, of course, simply specify this as a command line option for "normal" connections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; ~/.ssh/blah.key username@host.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but the use of a config file with IdentityFile is pretty much your only option if you want to specify which identity to use for any git commands. This also opens up the very interesting concept of further segmenting your github keys on something like a per-project or per-organization basis:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Host github-project1
    User git
    HostName github.com
    IdentityFile ~/.ssh/github.project1.key

Host github-org
    User git
    HostName github.com
    IdentityFile ~/.ssh/github_ecdsa

Host github.com
    User git
    IdentityFile ~/.ssh/github.key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which means that if I want to clone a repository using my organization credentials, I would use the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git clone git@github-org:orgname/some_repository.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
      <category>ssh</category>
      <category>devops</category>
      <category>bash</category>
    </item>
    <item>
      <title>Improving My DBA Skill-Set</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Wed, 30 Sep 2020 10:30:21 +0000</pubDate>
      <link>https://dev.to/paulmicheli/improving-my-dba-skill-set-52bf</link>
      <guid>https://dev.to/paulmicheli/improving-my-dba-skill-set-52bf</guid>
      <description>&lt;p&gt;I want to improve my DBA skill-set and wanted to reach out to the community to point me in a good direction, Mainly starting with Relational Databases.&lt;/p&gt;

&lt;p&gt;Where is best to start? &lt;/p&gt;

</description>
      <category>database</category>
      <category>devops</category>
      <category>learning</category>
    </item>
    <item>
      <title>Upgrade AWS Elastic Beanstalk PHP Major version</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Mon, 28 Sep 2020 11:11:16 +0000</pubDate>
      <link>https://dev.to/paulmicheli/upgrade-aws-elastic-beanstalk-php-major-version-5do</link>
      <guid>https://dev.to/paulmicheli/upgrade-aws-elastic-beanstalk-php-major-version-5do</guid>
      <description>&lt;p&gt;The AWS Elastic Beanstalk Console currently allows you to change between minor platform versions ( e.g. 64bit Amazon Linux 2018.03 v2.9.10 running PHP 7.1 to64bit Amazon Linux 2018.03 v3.1.10 running PHP 7.1), but doesn’t support changes between major versions (e.g. 64bit Amazon Linux 2018.03 v2.9.10 running PHP 7.1 to 64bit Amazon Linux 2 v3.1.1 running PHP 7.3).&lt;/p&gt;

&lt;p&gt;But is it possible to update to a major platform version using the AWS Command Line Interface (CLI):&lt;/p&gt;

&lt;p&gt;You will need to get the &lt;code&gt;EnviromentID&lt;/code&gt; of the beanstalk environment using the below command;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;paulmicheli@minime:~&lt;span class="nv"&gt;$ &lt;/span&gt;aws elasticbeanstalk describe-environments &lt;span class="nt"&gt;--environment-names&lt;/span&gt; APP1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You will get the &lt;code&gt;EnvironmentID&lt;/code&gt; from the out;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Environments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"APP1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"e-***********4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"ApplicationName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Application 1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"VersionLabel"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"app_1_branch-28-09-2020"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"SolutionStackName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"64bit Amazon Linux 2018.03 v2.9.10 running PHP 7.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"PlatformArn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:elasticbeanstalk:us-east-1::platform/PHP 7.1 running on 64bit Amazon Linux/2.9.10"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PHP 7.1 env"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"EndpointURL"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"app1.elb.amazonaws.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"CNAME"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"app1.elb.amazonaws.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"DateCreated"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2019-05-15T10:44:17.800000+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"DateUpdated"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2020-09-25T13:01:05.997000+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ready"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"AbortableOperationInProgress"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Health"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Green"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"HealthStatus"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ok"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Tier"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"Name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"WebServer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Standard"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentLinks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentArn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:elasticbeanstalk:us-east-1:123456789101:environment/Application 1/APP1"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You will need to provide the &lt;code&gt;--solution-stack-name&lt;/code&gt;  these can be found by running this command;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;paulmicheli@minime:~&lt;span class="nv"&gt;$ &lt;/span&gt;aws elasticbeanstalk list-available-solution-stacks
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Once you have the Environment ID you can run the below command,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;paulmicheli@minime:~&lt;span class="nv"&gt;$ &lt;/span&gt;aws elasticbeanstalk update-environment &lt;span class="nt"&gt;--solution-stack-name&lt;/span&gt; &lt;span class="s2"&gt;"64bit Amazon Linux 2 v3.1.1 running PHP 7.3"&lt;/span&gt; &lt;span class="nt"&gt;--environment-id&lt;/span&gt; &lt;span class="s2"&gt;"e-***********4"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The out put of the command will state the old &lt;code&gt;PlatformArn&lt;/code&gt;, this will update once the Environment has updated;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"APP1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"e-***********4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ApplicationName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Application 1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"VersionLabel"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"app_1_branch-28-09-2020"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"SolutionStackName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"64bit Amazon Linux 2018.03 v2.9.10 running PHP 7.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"PlatformArn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:elasticbeanstalk:us-east-1::platform/PHP 7.1 running on 64bit Amazon Linux/2.9.10"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PHP 7.1 env"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"EndpointURL"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"app1.elb.amazonaws.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"CNAME"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"app1.elb.amazonaws.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"DateCreated"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2019-05-15T10:44:17.800000+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"DateUpdated"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2020-09-25T13:29:34.420000+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Updating"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"AbortableOperationInProgress"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Health"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Grey"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Tier"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"WebServer"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Standard"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"EnvironmentArn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:elasticbeanstalk:us-east-1:123456789101:environment/Application 1/APP1"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Rerun the below command and the &lt;code&gt;PlatformARN&lt;/code&gt; will update once the update has completed;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;paulmicheli@minime:~&lt;span class="nv"&gt;$ &lt;/span&gt;aws elasticbeanstalk describe-environments &lt;span class="nt"&gt;--environment-names&lt;/span&gt; APP1
&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Environments"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"EnvironmentName"&lt;/span&gt;: &lt;span class="s2"&gt;"APP1"&lt;/span&gt;,
            &lt;span class="s2"&gt;"EnvironmentId"&lt;/span&gt;: &lt;span class="s2"&gt;"e-***********4"&lt;/span&gt;,
            &lt;span class="s2"&gt;"ApplicationName"&lt;/span&gt;: &lt;span class="s2"&gt;"Application 1"&lt;/span&gt;,
            &lt;span class="s2"&gt;"VersionLabel"&lt;/span&gt;: &lt;span class="s2"&gt;"app_1_branch-28-09-2020"&lt;/span&gt;,
            &lt;span class="s2"&gt;"SolutionStackName"&lt;/span&gt;: &lt;span class="s2"&gt;"64bit Amazon Linux 2 v3.1.1 running PHP 7.3"&lt;/span&gt;,
            &lt;span class="s2"&gt;"PlatformArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:elasticbeanstalk:us-east-1::platform/PHP 7.3 running on 64bit Amazon Linux 2/3.1.1"&lt;/span&gt;,
            &lt;span class="s2"&gt;"Description"&lt;/span&gt;: &lt;span class="s2"&gt;"PHP 7.1 env"&lt;/span&gt;,
            &lt;span class="s2"&gt;"EndpointURL"&lt;/span&gt;: &lt;span class="s2"&gt;"app1.elb.amazonaws.com"&lt;/span&gt;,
            &lt;span class="s2"&gt;"CNAME"&lt;/span&gt;: &lt;span class="s2"&gt;"app1.elb.amazonaws.com"&lt;/span&gt;,
            &lt;span class="s2"&gt;"DateCreated"&lt;/span&gt;: &lt;span class="s2"&gt;"2019-05-15T10:44:17.800000+00:00"&lt;/span&gt;,
            &lt;span class="s2"&gt;"DateUpdated"&lt;/span&gt;: &lt;span class="s2"&gt;"2020-09-25T13:30:58.881000+00:00"&lt;/span&gt;,
            &lt;span class="s2"&gt;"Status"&lt;/span&gt;: &lt;span class="s2"&gt;"Ready"&lt;/span&gt;,
            &lt;span class="s2"&gt;"AbortableOperationInProgress"&lt;/span&gt;: &lt;span class="nb"&gt;false&lt;/span&gt;,
            &lt;span class="s2"&gt;"Health"&lt;/span&gt;: &lt;span class="s2"&gt;"Green"&lt;/span&gt;,
            &lt;span class="s2"&gt;"HealthStatus"&lt;/span&gt;: &lt;span class="s2"&gt;"Ok"&lt;/span&gt;,
            &lt;span class="s2"&gt;"Tier"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="s2"&gt;"Name"&lt;/span&gt;: &lt;span class="s2"&gt;"WebServer"&lt;/span&gt;,
                &lt;span class="s2"&gt;"Type"&lt;/span&gt;: &lt;span class="s2"&gt;"Standard"&lt;/span&gt;,
                &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"1.0"&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;,
            &lt;span class="s2"&gt;"EnvironmentLinks"&lt;/span&gt;: &lt;span class="o"&gt;[]&lt;/span&gt;,
            &lt;span class="s2"&gt;"EnvironmentArn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:elasticbeanstalk:us-east-1:123456789101:environment/Application 1/APP1"&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>php</category>
    </item>
    <item>
      <title>Terraform Discussion</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Sun, 20 Sep 2020 15:56:20 +0000</pubDate>
      <link>https://dev.to/paulmicheli/terraform-discussion-3hl9</link>
      <guid>https://dev.to/paulmicheli/terraform-discussion-3hl9</guid>
      <description>&lt;h2&gt;
  
  
  How agnostic is Terraform?
&lt;/h2&gt;

&lt;p&gt;I am heavily AWS focused in my role, and use Cloudformation for my Infrastructure as code.&lt;/p&gt;

&lt;p&gt;Most DevOps Engineers I talk to are confused why I use Cloudformation over Terraform as Terraform is cloud-agnostic, they are of the opinion I should be using Terraform as I can then point to a new cloud provider and click, and &lt;em&gt;POOF!&lt;/em&gt; your stack has appeared.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.terraform.io/intro/use-cases.html"&gt;Terraform use cases&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Multi-Cloud Deployment&lt;/p&gt;

&lt;p&gt;It's often attractive to spread infrastructure across multiple clouds to increase fault-tolerance. By using only a single region or cloud provider, fault tolerance is limited by the availability of that provider. Having a multi-cloud deployment allows for more graceful recovery of the loss of a region or entire provider.&lt;/p&gt;

&lt;p&gt;Realizing multi-cloud deployments can be very challenging as many existing tools for infrastructure management are cloud-specific. Terraform is cloud-agnostic and allows a single configuration to be used to manage multiple providers, and to even handle cross-cloud dependencies. This simplifies management and orchestration, helping operators build large-scale multi-cloud infrastructures.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How agnostic is Terraform? How much work is needed to deploy a stack with some compute, network &amp;amp; Storage from one cloud provider to another? How true is the above statement? One file point to AWS, Azure, Google and it builds? &lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>iac</category>
    </item>
    <item>
      <title>AWS Automated Snapshot Cloudformation</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Sat, 19 Sep 2020 13:17:12 +0000</pubDate>
      <link>https://dev.to/paulmicheli/aws-automated-snapshot-cloudformation-1g6c</link>
      <guid>https://dev.to/paulmicheli/aws-automated-snapshot-cloudformation-1g6c</guid>
      <description>&lt;p&gt;I recently had the pleasure of overhauling the snapshot tool we have across our AWS accounts, the account was inherited from a previous admin who had configured the snapshot tooling before AWS introduced there &lt;a href="////docs.aws.amazon.com/dlm/latest/APIReference/Welcome.html"&gt;Data Lifecycle Manager&lt;/a&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With Amazon Data Lifecycle Manager, you can manage the lifecycle of your AWS resources. You create lifecycle policies, which are used to automate operations on the specified resources.&lt;br&gt;
Amazon DLM supports Amazon EBS volumes and snapshots. For information about using Amazon DLM with Amazon EBS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As we like to make sure we have every thing done as infrastructure as code, the below cloudformation template will create 4 policies for multiple retention period options, 5, 30, 60, 90 days.(you can change this to fit your needs)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;AWSTemplateFormatVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2010-09-09&lt;/span&gt;
&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;-&lt;/span&gt;
  &lt;span class="s"&gt;Amazon Data Lifecycle Manager to automate the creation, retention, and deletion of snapshots taken to back up your Amazon EBS volumes&lt;/span&gt;
&lt;span class="c1"&gt;#Metadata: &lt;/span&gt;


&lt;span class="na"&gt;Resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;dlmRole&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;AWS::IAM::Role&lt;/span&gt;
    &lt;span class="na"&gt;Properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;Path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/service-role/dlm/&lt;/span&gt;
      &lt;span class="na"&gt;AssumeRolePolicyDocument&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;Version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2012-10-17&lt;/span&gt;
        &lt;span class="na"&gt;Statement&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt;
          &lt;span class="na"&gt;Effect&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Allow"&lt;/span&gt;
          &lt;span class="na"&gt;Action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;sts:AssumeRole&lt;/span&gt;
          &lt;span class="na"&gt;Principal&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;Service&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;dlm.amazonaws.com&lt;/span&gt;
      &lt;span class="na"&gt;Policies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;PolicyName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dlmPolicy"&lt;/span&gt;
        &lt;span class="na"&gt;PolicyDocument&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;Version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2012-10-17'&lt;/span&gt;
          &lt;span class="na"&gt;Statement&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Effect&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Allow&lt;/span&gt;
            &lt;span class="na"&gt;Action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ec2:CreateSnapshot&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ec2:CreateSnapshots&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ec2:DeleteSnapshot&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ec2:DescribeVolumes&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ec2:DescribeInstances&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ec2:DescribeSnapshots&lt;/span&gt;
            &lt;span class="na"&gt;Resource&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Effect&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Allow&lt;/span&gt;
            &lt;span class="na"&gt;Action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ec2:CreateTags&lt;/span&gt;
            &lt;span class="na"&gt;Resource&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;arn:aws:ec2:*::snapshot/*&lt;/span&gt;

  &lt;span class="na"&gt;dlmLifecyclePolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS::DLM::LifecyclePolicy"&lt;/span&gt;
    &lt;span class="na"&gt;Properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DevOps&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Lifecycle&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Policy&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;using&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;CloudFormation&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;5&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
      &lt;span class="na"&gt;State&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ENABLED"&lt;/span&gt;
      &lt;span class="na"&gt;ExecutionRoleArn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!GetAtt&lt;/span&gt; &lt;span class="s"&gt;dlmRole.Arn&lt;/span&gt;
      &lt;span class="na"&gt;PolicyDetails&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;ResourceTypes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSTANCE"&lt;/span&gt;
        &lt;span class="na"&gt;TargetTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DLM-BACKUP"&lt;/span&gt;
            &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YES"&lt;/span&gt;

        &lt;span class="na"&gt;Schedules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Daily&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Snapshots&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;5&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
            &lt;span class="na"&gt;TagsToAdd&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt;
                &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type"&lt;/span&gt;
                &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DailySnapshot"&lt;/span&gt;

            &lt;span class="na"&gt;CreateRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24&lt;/span&gt;
              &lt;span class="na"&gt;IntervalUnit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HOURS"&lt;/span&gt;
              &lt;span class="c1"&gt;# UTC The time at which the policy runs are scheduled to start. The first policy run starts within an hour after the scheduled time. &lt;/span&gt;
              &lt;span class="na"&gt;Times&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;02:10"&lt;/span&gt;
            &lt;span class="na"&gt;RetainRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Count&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
            &lt;span class="na"&gt;CopyTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;

  &lt;span class="na"&gt;dlm30LifecyclePolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS::DLM::LifecyclePolicy"&lt;/span&gt;
    &lt;span class="na"&gt;Properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DevOps&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Lifecycle&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Policy&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;using&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;CloudFormation&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;30&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
      &lt;span class="na"&gt;State&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ENABLED"&lt;/span&gt;
      &lt;span class="na"&gt;ExecutionRoleArn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!GetAtt&lt;/span&gt; &lt;span class="s"&gt;dlmRole.Arn&lt;/span&gt;
      &lt;span class="na"&gt;PolicyDetails&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;ResourceTypes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSTANCE"&lt;/span&gt;
        &lt;span class="na"&gt;TargetTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DLM-30BACKUP"&lt;/span&gt;
            &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YES"&lt;/span&gt;

        &lt;span class="na"&gt;Schedules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Daily&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Snapshots&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;30&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
            &lt;span class="na"&gt;TagsToAdd&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt;
                &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type"&lt;/span&gt;
                &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DailySnapshot"&lt;/span&gt;

            &lt;span class="na"&gt;CreateRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24&lt;/span&gt;
              &lt;span class="na"&gt;IntervalUnit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HOURS"&lt;/span&gt;
              &lt;span class="c1"&gt;# UTC The time at which the policy runs are scheduled to start. The first policy run starts within an hour after the scheduled time. &lt;/span&gt;
              &lt;span class="na"&gt;Times&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;02:10"&lt;/span&gt;
            &lt;span class="na"&gt;RetainRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Count&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;
            &lt;span class="na"&gt;CopyTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;

  &lt;span class="na"&gt;dlm60LifecyclePolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS::DLM::LifecyclePolicy"&lt;/span&gt;
    &lt;span class="na"&gt;Properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DevOps&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Lifecycle&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Policy&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;using&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;CloudFormation&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;60&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
      &lt;span class="na"&gt;State&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ENABLED"&lt;/span&gt;
      &lt;span class="na"&gt;ExecutionRoleArn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!GetAtt&lt;/span&gt; &lt;span class="s"&gt;dlmRole.Arn&lt;/span&gt;
      &lt;span class="na"&gt;PolicyDetails&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;ResourceTypes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSTANCE"&lt;/span&gt;
        &lt;span class="na"&gt;TargetTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DLM-60BACKUP"&lt;/span&gt;
            &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YES"&lt;/span&gt;

        &lt;span class="na"&gt;Schedules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Daily&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Snapshots&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;60&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
            &lt;span class="na"&gt;TagsToAdd&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt;
                &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type"&lt;/span&gt;
                &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DailySnapshot"&lt;/span&gt;

            &lt;span class="na"&gt;CreateRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24&lt;/span&gt;
              &lt;span class="na"&gt;IntervalUnit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HOURS"&lt;/span&gt;
              &lt;span class="c1"&gt;# UTC The time at which the policy runs are scheduled to start. The first policy run starts within an hour after the scheduled time. &lt;/span&gt;
              &lt;span class="na"&gt;Times&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;02:10"&lt;/span&gt;
            &lt;span class="na"&gt;RetainRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Count&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;60&lt;/span&gt;
            &lt;span class="na"&gt;CopyTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;

  &lt;span class="na"&gt;dlm90LifecyclePolicy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AWS::DLM::LifecyclePolicy"&lt;/span&gt;
    &lt;span class="na"&gt;Properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DevOps&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Lifecycle&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Policy&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;using&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;CloudFormation&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;90&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
      &lt;span class="na"&gt;State&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ENABLED"&lt;/span&gt;
      &lt;span class="na"&gt;ExecutionRoleArn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!GetAtt&lt;/span&gt; &lt;span class="s"&gt;dlmRole.Arn&lt;/span&gt;
      &lt;span class="na"&gt;PolicyDetails&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;ResourceTypes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;INSTANCE"&lt;/span&gt;
        &lt;span class="na"&gt;TargetTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DLM-90BACKUP"&lt;/span&gt;
            &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YES"&lt;/span&gt;

        &lt;span class="na"&gt;Schedules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt;
            &lt;span class="na"&gt;Name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Daily&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Snapshots&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;90&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Day&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retention"&lt;/span&gt;
            &lt;span class="na"&gt;TagsToAdd&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="pi"&gt;-&lt;/span&gt;
                &lt;span class="na"&gt;Key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;type"&lt;/span&gt;
                &lt;span class="na"&gt;Value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DailySnapshot"&lt;/span&gt;

            &lt;span class="na"&gt;CreateRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24&lt;/span&gt;
              &lt;span class="na"&gt;IntervalUnit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HOURS"&lt;/span&gt;
              &lt;span class="c1"&gt;# UTC The time at which the policy runs are scheduled to start. The first policy run starts within an hour after the scheduled time. &lt;/span&gt;
              &lt;span class="na"&gt;Times&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;02:10"&lt;/span&gt;
            &lt;span class="na"&gt;RetainRule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;Count&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;90&lt;/span&gt;
            &lt;span class="na"&gt;CopyTags&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the stack has been deployed you can tag the instance you would like to automate your snapshot's with the relevant tag's (case sensitive), I did notice on the first run of each policy there is a couple hours of delay until you start to see the creation of your snapshots, this corrects its self on the second run &lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>linux</category>
    </item>
    <item>
      <title>EC2 Tagging MKII</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Mon, 14 Sep 2020 15:27:01 +0000</pubDate>
      <link>https://dev.to/paulmicheli/ec2-tagging-mkii-1p5h</link>
      <guid>https://dev.to/paulmicheli/ec2-tagging-mkii-1p5h</guid>
      <description>&lt;p&gt;A few weeks ago I posted about a crude bash script to &lt;a href="https://dev.to/paulmicheli/easy-ec2-tagging-47od"&gt;tag your EC2 resources&lt;/a&gt;, I have since tweaked the script to use the instance ID to find the &lt;code&gt;volumes&lt;/code&gt; and &lt;code&gt;snapshots&lt;/code&gt; associated with each instance ID.&lt;/p&gt;

&lt;p&gt;It will also dynamically pull in account to use from your AWS config file.&lt;/p&gt;

&lt;p&gt;Have Fun&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;## Functions&lt;/span&gt;

tag_rescources &lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
aws &lt;span class="nt"&gt;--profile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$profile&lt;/span&gt; &lt;span class="nt"&gt;--region&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$region&lt;/span&gt; ec2 create-tags &lt;span class="nt"&gt;--resources&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--tags&lt;/span&gt; &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"COST CENTRE"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$cost&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
      &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"APP"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$app&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
      &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ENVIRONMENT"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$environment&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
      &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"OWNER"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$owner&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; 
&lt;span class="o"&gt;}&lt;/span&gt;

get_volumes &lt;span class="o"&gt;(){&lt;/span&gt;
aws &lt;span class="nt"&gt;--profile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$profile&lt;/span&gt; &lt;span class="nt"&gt;--region&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$region&lt;/span&gt; ec2 describe-volumes &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--filters&lt;/span&gt; &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;attachment.instance-id,Values&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s2"&gt;"Volumes[].VolumeId"&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;text
&lt;span class="o"&gt;}&lt;/span&gt;

get_snapshots&lt;span class="o"&gt;(){&lt;/span&gt;
aws &lt;span class="nt"&gt;--profile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$profile&lt;/span&gt; &lt;span class="nt"&gt;--region&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$region&lt;/span&gt; ec2 describe-snapshots &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--filters&lt;/span&gt; &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;volume-id,Values&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s2"&gt;"Snapshots[].SnapshotId"&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;text
&lt;span class="o"&gt;}&lt;/span&gt;


&lt;span class="c"&gt;## Script&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Use this script to tag EC2 instance in the desired account"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Multiple can be enter at once seperated by a singe space."&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Below resources are supported using the ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Instance ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Security Group ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Elastic IPs Allocation ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"----------------------------------------------------------- "&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please choose AWS Account Profile"&lt;/span&gt;
&lt;span class="k"&gt;select &lt;/span&gt;profile &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s1"&gt;'^\['&lt;/span&gt; ~/.aws/config|sed &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'s/\[|\]//g'&lt;/span&gt;|awk &lt;span class="s1"&gt;'{print $2}'&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;
&lt;span class="k"&gt;do
   &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please choose AWS Region"&lt;/span&gt;
   &lt;span class="k"&gt;select &lt;/span&gt;region &lt;span class="k"&gt;in &lt;/span&gt;eu-west-1 eu-central-1 us-east-1
   &lt;span class="k"&gt;do

   &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please list EC2 Instance ID"&lt;/span&gt;
   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Multiple can be entered at once, seperated by a singe space."&lt;/span&gt;
   &lt;span class="nb"&gt;read &lt;/span&gt;instance
   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter COST CENTRE"&lt;/span&gt;
   &lt;span class="nb"&gt;read &lt;/span&gt;cost
   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter APP"&lt;/span&gt;
   &lt;span class="nb"&gt;read &lt;/span&gt;app
   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter ENVIRONMENT"&lt;/span&gt;
   &lt;span class="nb"&gt;read &lt;/span&gt;environment
   &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter OWNER"&lt;/span&gt;
   &lt;span class="nb"&gt;read &lt;/span&gt;owner

   &lt;span class="c"&gt;## Tagging EC2 Instances&lt;/span&gt;
   &lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$instance&lt;/span&gt;
   &lt;span class="k"&gt;do
      &lt;/span&gt;tag_rescources &lt;span class="nv"&gt;$i&lt;/span&gt;
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Tagging EC2 Instances &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
   &lt;span class="k"&gt;done&lt;/span&gt;

   &lt;span class="c"&gt;## Tagging Volunmes&lt;/span&gt;
   &lt;span class="c"&gt;#! a nested loop is used as the get volume function can only filter one volume at a time&lt;/span&gt;
   &lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$instance&lt;/span&gt;
   &lt;span class="k"&gt;do
         for &lt;/span&gt;j &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;get_volumes &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;
         &lt;span class="k"&gt;do
            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Tagging Volume &lt;/span&gt;&lt;span class="nv"&gt;$j&lt;/span&gt;&lt;span class="s2"&gt; beloning to Instance &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
            tag_rescources &lt;span class="nv"&gt;$j&lt;/span&gt;
         &lt;span class="k"&gt;done
   done&lt;/span&gt;

   &lt;span class="c"&gt;## Tagging Snapshots&lt;/span&gt;
   &lt;span class="c"&gt;#! a nested loop is used as the get snapshot function can only filter one volume at a time&lt;/span&gt;
   &lt;span class="nv"&gt;volumes&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;get_volumes &lt;span class="nv"&gt;$instance&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;
   &lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$volumes&lt;/span&gt;
   &lt;span class="k"&gt;do
         for &lt;/span&gt;j &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;get_snapshots &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;
         &lt;span class="k"&gt;do
            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Tagging SnapShot &lt;/span&gt;&lt;span class="nv"&gt;$j&lt;/span&gt;&lt;span class="s2"&gt; belonging to Volume &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
            tag_rescources &lt;span class="nv"&gt;$j&lt;/span&gt;
         &lt;span class="k"&gt;done
   done

   &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"If no error's above tagging complete"&lt;/span&gt;
   &lt;span class="nb"&gt;break
   &lt;/span&gt;&lt;span class="k"&gt;done
   &lt;/span&gt;&lt;span class="nb"&gt;break
&lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>aws</category>
      <category>bash</category>
      <category>linux</category>
      <category>devops</category>
    </item>
    <item>
      <title>Using your Yubikey to store your SSH Key (RSA 4096)</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Fri, 11 Sep 2020 10:29:55 +0000</pubDate>
      <link>https://dev.to/paulmicheli/using-your-yubikey-to-store-your-ssh-key-rsa-4096-3pfl</link>
      <guid>https://dev.to/paulmicheli/using-your-yubikey-to-store-your-ssh-key-rsa-4096-3pfl</guid>
      <description>&lt;p&gt;Using your Yubikey to store your SSH Key (RSA 4096)&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;For this procedure to work you must have &lt;a href="https://www.gnupg.org/"&gt;GnuPG&lt;/a&gt; version 2.0.22 or later installed on your computer. The version of the YubiKey’s OpenPGP module must be 1.0.5 or later. To check this version you may run, after inserting your YubiKey:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gpg-connect-agent --hex "scd apdu 00 f1 00 00" /bye
D[0000]  01 00 05 90 00                               
OK
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Where "01 00 05" means version 1.0.5.&lt;/p&gt;

&lt;p&gt;If you have an existing key you want to import, that key must be a RSA 2048 bit key.&lt;/p&gt;

&lt;p&gt;You’ll also need the YubiKey’s Admin PIN. (Default 12345678)&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate a key
&lt;/h2&gt;

&lt;p&gt;Skip this step if you already have a key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gpg --gen-key

gpg (GnuPG) 2.0.22; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection?
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As there are key size and type limits depending on the type of your YubiKey, see the comparison page, we will select option 1, and go with the default of &lt;strong&gt;4096&lt;/strong&gt; bits for the next question.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? 4096

Requested keysize is 4096 bits
Please specify how long the key should be valid.
         0 = key does not expire
      &amp;lt;n&amp;gt;  = key expires in n days
      &amp;lt;n&amp;gt;w = key expires in n weeks
      &amp;lt;n&amp;gt;m = key expires in n months
      &amp;lt;n&amp;gt;y = key expires in n years
Key is valid for? (0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Select an expiry date if you want to. And answer that the data is correct.&lt;/p&gt;

&lt;p&gt;Should be the real name associated with this key.&lt;/p&gt;

&lt;p&gt;Should be the email adress associated with this key.&lt;/p&gt;

&lt;p&gt;May be a comment attached to the key if you want, or leave this empty.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Real name:
Email address:
Comment:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you’re happy with this USER-ID answer O for okay.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You selected this USER-ID:
    "Paul Micheli &amp;lt;paul@*********.com&amp;gt;m&amp;gt;"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Take note of the id of the key, in this case &lt;code&gt;1******5&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 13AFCE85 marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   4  signed:   8  trust: 0-, 0q, 0n, 0m, 0f, 4u
gpg: depth: 1  valid:   8  signed:   2  trust: 3-, 0q, 0n, 5m, 0f, 0u
gpg: next trustdb check due at 2014-03-23
pub   4***R/1******5 2020-08-11 [expires: 2024-08-11]
      Key fingerprint = 7*************************************5
uid                Paul Michei &amp;lt;paul@*********.com&amp;gt;m&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Importing the key
&lt;/h2&gt;

&lt;p&gt;Now it’s time to import the key into the YubiKey as your Auth SSH Key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gpg --edit-key 1******5

gpg (GnuPG) 2.0.22; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

pub  4***R/1******5  created: 2020-08-11 [expires: 2024-08-11]  usage: SC
                     trust: ultimate      validity: ultimate
[ultimate] (1). Paul Micheli &amp;lt;paul@*********.com&amp;gt;m&amp;gt;

gpg&amp;gt; toggle

sec  4***R/1******5  created: 2020-08-11 [expires: 2024-08-11]
(1)  Foo Bar &amp;lt;foo@example.com&amp;gt;

gpg&amp;gt; keytocard
Really move the primary key? (y/N) y
Signature key ....: [none]
Encryption key....: [none]
Authentication key: [none]

Please select where to store the key:
   (1) Signature key
   (3) Authentication key
Your selection? 3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here we’ve just moved the primary key to the PGP Auth slot of the YubiKey.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gpg&amp;gt; key 3

sec  4096R/13AFCE85  2020-08-11 [expires: 2024-08-11]
                     card-no: 0000 00000001
(1)  Paul Micheli &amp;lt;paul@*********.com&amp;gt;m.com&amp;gt;

gpg&amp;gt; keytocard
Signature key ....: [none]
Encryption key....: [none]
Authentication key: 743A 2D58 688A 9E9E B4FC  493F 70D1 D7A8 13AF CE85 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And as a last step we’ve now moved the Authentication key to the YubiKey.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gpg&amp;gt; quit
Save changes? (y/N) y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;After this the keyring is saved. And that point it no longer contains the real secret key, only a pointer indicating that it’s stored on a smart card.&lt;/p&gt;

&lt;p&gt;You can delete this key from your local gpg DB so it is only stored on your YubiKey.&lt;/p&gt;

&lt;h2&gt;
  
  
  Viewing the public key
&lt;/h2&gt;

&lt;p&gt;To reveal the public key needed to add to your servers &lt;code&gt;authorized_keys&lt;/code&gt; file so you can use the SSH key on your YubiKey to SSH to remote servers.&lt;/p&gt;

&lt;p&gt;Run the below command to reveal the public key part of your SSH key pair;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;paulmicheli@minime:~$  ssh-add -L
ssh-rsa A********************Fey
**[NOPE NOT HAVING THE MIDDLE]**
****===ZDdO cardno:0***********8

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can copy this to your &lt;code&gt;authorized_keys&lt;/code&gt; file to your server and then test using &lt;code&gt;ssh&lt;/code&gt;, if you use puppet to manage your SSH key deployment you can copy it there also.&lt;/p&gt;

</description>
      <category>security</category>
      <category>linux</category>
      <category>devops</category>
      <category>bash</category>
    </item>
    <item>
      <title>Using your Yubikey for Signed Git Commits</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Thu, 10 Sep 2020 06:30:39 +0000</pubDate>
      <link>https://dev.to/paulmicheli/using-your-yubikey-for-signed-git-commits-4l73</link>
      <guid>https://dev.to/paulmicheli/using-your-yubikey-for-signed-git-commits-4l73</guid>
      <description>&lt;p&gt;By signing our Git commits, we can allow folks to verify that they were really written by the author tagged on the commit. If you’ve got a Yubikey set up as per our &lt;a href="https://dev.to/paulmicheli/using-your-yubikey-to-get-started-with-gpg-3h4k"&gt;Using your Yubikey to get started with GPG Post&lt;/a&gt;, it’s easy to configure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;With your Yubikey inserted and unlocked, find the ID of your GPG key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gpg --list-secret-keys --keyid-format LONG
/home/paulmicheli/.gnupg/pubring.kbx
------------------------------------
sec   r******/3**************E 2020-07-30 [SC] [expires: 2022-07-30]
      6***************************E
uid                 [ultimate] Paul Micheli &amp;lt;paul@*********.com&amp;gt;
ssb   r******/A***************0 2020-07-30 [E] [expires: 2022-07-30]

sec&amp;gt;  r******/D**************4 2020-07-30 [SC]
      3**************************************4
      Card serial no. = 0006 10300768
uid                 [ultimate] Paul Micheli &amp;lt;paul@*********.com&amp;gt;
ssb   r******/0**************8 2020-07-30 [E]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then, get your public key so that you can tell GitHub about it. The argument here is the long ID from the above command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gpg --armor --export  A**********0
-----BEGIN PGP PUBLIC KEY BLOCK-----
m[NOPE NOT HAVING THE MIDDLE]
=ZDdO
-----END PGP PUBLIC KEY BLOCK-----
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Copy the above public key, including the begin and end blocks, &lt;a href="https://docs.github.com/en/github/authenticating-to-github/adding-a-new-gpg-key-to-your-github-account"&gt;and then add it as a new key on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We then need to &lt;strong&gt;tell Git to use GPG to sign commits&lt;/strong&gt;, and specifically this key. Use the short ID from the output of the --list-secret-keys command we ran earlier. In my example, it follows rsa3072/A97FDF705EF51C50:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git config --global commit.gpgsign true

$ git config --global user.signingkey A**********0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Nearly there! Let’s now &lt;strong&gt;restart the GPG agent:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gpg-connect-agent reloadagent /bye
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;Make a commit in any repository, and hopefully you shouldn’t see an error message.&lt;/p&gt;

&lt;p&gt;Run git log --show-signature to check that the commit was signed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git log --show-signature

commit 925fb1cae8c33c0f7f4fd6b270fc9f4cf6a8ef80 (HEAD -&amp;gt; master, origin/master, origin/HEAD)
gpg: Signature made Thu 30 Jul 2020 13:59:27 BST
gpg:                using RSA key 6**********************E
gpg: Good signature from "Paul Micheli &amp;lt;paul@*********.com&amp;gt;" [ultimate]
Author: Paul Micheli &amp;lt;paul@*********.com&amp;gt;
Date:   Thu Jul 30 13:59:27 2020 +0100

    signed commit test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Push
&lt;/h2&gt;

&lt;p&gt;Assuming that everything has worked thus far, you can now git push and bask in the resplendent glory of a lovely “Verified” badge on GitHub:&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Bother?
&lt;/h2&gt;

&lt;p&gt;You might ask what the benefit of all this is. After all, you’re already authing to GitHub with your SSH key, right?&lt;/p&gt;

&lt;p&gt;Your SSH key proves that you can talk to GitHub, and that you’re allowed access to the repository in question. It doesn’t prove that the commits you are pushing were really written by the flagged authors though.&lt;/p&gt;

&lt;p&gt;It’s trivial to make a commit with a false identity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "implement sensible error handling" --author="Robby Bobby &amp;lt;robbybobby@google.com&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can then push this, authenticating with your SSH key (or HTTP basic credentials), which is of course totally valid.&lt;/p&gt;

&lt;p&gt;You’ve then managed to masquerade as a colleague, presumably pushing awesome code to help them get a raise. Or, perhaps, you’ve done something nefarious. But you’d never do a thing like that, would you?&lt;/p&gt;

</description>
      <category>security</category>
      <category>linux</category>
      <category>github</category>
      <category>devops</category>
    </item>
    <item>
      <title>Easy EC2 Tagging</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Wed, 09 Sep 2020 15:45:30 +0000</pubDate>
      <link>https://dev.to/paulmicheli/easy-ec2-tagging-47od</link>
      <guid>https://dev.to/paulmicheli/easy-ec2-tagging-47od</guid>
      <description>&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;

&lt;p&gt;I recently had the problem of inheriting an AWS account with over 1000+ EC2 resources that had an incorrect tagging strategy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resolve
&lt;/h2&gt;

&lt;p&gt;After the manual effort of manually sorting through all the resources, and breaking them up into the correct groups. Instead of hours going through the console and tagging each resources with 4 tags I created the below script that will prompt for the required information and then tag them correctly.&lt;/p&gt;

&lt;p&gt;I took roughly 15 minuets to run this script a few times and tag all of my resources. &lt;/p&gt;

&lt;p&gt;I have a multi profile aws cli configuration, this will ask what profile to use and tag the resources there, if they don't exists it will error.&lt;/p&gt;

&lt;p&gt;Update the profile line to match the profiles in your configuration file &lt;code&gt;~/.aws/config&lt;/code&gt; if you don't remove the below lines;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### If you don't use AWS Profiles in the CLI this can be removed
echo "Please choose AWS Account Profile"
select profile in profile1 profile2 profile3 profile4 
do
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;break
done
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can change the tag keys and expand on them if you need to add more.&lt;/p&gt;

&lt;p&gt;You can input as many resource ID's on the single line as you like, use a space to separate them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Use this script to tag EC2 Resources in the desired account"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Multiple can be enter at once separated by a singe space."&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Below resources are supported using the ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Instance ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Snapshot ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Volumes ID"&lt;/span&gt; 
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Security Group ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"            Elastic IPs Allocation ID"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"----------------------------------------------------------- "&lt;/span&gt;

&lt;span class="c"&gt;### If you don't use AWS Profiles in the CLI this can be removed&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please choose AWS Account Profile"&lt;/span&gt;
&lt;span class="k"&gt;select &lt;/span&gt;profile &lt;span class="k"&gt;in &lt;/span&gt;profile1 profile2 profile3 profile4 
&lt;span class="k"&gt;do

&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please list EC2 resources (Multiple can be entered at once)"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;resources
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter Cost Centre"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;cost
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter application"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;app
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter environment"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;environment
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please Enter owner"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;owner

aws &lt;span class="nt"&gt;--profile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$profile&lt;/span&gt; ec2 create-tags &lt;span class="nt"&gt;--resources&lt;/span&gt; &lt;span class="nv"&gt;$resources&lt;/span&gt;  &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--tags&lt;/span&gt; &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Cost Centre"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$cost&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
      &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"application"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$app&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
      &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"environment"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$environment&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
      &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"owner"&lt;/span&gt;,Value&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$owner&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; 

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"If no error's above tagging complete"&lt;/span&gt;
&lt;span class="nb"&gt;break
&lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;On to &lt;code&gt;s3&lt;/code&gt; tagging now.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>bash</category>
      <category>linux</category>
      <category>beginners</category>
    </item>
    <item>
      <title>History Is Your Friend</title>
      <dc:creator>Paul Micheli</dc:creator>
      <pubDate>Mon, 07 Sep 2020 18:26:21 +0000</pubDate>
      <link>https://dev.to/paulmicheli/history-is-your-friend-152l</link>
      <guid>https://dev.to/paulmicheli/history-is-your-friend-152l</guid>
      <description>&lt;h1&gt;
  
  
  Linux History Command
&lt;/h1&gt;

&lt;p&gt;If you leverage and utilise the command line history, you can save a lot of time on a daily bases. You can also use it to gain a better under standing of how a newly discovered server is administrated by viewing the history of commands run.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;p&gt;Just run the command;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;paulmicheli@minime:~$ history
   23  sudo apt install python3.8
   24  sudo apt update
   25  sudo apt install software-properties-common
   26  sudo add-apt-repository ppa:deadsnakes/ppa
   27  sudo apt update
   28  sudo apt upgrade
   29  sudo apt install python3.8
   30  sudo apt install python
   31  sudo apt-get install python3.6
   32  sudo reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  A date &amp;amp; time stamp is always helpful
&lt;/h2&gt;

&lt;p&gt;Having a time stamp of when the command was run can help im many different ways. &lt;/p&gt;

&lt;p&gt;For this to happen you will need to add the below to your .bashrc file and reload using the source command;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## History timestamp
export HISTTIMEFORMAT="%h %d %H:%M:%S "
export HISTSIZE=50000
export HISTFILESIZE=50000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;paulmicheli@minime:~$ source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now when you run the history command you'll see the date and time;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;paulmicheli@minime:~$ history
   23  Sep 07 13:52:23 sudo apt install python3.8
   24  Sep 07 13:52:23 sudo apt update
   25  Sep 07 13:52:23 sudo apt install software-properties-common
   26  Sep 07 13:52:23 sudo add-apt-repository ppa:deadsnakes/ppa
   27  Sep 07 13:52:23 sudo apt update
   28  Sep 07 13:52:23 sudo apt upgrade
   29  Sep 07 13:52:23 sudo apt install python3.8
   30  Sep 07 13:52:23 sudo apt install python
   31  Sep 07 13:52:23 sudo apt-get install python3.6

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;the two additional arguments I have added increase the history size&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to use it
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;!n&lt;/td&gt;
&lt;td&gt;!27&lt;/td&gt;
&lt;td&gt;Execute nth command in history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!!&lt;/td&gt;
&lt;td&gt;!!&lt;/td&gt;
&lt;td&gt;Execute the previous command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;blah&lt;/td&gt;
&lt;td&gt;!ls&lt;/td&gt;
&lt;td&gt;run the most recent command that starts with ‘blah’&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!blah:p&lt;/td&gt;
&lt;td&gt;!ls:p&lt;/td&gt;
&lt;td&gt;print out the command that !blah would run&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!*&lt;/td&gt;
&lt;td&gt;!*&lt;/td&gt;
&lt;td&gt;the previous command except for the last word&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!$&lt;/td&gt;
&lt;td&gt;!$&lt;/td&gt;
&lt;td&gt;Last argument of last command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!^&lt;/td&gt;
&lt;td&gt;!^&lt;/td&gt;
&lt;td&gt;First argument of last command&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Reverse searching
&lt;/h2&gt;

&lt;p&gt;Press the &lt;code&gt;ctrl&lt;/code&gt; key and the &lt;code&gt;r&lt;/code&gt; key simultaneously. The below prompt will appear;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(reverse-i-search)`': 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Start typing the bit of the command you remember and you will see the most recent match from your command history;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(reverse-i-search)`ocke': docker ps
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;press &lt;code&gt;ctrl+r&lt;/code&gt; again to cycle through all your &lt;code&gt;history&lt;/code&gt; that match this search term.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(reverse-i-search)`ocke': docker stop 35e0e91e92de
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Removing history
&lt;/h2&gt;

&lt;p&gt;There may come a time that you want to remove some or all the commands in your history file. If you want to delete a particular command,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;enter history -d &amp;lt;line number&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To clear the entire contents of the history file, execute&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;history -c.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The history file is stored in a file that you can modify, as well. &lt;br&gt;
Bash shell users find it in their home directory as &lt;code&gt;.bash_history.&lt;/code&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
