<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Matheusmaais on Medium]]></title>
        <description><![CDATA[Stories by Matheusmaais on Medium]]></description>
        <link>https://medium.com/@matheusmaais?source=rss-9eb54e423287------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*RNbrK7UCrarCLHJk</url>
            <title>Stories by Matheusmaais on Medium</title>
            <link>https://medium.com/@matheusmaais?source=rss-9eb54e423287------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:00:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@matheusmaais/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploying a Hashicorp Vault Server on a AWS EC2 Instance with Terraform and Ansible.]]></title>
            <link>https://matheusmaais.medium.com/deploying-a-hashicorp-vault-server-on-a-aws-ec2-instance-with-terraform-and-ansible-8083b95c7917?source=rss-9eb54e423287------2</link>
            <guid isPermaLink="false">https://medium.com/p/8083b95c7917</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <dc:creator><![CDATA[Matheusmaais]]></dc:creator>
            <pubDate>Wed, 11 Nov 2020 00:41:06 GMT</pubDate>
            <atom:updated>2020-11-11T00:44:50.377Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*PtW3te0dOj1tRjYbWfwFTg.png" /></figure><p>Hey folks!!</p><p>In this article let`s take a quick look in to Hashicorp Vault, your propose and how to deploy using DevOps tools ( Ansible and Terraform) on AWS Ec2.</p><p><strong>What is Hashicorp Vault?</strong></p><blockquote>Hashicorp Vault it`s a solution to secrets management.</blockquote><p>A secret is anything that you want to tightly control access, such as API keys, passwords, or certificates. Vault provides a unified interface to any secret, while providing tight access control and recording a detailed audit log.</p><p><strong>Why we need manage secrets?</strong></p><p>The main use case is to centralize secrets management. Teams want to avoid having secrets sprawled across the infrastructure, so they use Vault to keep their management in one location. Additionally, they want to be able to have an audit log, and enforce access control list (ACL) policies on a least-privilege basis.</p><p>We can rotate credentials or generate temporary credentials, such as database credentials or IAM. Once a specific task is complete, these credentials are revoked.</p><p><strong>How does the Vault protect data?</strong></p><p>Vault creates an encryption key that is used to encrypt any data stored in the vault on your Storage-backend. Vault has a master key that is used to encrypt and decrypt the encryption keys. Masterkey is stored in the vault node memory, it`s not stored in persistent storage</p><p><strong>Storage-backend?</strong></p><p>Vault itself does not store anything. It’s a middleware, needs a storage backend. Hashicorp Vault support many storage-backends, most commons:</p><ul><li>Consul</li><li>PostgreSQL</li><li>MySQL</li><li>Aws S3</li><li>FileSystem</li><li>Etcd</li><li>DynamoDB</li></ul><p><a href="https://www.vaultproject.io/docs/configuration/storage">https://www.vaultproject.io/docs/configuration/storage</a> for more details.</p><p>For complexity reasons, in this articles we will use FileSystem as Storage-backend</p><h3>Getting your hands dirty!!</h3><p>Before we start, have some requirements to deploy your project:</p><ul><li>All actions were performed on MacOS, but they certainly work in a Linux environment</li><li><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">Aws account with a programatic user and AWS Access Key ID, AWS Secret Key ID </a><a href="https://docs.aws.amazon.com/pt_br/cli/latest/userguide/install-cliv2.html">AWS CLI installed on your local machine</a> <a href="https://docs.aws.amazon.com/pt_br/AWSEC2/latest/UserGuide/ec2-key-pairs.html">Aws Key Pair</a></li><li><a href="https://www.terraform.io/downloads.html">Terraform</a></li><li><a href="https://www.digitalocean.com/community/tutorials/como-instalar-e-configurar-o-ansible-no-ubuntu-18-04-pt">Ansible</a></li><li>Git</li></ul><p>Fortunately I already did the heavy lifting and made the content available on the Github repository:</p><p><a href="https://github.com/matheusmaais/HashicorpVault">https://github.com/matheusmaais/HashicorpVault</a></p><p>So..</p><pre>$git clone <a href="https://github.com/matheusmaais/HashicorpVault">https://github.com/matheusmaais/HashicorpVault</a></pre><p>Put your aws key in to directory HashicorpVault.</p><p>key_name = “ PUT ONLY YOUR KEY NAME, WITHOUT .pem”</p><p>Change /PATH_TO_YOUR_KEY.pem, to ./your_key_name.pem</p><p>Only this adjust it`s necessary to the project works:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GKqQmEDvos8ESS7_" /></figure><p>Run:</p><pre>$sh deploy.sh</pre><p>We will now explain how the process works:</p><ul><li>Terraform will use the ec2.tf file to provision a t2.micro instance, use the output encoded in the output.tf file to create a text file inside the ./ansible directory that will contain our instance’s IP.</li><li>The sg.tf file will create the Security Group with the necessary ports to access the vault externally</li></ul><p>After the server is online Ansible will take action:</p><ul><li>Upgrade the server</li><li>Add Hashicorp Repository</li><li>Download and Install the Vault Binary</li><li>Moving Binary to Path</li><li>Copy vault.hcl config file (in this file, we set the filesystem as storage-backend)</li><li>Adding environment variables permanently</li><li>Reboot Machine</li><li>Performing the initialization and Vault Unseal</li><li>Copy the encryption keys and Root Token from the server to your local machine in the ./ansible directory</li></ul><p>All actions are performed by ./ansible/vault.yml file</p><p>All Calls to Terraform and Ansible are executed in the deploy.sh script..</p><p>To destroy the entire infrastructure, simple run the command</p><pre>$sh destroy.sh</pre><p><strong>How to access Vault Server and put some secrets??</strong></p><p>We will use our own local machine to access the Vault server, for this:</p><p>* Download Vault</p><p>If you’re on mac, run the brew install vault command, if you’re on linux follow the Link tutorial below:</p><p><a href="https://learn.hashicorp.com/tutorials/vault/getting-started-install">https://learn.hashicorp.com/tutorials/vault/getting-started-install</a></p><p>Once installed, lets set a environment variable, changing 123.123.123.123 by your instance IP address, ex:</p><p>export VAULT_ADDR=”http://123.123.123.123:8200&quot;</p><p>Copy the root token, placed in ./ansible/ec2IP/key.txt</p><p>Run $vault login and paste your root token.</p><p>run</p><blockquote>$vault status</blockquote><pre>$vault status<br></pre><pre>Key             Value<br>---             -----<br>Seal Type       shamir<br>Initialized     true<br>Sealed          false<br>Total Shares    5<br>Threshold       3<br>Version         1.5.5<br>Cluster Name    vault-cluster-6f57a99a<br></pre><pre>Cluster ID      9ca54096-5789-a906-9762-d3580b212487<br>HA Enabled      false</pre><p>Let`s enable KV engine ( key/value ) in your path demo:</p><pre>$vault secrets enable -path=vaultdemo/ kv </pre><pre>$vault secrets list ( will show the paths avaliables )</pre><pre>$vault kv put vaultdemo/foo username=foo password=bar</pre><pre>$vault kv get vaultdemo/foo </pre><pre>====== Data ======<br>Key         Value<br>---         -----<br>password    bar<br>username    foo</pre><p>To access Vault UI, put in your browser <a href="http://ec2_ip:8200/">http://ec2_IP:8200</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ib21uddG7BKpTVHvQI-E1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXOeK7eradGL4nqhMNhHiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zH-Jqvsx7byuQUHRmHtj1w.png" /></figure><p>OK, Vault deployed and works fine!!</p><p>That was a brief introduction to the Hashicorp Vault, I hope you enjoyed it! See you !!</p><p>— — — — — — — — — -</p><p>References</p><p><a href="https://learn.hashicorp.com/vault">https://learn.hashicorp.com/vault</a></p><p><a href="https://medium.com/faun/vault-securely-manage-sensitive-data-3a528e3c18f8">https://medium.com/faun/vault-securely-manage-sensitive-data-3a528e3c18f8</a></p><p><a href="https://blog.sensu.io/what-is-hashicorp-vault-and-how-does-it-work#:~:text=Vault%20provides%20%E2%80%9Cencryption%20as%20a,in%20your%20cloud%20and%20datacenters">https://blog.sensu.io/what-is-hashicorp-vault-and-how-does-it-work#:~:text=Vault%20provides%20%E2%80%9Cencryption%20as%20a,in%20your%20cloud%20and%20datacenters</a></p><p><a href="https://medium.com/weareservian/get-started-with-hashicorp-vault-cc132dce627d">https://medium.com/weareservian/get-started-with-hashicorp-vault-cc132dce627d</a></p><p><a href="https://medium.com/faun/all-you-need-to-know-about-hashicorp-vault-to-get-started-574aab203efcOnly">https://medium.com/faun/all-you-need-to-know-about-hashicorp-vault-to-get-started-574aab203efc</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8083b95c7917" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrando Terraform, Ansible, Docker, Jenkins e Aws — Parte 2]]></title>
            <link>https://matheusmaais.medium.com/integrando-terraform-ansible-docker-jenkins-e-aws-parte-2-7b088e5d72d4?source=rss-9eb54e423287------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b088e5d72d4</guid>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[agile-methodology]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <dc:creator><![CDATA[Matheusmaais]]></dc:creator>
            <pubDate>Thu, 23 Jul 2020 13:39:20 GMT</pubDate>
            <atom:updated>2020-07-23T14:01:49.603Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*ZHW5fYn6BDFIAaPn" /></figure><h3>Integrando Terraform, Ansible, Docker, Jenkins e Aws — Parte 2</h3><p>Olá! Que bom que você não se entediou e continuou por aqui…</p><p>Caso tenha perdido o início da saga.. segue o link:<br><a href="https://medium.com/@matheusmaais/integrando-terraform-ansible-docker-jenkins-e-aws-3ead8e88bf80">https://medium.com/@matheusmaais/integrando-terraform-ansible-docker-jenkins-e-aws-3ead8e88bf80</a></p><p>A partir de agora vou começar a explicação do processo de construção do meu humilde projeto, lembrando que o projeto é apenas com fins de estudo básico, certamente há N maneiras de executar as mesmas ações, então fui pela mais simples possível, visto que a idéia é um entendimento inicial das funcionalidades das ferramentas.</p><p>OBS: todos os procedimentos fiz usando como Sistema Operacional o Ubuntu20.04 ( Funciona também em versões acima da 16.04 e caso você não tenha Linux na sua máquina, podes criar uma maquina virtual na Aws e fazer todos os procedimentos, funciona também)</p><h3>Configurando a AWS</h3><p>Não vou entrar em detalhes da criação e configuração da AWS, pois existem muitos ( realmente muitos) tutoriais de como fazer isso, mas vou deixar os links dos passos necessários:</p><ul><li><a href="https://docs.aws.amazon.com/pt_br/polly/latest/dg/setting-up.html">Criando uma conta na aws</a></li><li><a href="https://www.youtube.com/watch?v=7RUnbjErxoM">Criar um Security Group</a> ( para testes, podemos deixar todas as portas liberadas, de qualquer ip.. porém isso abre brechas de segurança)</li><li><a href="https://www.youtube.com/watch?v=kElCxH8M_8k">Criando uma chave SSH na aws</a></li><li><a href="https://docs.aws.amazon.com/pt_br/IAM/latest/UserGuide/id_users_create.html#id_users_create_console">Criando um usuário programático</a> (anote os valores de usuario e secret)</li><li><a href="https://docs.aws.amazon.com/pt_br/cli/latest/userguide/install-cliv2.html">Instalando a CLI</a></li></ul><p>Se todos os passos acima deram certinho ( parecem muitos né? mas não demora nem 10min), abra o terminal do seu sistema e digite:</p><pre>aws configure</pre><p>Será requisitado a sua Aws Acess key Id e Aws Acess Key Secret ( que nada mais é que os valores de usuário e senha gerados no passo da criação do usuário programático), em default region você pode digitar us-east-1, que refere-se a região da Virgínia, e como output pode deixar em branco.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/0*vcjEMOvD-k7OxePx" /></figure><p>Para testarmos , tente o seguinte comando:</p><pre>aws --version</pre><p>A saída deve ser algo parecido com isso:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*A4ZDq71tMLk-cz9n" /></figure><p>Ótimo! Ja temos o nosso provedor cloud configurado! Agora vamos brincar no Terraform pra ele criar a instância EC2.</p><h3>Terraform</h3><p>Como primeiro passo, devemos instalar a ferramenta em nossa máquina local:</p><p><a href="https://www.terraform.io/downloads.html">I</a>nstalando o Terraform: <a href="https://www.terraform.io/downloads.html">https://www.terraform.io/downloads.html</a></p><p>Podemos verificar se a instalação ocorreu bem, executando:</p><pre>terraform --version</pre><p>A saída esperada é essa:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*rhx0iOIrHVWNVZof" /></figure><p>Com o Terraform instalado podemos partir para o próximo passo:</p><h3>Ansible</h3><p>Digite os seguintes comandos no terminal:</p><pre>sudo apt-add-repository ppa:ansible/ansible<br>sudo apt update<br>sudo apt install ansible</pre><p>Para verificar a instalação digite no terminal:</p><pre>ansible --version</pre><p>Saída esperada é algo semelhante ao texto abaixo:</p><pre>ansible --version <br>ansible 2.9.10<br>  config file = None<br>  configured module search path = [&#39;/Users/southsystem/.ansible/plugins/modules&#39;, &#39;/usr/share/ansible/plugins/modules&#39;]<br>  ansible python module location = /usr/local/Cellar/ansible/2.9.10/libexec/lib/python3.8/site-packages/ansible<br>  executable location = /usr/local/bin/ansible<br>  python version = 3.8.3 (default, May 27 2020, 20:54:22) [Clang 11.0.3 (clang-1103.0.32.59)]</pre><p>Pronto! As ferramentas que precisamos instalar na nossa máquina local ja estão ok!</p><p>No próximo artigo vamos colocar a mão na massa e começar a brincadeira!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*SdAboPX99lJQ7BDC" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b088e5d72d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrando Terraform, Ansible, Docker, Jenkins e Aws]]></title>
            <link>https://matheusmaais.medium.com/integrando-terraform-ansible-docker-jenkins-e-aws-3ead8e88bf80?source=rss-9eb54e423287------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ead8e88bf80</guid>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[begginer]]></category>
            <dc:creator><![CDATA[Matheusmaais]]></dc:creator>
            <pubDate>Wed, 15 Jul 2020 12:45:34 GMT</pubDate>
            <atom:updated>2020-07-15T13:05:28.388Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*ZBJ9p42-KUUYfkcxMkNuaA.png" /></figure><p>Olá! O título assusta, não? Calma calma..</p><p>Estou iniciando a carreira como DevOps e seguindo o conselho de várias pessoas da área de tecnologia, iniciei a validação das video-aulas, artigos e livros que eu estou consumindo, realizando POC’s (Proof of concept) e no meio do processo pensei:</p><blockquote>Por que não compartilhar o caminho das pedras ? Certamente como eu, várias pessoas estão em início de carreira e o mundo DevOps é realmente infinito então temos que começar por algum lugar!</blockquote><p>Por meio deste artigo vou descrever a forma como tentei resolver um problema, digamos que “simples”, buscando automatizar tanto quanto meu conhecimento me deixar, e também usando as ferramentas com as quais eu tive contato até o momento…</p><p>Segue o problema proposto:</p><p>Provisionar um servidor que estivesse com o docker instalado, baixar uma imagem de uma aplicação (qualquer “hello world”da vida), exibir no browser, e instalar um servidor jenkins na mesma máquina.</p><blockquote>Tudo muito bem, tudo muito lindo, parece a princípio muito simples, mas na hora que a gente começa a se aprofundar, vários percalços surgem…</blockquote><p>Tudo deveria ser provisionado via Infrastructure as Code, de preferência na nuvem para ser acessível por qualquer pessoa, a aplicação e o Jenkins deveriam rodar em containers. Então precisaríamos de Terraform ( provisionar a infraestrutura), AWS como cloud provider, Ansible ( executar a configuração do servidor, instalar os aplicativos) git ( baixar a aplicação demo e o jenkins) Docker ( rodar os containers com as aplicações).</p><p>Vejam só o escopo ja aumentou um pouco não é? Mas ainda não acabou…</p><p>Como eu faria para o Ansible saber qual é a máquina que o Terraform criou? Como eu faço para depois de ter o Ip da máquina o Ansible aguardar o tempo necessário para o servidor ficar online? Dentre muitas outras dúvidas que foram surgindo no meio do projeto.</p><p>Minha familiaridade com Ansible até o momento não é tão grande, tornando assim mais dispendiosa a tarefa…</p><p>Eu aprendo muito com o método de repetição, não tenho a capacidade de fazer o código uma vez e nunca mais esquecer, então fui realmente fazendo cada etapa e testando, derrubava todo o ambiente, adicionava mais uma feature e testava de novo.. assim sucessivamente ( Sinceramente umas 80x hahah!)</p><p>Algumas horas depois o fluxo do processo me parecia um pouco mais claro, mas ainda precisava chamar o Terraform, depois o Ansible, e depois entrar via ssh no servidor para saber a senha inicial do Jenkins.. tinha coisa faltando…</p><blockquote>Plim! Cara executa um Shell script que chama tudo isso!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*skl86F4tctnAeWHz" /></figure><p>Depois de vários servidores online, offline, commits no git.. arruma isso, conserta aquilo, ficou pronto!</p><p>Sempre haverão pontos a serem melhorados porém ele ja serve ao propósito da POC.</p><p>Como desfecho da epopéia segue abaixo o link para meu repositório no github!</p><p><a href="https://github.com/matheusmaais/Terraform_ansible_docker">Link do Projeto</a></p><p>Nos post seguintes vou explicar timtim por timtim da coisa toda… pq como diz um amigo meu:</p><blockquote>“Código por si só não ajuda”</blockquote><p>Tá perdido no assunto?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/0*cyJuuceWGpuK41rY" /></figure><p><a href="https://medium.com/@igordcsouza/terraform-uma-pequena-introdu%C3%A7%C3%A3o-eae86f22db55">O que é Terraform?</a></p><p><a href="https://techenter.com.br/o-que-e-ansible/">O que é Ansible?</a></p><p><a href="https://www.devmedia.com.br/automatizando-a-geracao-de-pacotes-com-o-jenkins/33655">O que é Jenkins?</a></p><p><a href="https://www.meupositivo.com.br/panoramapositivo/container-docker/">O que é Docker?</a></p><p><a href="https://aws.amazon.com/pt/what-is-aws/">O que é AWS?</a></p><p>Então dúvidas, sugestões e reclamações são sempre bem vindas..</p><p>Meu primeiro artigo.. espero conseguir produzir mais conteúdo para a área de DevOps.</p><p>Tudo é aprendizado e de pouco em pouco vamos evoluindo!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ead8e88bf80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>