<?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>Forem: Tevin Deale</title>
    <description>The latest articles on Forem by Tevin Deale (@tevindeale).</description>
    <link>https://forem.com/tevindeale</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%2F1415022%2Fc833b8ef-85dc-4af1-88a7-d7af7b3eb018.jpeg</url>
      <title>Forem: Tevin Deale</title>
      <link>https://forem.com/tevindeale</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tevindeale"/>
    <language>en</language>
    <item>
      <title>Enhancing AWS VPC Security: Accessing Your Network with a Private Jumpbox using Tailscale</title>
      <dc:creator>Tevin Deale</dc:creator>
      <pubDate>Mon, 27 May 2024 00:50:03 +0000</pubDate>
      <link>https://forem.com/tevindeale/enhancing-aws-vpc-security-accessing-your-network-with-a-private-jumpbox-using-tailscale-1k83</link>
      <guid>https://forem.com/tevindeale/enhancing-aws-vpc-security-accessing-your-network-with-a-private-jumpbox-using-tailscale-1k83</guid>
      <description>&lt;p&gt;In today's cloud-centric world, ensuring the security of your AWS resources is paramount. I was recently working on a cloud project and wanted a secure way to access the VPC remotely without using EC2 Instance Connect. This is when I came up with the idea to try using &lt;a href="https://tailscale.com/" rel="noopener noreferrer"&gt;Tailscale&lt;/a&gt; VPN. I had already been tinkering with &lt;a href="https://tailscale.com/" rel="noopener noreferrer"&gt;Tailscale&lt;/a&gt; on my home network and noticed how powerful it was. In this post, I will share how you can enhance your AWS VPC security by setting up a private jumpbox using Tailscale. We'll be using the free plan, which is sufficient for our needs. I suggest visiting &lt;a href="https://tailscale.com/" rel="noopener noreferrer"&gt;Tailscale's&lt;/a&gt;website to explore all their features and use cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&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%2Fxilbknqpl4vobs13p554.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%2Fxilbknqpl4vobs13p554.png" alt="Solution Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Basics
&lt;/h2&gt;

&lt;p&gt;For those new to AWS, a Virtual Private Cloud (VPC) is a logically isolated section of the AWS cloud where you can launch AWS resources in a virtual network that you define. A jumpbox, or bastion host, acts as a secure gateway to your VPC, typically accessed via SSH, and it helps in reducing the exposure of your instances. Tailscale is a user-friendly VPN that simplifies secure network connections using WireGuard’s encryption technology. It’s particularly great for creating secure, peer-to-peer networks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use a Private Jumpbox and Tailscale?
&lt;/h2&gt;

&lt;p&gt;Using a private jumpbox, also known as a bastion host, provides a secure gateway to your AWS VPC. Unlike a public jumpbox, a private jumpbox is not accessible directly from the internet, which significantly reduces the attack surface and enhances the overall security of your network. This setup ensures that only authorized users can access your VPC resources.&lt;/p&gt;

&lt;p&gt;Tailscale is a peer-to-peer VPN solution built on WireGuard, which simplifies secure network connections. Tailscale's ease of use, combined with its robust security features, makes it an excellent choice for setting up a private jumpbox. With Tailscale, you can create a secure mesh network that includes your local devices and your AWS resources, allowing seamless and secure access.&lt;/p&gt;

&lt;p&gt;One of the key advantages of using Tailscale with a private jumpbox is its cost-effectiveness. Here are some points to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Free Plan&lt;/strong&gt;: Tailscale offers a free plan that is sufficient for many use cases, especially for small projects or individual developers. This plan includes all the core features needed to set up a secure private jumpbox.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reduced AWS Costs&lt;/strong&gt;: By using a private jumpbox, you can minimize the number of publicly accessible instances, which can lower your AWS costs. Public instances often require additional security measures and monitoring, increasing overall expenses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;No Need for Expensive Hardware&lt;/strong&gt;: Tailscale operates on your existing infrastructure, meaning you don't need to invest in additional hardware or complex network setups.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting Up the Environment
&lt;/h2&gt;

&lt;p&gt;Before we begin, ensure that you have a AWS account with necessary permissions, and the remote system set up with the Tailscale VPN.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create the VPC&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Navigate to the VPC dashboard and click &lt;em&gt;Create VPC&lt;/em&gt;.&lt;br&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%2Fw78ac0d4lb645z6mm6rx.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%2Fw78ac0d4lb645z6mm6rx.png" alt="VPC Dashboard"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the VPC Settings box we will use the &lt;em&gt;VPC and More&lt;/em&gt; option for simplicity. Match your settings to the following and click &lt;em&gt;Create VPC&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name tag auto-generation: TailscaleJumpBox&lt;/li&gt;
&lt;li&gt;IPv4 CIDR block: 10.0.0.0/16&lt;/li&gt;
&lt;li&gt;IPv6 CIDR block(Important): Amazon-provided IPv6 CIDR block&lt;/li&gt;
&lt;li&gt;Tenancy: Default&lt;/li&gt;
&lt;li&gt;Number of Availability Zones: 1&lt;/li&gt;
&lt;li&gt;Number of public subnets: 1&lt;/li&gt;
&lt;li&gt;Number of private subnets: 1&lt;/li&gt;
&lt;li&gt;Nat gateways: None&lt;/li&gt;
&lt;li&gt;VPC endpoints: None&lt;/li&gt;
&lt;li&gt;DNS Options: Both options should be checked.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example output:&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%2Fknl65vmkgpi1trqc4ysw.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%2Fknl65vmkgpi1trqc4ysw.png" alt="TailscaleJumpBox VPC Details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the VPC and more option when creating the VPC saves times by auto generating your subnets, route tables, and internet gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Turn on IPv6 Auto-assign&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the VPC Dashboard menu click &lt;em&gt;Subnets&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Enable Auto-assign IPv6
&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%2F7f8ly7w1txj5obptzegh.gif" alt="Enabling ipv6 auto assign"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This will auto assign IPv6 addresses to resources deployed into the TailscaleJumpBox-VPC. This is useful because by default AWS IPv6 addresses are publicly available by default unlike IPv4 addresses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Security Group&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the VPC Dashboard menu click &lt;em&gt;Security groups&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;em&gt;Create Security Group&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&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%2Fatlnczrt7dk2r1inobiv.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%2Fatlnczrt7dk2r1inobiv.png" alt="Create security group button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter in the following details:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security group name&lt;/strong&gt;: Tailscale-JumpBox-SG&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Description&lt;/strong&gt;: Allow remote connection from Tailscale&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC&lt;/strong&gt;: tailscalejumpbox-vpc&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inbound rules&lt;/strong&gt;: None (default)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Outbound rules&lt;/strong&gt;: Leave as default (all traffic)
Example Output:&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&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%2F6ilwkhlblysa7h7da1oj.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%2F6ilwkhlblysa7h7da1oj.png" alt="Example security group outbound rules"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Launch Instance&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the EC2 Dashboard.&lt;/li&gt;
&lt;li&gt;Click &lt;em&gt;Launch Instance&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&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%2Fyj0qwf99f5oh4yporaa6.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%2Fyj0qwf99f5oh4yporaa6.png" alt="launch instance button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter in the following details:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: Tailscale-JumpBox-USE-1a&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application and OS Images&lt;/strong&gt;: Amazon Linux - Amazon Linux 2023&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance Type&lt;/strong&gt;: t2.micro (free tier)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key pair&lt;/strong&gt;: Create new key pair --&amp;gt; RSA --&amp;gt; .PEM --&amp;gt; Download Key&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Settings&lt;/strong&gt;: Click &lt;em&gt;edit&lt;/em&gt; to change all options&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC&lt;/strong&gt;: tailscalejumpbox-vpc&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subnet&lt;/strong&gt;: tailscalejumpbox-subnet-public1-us-east-1a&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-assign public IP&lt;/strong&gt;: Disable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-assign IPv6 IP&lt;/strong&gt;: Enable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security goups&lt;/strong&gt;: Select existing security group&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Common security groups&lt;/strong&gt;: Tailscale-JumpBox-SG&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure storage&lt;/strong&gt;: Leave as default&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advance details&lt;/strong&gt;: Expand this section and scroll to the bottom to enter &lt;em&gt;User data&lt;/em&gt; (Shell Script)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User data&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;#! bin/bash&lt;/span&gt;
hostnamectl set-hostname ts-jumpbox-use-1a
yum update &lt;span class="nt"&gt;-y&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://tailscale.com/install.sh | sh
tailscale up &lt;span class="nt"&gt;--auth-key&lt;/span&gt; &amp;lt;tskey-auth&amp;gt; &lt;span class="nt"&gt;--ssh&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;Shell script breakdown:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;#! bin/bash&lt;/code&gt;: This shebang line indicates that the script should be run in the bash shell.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hostnamectl set-hostname ts-jumpbox-use-1a&lt;/code&gt;: Sets a readable hostname for the instance. (Optional)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;yum update -y&lt;/code&gt;: Updates all installed packages.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;curl -fsSL https://tailscale.com/install.sh | sh&lt;/code&gt;: Downloads and installs Tailscale's quick install script.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tailscale up --auth-key &amp;lt;tskey-auth&amp;gt; --ssh&lt;/code&gt;: Starts Tailscale and authenticates the instance using the provided auth key, with SSH access enabled.&lt;/li&gt;
&lt;li&gt;Launch Instance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Replace &lt;code&gt;&amp;lt;tskey-auth&amp;gt;&lt;/code&gt; with your actual Tailscale authentication key. You can generate an auth key from the Tailscale admin console under the Keys section in the settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using the &lt;code&gt;--ssh&lt;/code&gt; Flag&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By using the &lt;code&gt;--ssh&lt;/code&gt; flag in the &lt;code&gt;tailscale up&lt;/code&gt; command, you enable Tailscale SSH, which allows you to SSH into the machine using Tailscale’s secure network. After running the script, you will see an SSH tag on the machine in the Tailscale admin console.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting to the JumpBox
&lt;/h2&gt;

&lt;p&gt;To SSH into the server using Tailnet SSH, use the following command:&lt;/p&gt;

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

ssh ec2-user@&amp;lt;tailnet IP address&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;You will be prompted to log in with a browser to authorize access to the server.&lt;/p&gt;

&lt;p&gt;Alternatively, you can use the -i flag with the RSA key generated when launching the instance:&lt;/p&gt;

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

ssh -i rsa.pem ec2-user@&amp;lt;tailnet IP address&amp;gt;


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

&lt;/div&gt;

&lt;p&gt;By following these steps, you can securely connect to your jumpbox and access your AWS VPC using Tailscale, taking advantage of its seamless and secure networking capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this blog post, we explored how to enhance the security of your AWS VPC by setting up a private jumpbox using Tailscale. By utilizing a private jumpbox, you significantly reduce the attack surface of your infrastructure, making your network more secure and resilient against unauthorized access.&lt;/p&gt;

&lt;p&gt;We walked through a step-by-step process to install and configure Tailscale on your jumpbox, leveraging its powerful yet user-friendly VPN capabilities. By enabling Tailscale SSH, we made accessing your jumpbox and other AWS resources secure and straightforward, providing you with a seamless and cost-effective solution for remote network access.&lt;/p&gt;

&lt;p&gt;One of the standout advantages of this setup is its cost-effectiveness. Using Tailscale's free plan and minimizing the number of publicly accessible instances can save costs while still providing robust security features.&lt;/p&gt;

&lt;p&gt;By following the steps outlined, you now have a secure method to access your AWS VPC, ensuring your resources are protected without sacrificing convenience. I encourage you to implement this setup in your projects and experience the benefits firsthand.&lt;/p&gt;

&lt;p&gt;If you have any questions, comments, or additional tips to share, please leave them below. I’d love to hear about your experiences and any further enhancements you make to this setup.&lt;/p&gt;

&lt;p&gt;Call to Action&lt;br&gt;
Try setting up your own private jumpbox with Tailscale today, and ensure your AWS VPC remains secure and accessible. Don’t forget to share your feedback and any custom configurations you come up with!&lt;/p&gt;

&lt;p&gt;For more information and to explore additional features, visit &lt;a href="https://tailscale.com/kb/1017/install" rel="noopener noreferrer"&gt;Tailscale’s documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for reading, and happy securing!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>networking</category>
      <category>tailscale</category>
    </item>
    <item>
      <title>Containerize a Java Spring Boot app</title>
      <dc:creator>Tevin Deale</dc:creator>
      <pubDate>Tue, 14 May 2024 17:37:24 +0000</pubDate>
      <link>https://forem.com/tevindeale/containerize-a-java-spring-boot-app-1op3</link>
      <guid>https://forem.com/tevindeale/containerize-a-java-spring-boot-app-1op3</guid>
      <description>&lt;p&gt;I have reached the stage where I need to decide how to deploy my Spring Boot API. I used this opportunity to learn Docker. I started by reading their documentation to grasp the technology and its usage. I reviewed how to build a Dockerfile and all the components needed to build one. I started with an Alpine image. I had seen the name frequently during my previous research. Although I could have started with the openJDK image, the description indicated it was deprecated, so I reverted to using Alpine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Creating the .jar File
&lt;/h2&gt;

&lt;p&gt;The first thing we need to do is run the Maven clean command in the root directory of your Spring Boot application file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./mvnw clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will remove the previous target directory, which contains your class files and the application's .jar file. To regenerate this directory with the current updates, you need to run the Maven install command.&lt;/p&gt;

&lt;p&gt;To regenerate this directory with the current updates you need to run the maven install command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./mvnw install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the install command, you should now see the target directory in your file structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2bcpr4s7smgr9pehqt9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg2bcpr4s7smgr9pehqt9.png" alt="target folder in spring application file structure" width="632" height="718"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Creating the Dockerfile
&lt;/h2&gt;

&lt;p&gt;Now we can work on our Dockerfile. There are two ways to create a Dockerfile: you can use the Docker init command or create the file manually. I chose to create the file manually as I wanted to learn the manual process before using the Docker init command.&lt;/p&gt;

&lt;p&gt;Create a file in the root directory named Dockerfile. Let's review the contents you need to put in the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM alpine:3.19.1
RUN apk update
RUN apk add openjdk21-jre
EXPOSE 8080
ARG JAR_FILE=target/RocketBank-*.jar
ADD ${JAR_FILE} app.jar
ENTRYPOINT [ "java", "-jar", "app.jar" ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;FROM&lt;/strong&gt;: This keyword is used to specify the base image, which in our case is "alpine:3.19.1".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RUN&lt;/strong&gt;: This keyword is used to run some preliminary commands. In our case, we need to update the package manager and then install Java 21 openJDK or whatever version you used to build your app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXPOSE&lt;/strong&gt;: This keyword is used to expose port 8080 on the container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ARG&lt;/strong&gt;: This keyword is used to store key-value pairs. I used it to store the file path to the application .jar file. I used a wildcard (*) in the .jar filename to be able to reuse this file when I create a new version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ADD&lt;/strong&gt;: This keyword is used to add files from the main directory into the container directory. I am using the ARG variable that was created to retrieve the .jar file and copying it to the container with the name app.jar.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ENTRYPOINT&lt;/strong&gt;: This is the last command that will be run to start the Spring Boot app in the container.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Building and Running the Docker Image
&lt;/h2&gt;

&lt;p&gt;Now we can run the Docker build command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build  -t rocketbankapi:latest .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The -t is the tag command to name your image. The "." at the end specifies that the Dockerfile can be found in the current directory.&lt;/p&gt;

&lt;p&gt;The output from the command should look like the following, if the build was successful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqle8jmm1f581abuqaeq5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqle8jmm1f581abuqaeq5.png" alt="Terminal output from the docker build command" width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can verify that the image was built by running the Docker image list command.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgaw7outujqltz9ly8ld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdgaw7outujqltz9ly8ld.png" alt="Terminal output from the docker image ls command" width="800" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are ready to run the container. You can run the container using the Docker run command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -p 8080:8080/tcp rocketbankapi:latest .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The "-p 8080:8080/tcp" part port forwards the 8080 port on the container to the 8080 port on the host. The "rocketbankapi:latest" part is the repository name followed by the tag.&lt;/p&gt;

&lt;p&gt;Once the Docker run command is ran. The terminal will be outputting the logs for the Spring application. These logs are just output copied from the container since we did not use a "-d" option to run the container in detached mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: Ready to Launch Your Dockerized Spring Boot App
&lt;/h2&gt;

&lt;p&gt;Congratulations! You've successfully containerized your Spring Boot API using Docker. By following these steps, you've gained valuable insights into Docker's workflow and how it can streamline the deployment process for your applications.&lt;/p&gt;

&lt;p&gt;Now that your Docker image is built and ready, you're just a few commands away from launching your application into the cloud. With Docker, scalability and portability are at your fingertips, making it easier than ever to deploy your Spring Boot projects with confidence.&lt;/p&gt;

&lt;p&gt;But this is just the beginning of your Docker journey. As you continue to explore this powerful technology, you'll discover even more ways to optimize your development workflow and streamline your deployment process.&lt;/p&gt;

&lt;p&gt;So go ahead, run your container, and see your Spring Boot API come to life in its Dockerized environment. And remember, the possibilities are endless when you combine the power of Spring Boot with the flexibility of Docker. Happy coding! &lt;/p&gt;

</description>
      <category>docker</category>
      <category>java</category>
      <category>springboot</category>
      <category>learning</category>
    </item>
    <item>
      <title>Becoming a Cloud Developer: 5-13-24</title>
      <dc:creator>Tevin Deale</dc:creator>
      <pubDate>Tue, 14 May 2024 03:29:04 +0000</pubDate>
      <link>https://forem.com/tevindeale/becoming-a-cloud-developer-5-13-24-26j</link>
      <guid>https://forem.com/tevindeale/becoming-a-cloud-developer-5-13-24-26j</guid>
      <description>&lt;p&gt;Hello, my name is Tevin and I am a aspiring cloud developer. this post is latent as I have been studying software development since August 2023. I started with Python taking the Meta Back-End Professional Certification course on Coursera. I then purchased a year subscription to Codecademy where I started the full-stack developer course. I made it through the front-end part of the course. I completed a couple React projects from Frontend Mentor. By December I took on a small project from scratch and built a hangman web app. After this I took a break due to burn out and second guessing if I wanted to move forward with software development, (all the layoffs started to scare me).&lt;/p&gt;

&lt;p&gt;By the end of January I was ready to get back on track. I chose to learn AWS after some research. I took a couple courses on AWS learning platform, and then moved to take the Solutions Architect course on a cloud guru. While taking the course I also read a book named "Linux Basics for Hackers: Getting Started with Networking, Scripting, and Security in Kali". I am not a reader nor do I enjoy it. I enjoyed that book so that says something. By the end of Jan I had finished the Solutions Architect course from a cloud guru, and I started to take practice exams and started the Cloud Resume Project. &lt;/p&gt;

&lt;p&gt;I finished the Resume challenge around the end of Feb. I started back studying for the Solutions Architect exam when I got a call from a recruiter for role to create export PDF templates for their app. I noticed that Java was a nice to have skill, and it has been a while since I was exposed to Java. For the next three weeks I focused on landing that role. Studying Java and completing the coding exercise. I made it to the final round and was unfortunately not selected for the role. I was devastated, because I did not know what I could have done differently to be a better candidate, but that did not stop me. I went back on the grind studying for the Solutions Architect exam. On April 7th I took the exam and passed it.&lt;/p&gt;

&lt;p&gt;After passing the exam I needed to decide on what to do next. I started to browse for jobs but could not find any associate or junior roles where I could get my start. I did some research and found I needed to complete some projects and probably get another certification to stand out from the crowd. I chose to continue learning Java, start studying for the AWS Networking Specialty, Comptia SEC+, and LPIC 1. I feel these certifications will help push me in the right direction.&lt;/p&gt;

&lt;p&gt;While also studying for these certifications I will be finishing up a project I started called Rocket Bank. I will explain this project in another post due to it's complexity. I started creating this application to use for deploying complex web apps to AWS for practice.&lt;/p&gt;

&lt;p&gt;If you made it this far, THANK YOU for reading my whole post. If you have any pointers of resources for me on my journey please share them. &lt;/p&gt;

</description>
      <category>learning</category>
      <category>beginners</category>
      <category>aws</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
