<?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: Carlos A R Cardoso</title>
    <description>The latest articles on DEV Community by Carlos A R Cardoso (@carlosrochacardoso).</description>
    <link>https://dev.to/carlosrochacardoso</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%2F554440%2F6e0e4914-ce33-48e1-94c9-fe9ef7c430a3.jpeg</url>
      <title>DEV Community: Carlos A R Cardoso</title>
      <link>https://dev.to/carlosrochacardoso</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carlosrochacardoso"/>
    <language>en</language>
    <item>
      <title>Creating a local environment to develop on AWS CDK using Docker and VSCode</title>
      <dc:creator>Carlos A R Cardoso</dc:creator>
      <pubDate>Tue, 09 Mar 2021 23:14:12 +0000</pubDate>
      <link>https://dev.to/carlosrochacardoso/creating-a-local-environment-to-develop-on-aws-cdk-using-docker-and-vscode-fh5</link>
      <guid>https://dev.to/carlosrochacardoso/creating-a-local-environment-to-develop-on-aws-cdk-using-docker-and-vscode-fh5</guid>
      <description>&lt;p&gt;Containers are humanity's greatest invention after the transistor, and anyone who disagrees is wrong. They make life easier, which even complicates. When you realize, you're already finding an excuse to use it where you shouldn't.&lt;/p&gt;

&lt;p&gt;Exaggerations aside, I think that is not the case here. I intend to show in this brief tutorial how to use them to create a local environment ready to develop your apps and stacks based on &lt;a href="https://aws.amazon.com/cdk/?nc1=h_ls" rel="noopener noreferrer"&gt;AWS CDK - Cloud Development Kit&lt;/a&gt;. We are not going to create the resources on AWS. That is not the goal. We will prepare the environment to start your development.&lt;/p&gt;

&lt;h3&gt;
  
  
  About AWS CDK
&lt;/h3&gt;

&lt;p&gt;Anchored in the concept of &lt;a href="https://en.wikipedia.org/wiki/Infrastructure_as_code" rel="noopener noreferrer"&gt;infrastructure as code (IaC)&lt;/a&gt;, the AWS CDK allows you to create resources in the AWS cloud, using languages ​​such as Python, Java, JavaScript, C #, or TypeScript. If you already use CloudFormation or Terraform, it's worth checking out and adding to your toolbox.&lt;/p&gt;

&lt;p&gt;Recently collaborating on data lakes implementation projects in the AWS cloud, I have been using the CDK as an IaC tool to automate the creation of resources and environment, whether in roles, jobs glue, or lake formation configurations creation. I can't imagine a life doing it manually on the console.&lt;/p&gt;

&lt;p&gt;Has anyone ever worked or works like this?&lt;/p&gt;

&lt;h3&gt;
  
  
  Why containers?
&lt;/h3&gt;

&lt;p&gt;You could indeed install AWS CDK and its prerequisites directly on your PC's operating system. However, I believe that the method suggested in this tutorial is faster. Also, you could use this method to facilitate the version upgrade or even to create and maintain several simultaneous CDK environments, in different versions, without one version interfering or impacting the other.&lt;/p&gt;

&lt;p&gt;Believe me, almost every day, AWS releases a new version.&lt;/p&gt;

&lt;p&gt;Finally, part of this method could be adapted and used in a CI / CD pipeline.&lt;/p&gt;

&lt;p&gt;It's a big deal ;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Hands on
&lt;/h3&gt;

&lt;p&gt;All the steps described in this tutorial were performed on Ubuntu 20.04, but this is not a prerequisite. Adapting a few steps and installing the software packages in the required version, you can use another S.O. of your preference.&lt;/p&gt;

&lt;p&gt;Without further ado, let's get this environment ready to "Hello World"!&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before performing step 1, you will need &lt;strong&gt;Git, Docker, VSCode, and AWS-CLI&lt;/strong&gt; installed. If you don't have these applications yet, I suggest following the official links below. The idea is simple.&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;Git&lt;/strong&gt;, we will download the source code for our AWS-CDK Docker container image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" rel="noopener noreferrer"&gt;Git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;Docker&lt;/strong&gt;, we will create the image and start the container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;VSCode&lt;/strong&gt;, we will connect to the container to develop our applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;VSCode&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;AWS-CLI&lt;/strong&gt;, you can set up your AWS account and get the environment ready to deploy your application in the cloud. Remember that for that, of course, you will need an AWS account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/pt_br/cli/latest/userguide/install-cliv2-linux.html" rel="noopener noreferrer"&gt;AWS-CLI&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the image of the Docker container with AWS CDK
&lt;/h3&gt;

&lt;p&gt;On the operating system, open the terminal and run the following command to download the source code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo git clone https://github.com/contino/docker-aws-cdk.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to the &lt;code&gt;docker-aws-cdk&lt;/code&gt; folder and open the Dockerfile file for editing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd docker-aws-cdk &amp;amp;&amp;amp; sudo gedit Dockerfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the first lines, find the section containing the variable &lt;code&gt;ENV AWS_CDK_VERSION&lt;/code&gt; and change it to the desired version number. As I write this tutorial, the current version is &lt;code&gt;1.91.0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The file line should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ENV AWS_CDK_VERSION=1.91.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save and clode the file.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can edit and customize this Dockerfile in several other ways, as needed. Take a look at the project repository for more information.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To create the image of the container run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker build -t contino/aws-cdk:1.91.0 .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now it's time to start our service. Run the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker run -itd -v ~/.aws:/root/.aws -v /home/projeto:/home/projeto --name aws_cdk contino/aws-cdk:1.90.0 bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-v ~/.aws:/root/.aws&lt;/code&gt; : maps the AWS credentials from the local machine to the container. For this step, you must configure your credentials after installing the AWS-CLI. Although it is not essential for this tutorial since we will not perform any deployment, I recommend following it to leave your environment ready.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-v /home/projeto:/home/projeto&lt;/code&gt; : maps the local project directory to a project directory internal to the container. Here you can change the name of the local folder as needed. Pay attention to the path names to locate the project on your local machine and in the container.&lt;/p&gt;

&lt;p&gt;To check if the container is running and that the CDK is installed in the desired version, execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker exec aws_cdk cdk --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Connecting VSCode to our AWS-CDK environment
&lt;/h3&gt;

&lt;p&gt;Open VSCode and install the python extensions and remote-containers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ms-vscode-remote.remote-containers
ms-python.python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fop3bitg78qvnccvsx4hy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fop3bitg78qvnccvsx4hy.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the extensions installed, we will connect the VSCode to our container.&lt;/p&gt;

&lt;p&gt;Click the green icon in the bottom left corner of the screen.&lt;/p&gt;

&lt;p&gt;A menu will appear in the center of the screen, next to the title bar.&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;Attach to Running Container&lt;/strong&gt; option and click on the container name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxeb8heomh0gxucu9g5qp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxeb8heomh0gxucu9g5qp.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A new VSCode session connected to the aws_cdk container will open.&lt;/p&gt;

&lt;h3&gt;
  
  
  Starting the project
&lt;/h3&gt;

&lt;p&gt;In the top menu, click on Terminal and New Terminal.&lt;br&gt;
Navigate to the project folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /home/projeto/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start a new Python CDK project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cdk init app --language python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the command below to check the created project structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -la
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8c5fu1112s2uhi83hfn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr8c5fu1112s2uhi83hfn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also browse your container or project folders through the VSCode interface. From the main menu, click &lt;strong&gt;File&lt;/strong&gt; and &lt;strong&gt;Open Folder&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Type the path, example &lt;code&gt;/home&lt;/code&gt; and click &lt;strong&gt;OK&lt;/strong&gt;. The folder hierarchy should be displayed in the left pane.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxxz2h23b6kjyt6ouf0l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxxz2h23b6kjyt6ouf0l.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You now have the structure of an AWS-CDK Python project. If this is your first contact, I recommend following the official &lt;a href="https://docs.aws.amazon.com/cdk/latest/guide/home.html" rel="noopener noreferrer"&gt;Developer Guide&lt;/a&gt; to understand the concepts and build your first stack.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wrapping up
&lt;/h3&gt;

&lt;p&gt;Disconnect the VSCode from the container by clicking on the green icon in the lower left corner and on the &lt;strong&gt;Close Remote Connection&lt;/strong&gt; option.&lt;/p&gt;

&lt;p&gt;At the terminal of the operational system, end the execution of the container with the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker stop aws_cdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See you next time!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>docker</category>
      <category>vscode</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Criando um ambiente local para desenvolver em AWS CDK usando Docker e VSCode</title>
      <dc:creator>Carlos A R Cardoso</dc:creator>
      <pubDate>Tue, 02 Mar 2021 14:36:00 +0000</pubDate>
      <link>https://dev.to/carlosrochacardoso/criando-um-ambiente-local-para-desenvolver-em-aws-cdk-usando-docker-e-vscode-2oca</link>
      <guid>https://dev.to/carlosrochacardoso/criando-um-ambiente-local-para-desenvolver-em-aws-cdk-usando-docker-e-vscode-2oca</guid>
      <description>&lt;p&gt;Containers, como os do Docker, são a maior invenção da humanidade depois do transistor, e quem não concordar está errado. Facilitam tando a vida que até complica. Quando você vê, já tá arrumando desculpa prá usar onde não deve.&lt;/p&gt;

&lt;p&gt;Exageros à parte, acho que não é o nosso caso aqui. Pretendo mostrar nesse breve tutorial como usá-los para criar um ambiente local pronto para desenvolver seus apps e stacks baseadas em &lt;a href="https://aws.amazon.com/pt/cdk/"&gt;AWS CDK — Cloud Development Kit&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Aqui não vamos criar os recursos na AWS, não é esse o objetivo. Iremos preparar o ambiente para que você inicie seu desenvolvimento.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sobre o AWS CDK
&lt;/h3&gt;

&lt;p&gt;Ancorado no conceito de &lt;a href="https://pt.wikipedia.org/wiki/Infraestrutura_como_C%C3%B3digo"&gt;infraestrutura como código (IaC)&lt;/a&gt;, o AWS CDK permite que você crie recursos na nuvem da AWS usando linguagens como Python, Java, JavaScript, C# e TypeScript. Se você já usa o CloudFormation ou Terraform, vale a pena dar uma conferida e incrementar sua caixa de ferramentas.&lt;/p&gt;

&lt;p&gt;Colaborando recentemente em projetos de implementação de datalakes na cloud AWS, tenho usado o CDK como ferramenta de IaC para automatizar a criação dos recursos e ambiente, seja na criação de roles, jobs glue ou configurações do lake formation. Não dá prá imaginar a vida fazendo isso manualmente pela console.&lt;/p&gt;

&lt;p&gt;Será que alguém já trabalhou ou trabalha assim ?&lt;/p&gt;

&lt;h3&gt;
  
  
  Por que usar containers ?
&lt;/h3&gt;

&lt;p&gt;É verdade que você poderia instalar o AWS CDK e seus pré-requisitos diretamente no sistema operacional do seu PC. Porém creio que, além de mais rápido, o método sugerido nesse tutorial pode ser usado para facilitar o upgrade de versão (acredite, quase todo dia a AWS solta uma versão nova), ou mesmo criar e manter vários ambientes simultâneos da CDK, em diferentes versões, sem que uma versão interfira ou impacte na outra. Por fim, parte desse método poderia ser adaptada e aproveitada em um pipeline de CI/CD.&lt;/p&gt;

&lt;p&gt;Só vi vantagens ;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Mão na massa
&lt;/h3&gt;

&lt;p&gt;Só para constar, todos os passos descritos nesse tutorial foram executados no Ubuntu 20.04, porém isso não é um pré-requisito. Você pode utilizar outro S.O. de sua preferência, adaptando alguns passos e instalando os pacotes de software na versão necessária.&lt;br&gt;
Sem mais, vamos deixar esse ambiente pronto para o “Hello World”.&lt;/p&gt;
&lt;h3&gt;
  
  
  Pré-requisitos
&lt;/h3&gt;

&lt;p&gt;Antes do passo 1, você vai precisar do &lt;strong&gt;Git&lt;/strong&gt;, &lt;strong&gt;Docker&lt;/strong&gt;, &lt;strong&gt;VSCode&lt;/strong&gt; e &lt;strong&gt;AWS-CLI&lt;/strong&gt; instalados. Se ainda não tem esses caras, sugiro seguir os links oficiais abaixo. A ideia é muito simples.&lt;/p&gt;

&lt;p&gt;Com o Git, vamos baixar os fontes para imagem do nosso container Docker com AWS-CDK.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"&gt;Git&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Com o Docker, vamos criar a imagem e “levantar” o container.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/engine/install/"&gt;Docker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Com o VSCode, vamos nos conectar ao container para desenvolver nossas aplicações.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://code.visualstudio.com/"&gt;VSCode&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Com o AWS-CLI, você poderá configurar sua conta AWS e deixar o ambiente pronto para executar o deploy da sua aplicação na cloud. Lembrando que para isso, claro, você precisará de uma conta AWS.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/pt_br/cli/latest/userguide/install-cliv2-linux.html"&gt;AWS-CLI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Criando a imagem do container Docker com AWS CDK
&lt;/h3&gt;

&lt;p&gt;No sistema operacional, abra o terminal e execute o comando a seguir para baixar os fontes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo git clone https://github.com/contino/docker-aws-cdk.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Acesse a pasta &lt;code&gt;docker-aws-cdk&lt;/code&gt; e abra o arquivo &lt;code&gt;Dockerfile&lt;/code&gt; para edição.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd docker-aws-cdk &amp;amp;&amp;amp; sudo gedit Dockerfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logo nas primeiras linhas, localize o trecho contendo a variável &lt;code&gt;ENV AWS_CDK_VERSION&lt;/code&gt; e altere para o número da versão desejada. Enquanto escrevo esse tutorial, a versão atual é a &lt;code&gt;1.91.0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Logo, a linha do arquivo deve ficar assim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ENV AWS_CDK_VERSION=1.91.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Salve e feche o arquivo.&lt;/p&gt;

&lt;p&gt;Você pode editar e customizar esse Dockerfile em vários outros aspectos, conforme sua necessidade. Dê uma olhada no &lt;a href="https://github.com/contino/docker-aws-cdk"&gt;repositório do projeto&lt;/a&gt; para mais informações.&lt;/p&gt;

&lt;p&gt;Para criar a imagem do container execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker build -t contino/aws-cdk:1.91.0 .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Agora é hora de iniciar nosso serviço. Execute o comando:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker run -itd -v ~/.aws:/root/.aws -v /home/projeto:/home/projeto --name aws_cdk contino/aws-cdk:1.90.0 bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;onde:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-v ~/.aws:/root/.aws&lt;/code&gt; : mapeia as credenciais AWS da maquina local para o container. Para esse passo, suas credenciais devem ser configuradas após instalação do AWS-CLI. Apesar de não ser essencial para esse tutorial, visto que não iremos executar nenhum deploy, recomendo segui-lo para deixar seu ambiente em ponto de bala.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-v /home/projeto:/home/projeto&lt;/code&gt; : mapeia o diretório local do projeto para um diretório de projeto interno ao container. Aqui você pode alterar o nome do diretório local conforme sua necessidade, tendo atenção aos nomes para localizar o projeto tanto em sua maquina local quanto no container.&lt;/p&gt;

&lt;p&gt;Para conferir se o container está em execução, e que o CDK está instalado na versão desejada, execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker exec aws_cdk cdk --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conectando o VSCode ao nosso ambiente AWS-CDK
&lt;/h3&gt;

&lt;p&gt;Abra o VSCode e instale as extensões python e remote-containers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ms-vscode-remote.remote-containers
ms-python.python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G6ZoJsvp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bd3a09wdmv0zpqcdqwc3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G6ZoJsvp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bd3a09wdmv0zpqcdqwc3.gif" alt="install_vscode_extension"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Com as extensões instaladas, vamos conectar o VSCode ao nosso container.&lt;/p&gt;

&lt;p&gt;Clique no ícone verde do canto inferior esquerdo da tela. Será exibido um menu no centro da tela, próximo à barra de título. &lt;/p&gt;

&lt;p&gt;Selecione a opção &lt;strong&gt;Attach to Running Container&lt;/strong&gt; e clique no nome do container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kz37jVqD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5r3c2673gct2pjwt0g7a.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kz37jVqD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5r3c2673gct2pjwt0g7a.gif" alt="vscode_attach_container_cdk"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Uma nova sessão do VSCode, conectada ao container aws_cdk , será aberta.&lt;/p&gt;

&lt;h3&gt;
  
  
  Iniciando o projeto
&lt;/h3&gt;

&lt;p&gt;No menu superior, clique em &lt;strong&gt;Terminal&lt;/strong&gt; e &lt;strong&gt;New Terminal&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Navegue até a pasta "projeto".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /home/projeto/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inicie um novo projeto CDK em Python.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cdk init app --language python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Execute o comando abaixo para verificar a estrutura de projeto criada.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -la
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2EOe8wBL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eidf6ap3wl6848urswq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2EOe8wBL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eidf6ap3wl6848urswq8.png" alt="terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Você pode ainda navegar nas pastas do seu container e projeto pela interface do VSCode. No menu principal, clique em &lt;strong&gt;File&lt;/strong&gt; e &lt;strong&gt;Open Folder&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Digite o path, exemplo &lt;code&gt;/home&lt;/code&gt; e clique em &lt;strong&gt;OK&lt;/strong&gt;. A hierarquia de pastas deve ser exibida no painel esquerdo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7gIJ7uHa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/es03crhghlfu36abi6go.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7gIJ7uHa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/es03crhghlfu36abi6go.png" alt="pastas"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Você agora tem o esqueleto de um projeto AWS-CDK Python. Caso seja seu primeiro contato, recomendo seguir o &lt;a href="https://docs.aws.amazon.com/cdk/latest/guide/home.html"&gt;Developer Guide oficial&lt;/a&gt; para entender os conceitos e construir sua primeira stack.&lt;/p&gt;

&lt;h3&gt;
  
  
  Encerrando os trabalhos
&lt;/h3&gt;

&lt;p&gt;Desconecte o VSCode do container, clicando no ícone verde do canto inferior esquerdo e na opção &lt;strong&gt;Close Remote Connection&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;No terminal do sitema operacional, finalize a execução do container com o comando:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker stop aws_cdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Até a próxima!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>docker</category>
      <category>vscode</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
