<?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 Kerry Wilson on Medium]]></title>
        <description><![CDATA[Stories by Kerry Wilson on Medium]]></description>
        <link>https://medium.com/@kerry-wilson?source=rss-7c0be013a925------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vGjgrvFsz9UVlRQ5ExQyBg.jpeg</url>
            <title>Stories by Kerry Wilson on Medium</title>
            <link>https://medium.com/@kerry-wilson?source=rss-7c0be013a925------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 22:56:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kerry-wilson/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[Event Driven Architecture Pattern for REST API’s in AWS]]></title>
            <link>https://blog.kerosene.cloud/architecture-pattern-for-rest-apis-in-aws-f244bde44262?source=rss-7c0be013a925------2</link>
            <guid isPermaLink="false">https://medium.com/p/f244bde44262</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[eventbridge]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <dc:creator><![CDATA[Kerry Wilson]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 16:00:47 GMT</pubDate>
            <atom:updated>2025-02-27T16:03:24.800Z</atom:updated>
            <content:encoded><![CDATA[<p>So you have to build a REST API for a mobile or web application? Here is a simple architectural pattern that allows for a lot of flexibility and scalability with your API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*XSU2Xw9P7mL0_SRmzoODdg.png" /></figure><h4>What’s in the Diagram?</h4><ul><li><strong>Cognito</strong>: Issues authentication tokens to your user</li><li><strong>API Gateway</strong>: The front door for your API requests, provides routing to appropriate backend code.</li><li><strong>Lambda</strong>: Handles authorization (can the user do this?), validation (is all the data provided correct), and augmentation (created on, modified on, owner id, etc…)</li><li><strong>DynamoDB Tables</strong>: Store model objects. Streams updates to EventBridge pipes.</li><li><strong>EventBridge Event Bus</strong>: Register listeners with Cloudwatch rules to listen for domain events and react accordingly.</li><li><strong>Listeners</strong>: May be in Lambda or any other service with Event Bridge compatibility. Do things like, send notifications, process payments, aggregate data, etc…</li></ul><h4>The Good</h4><ul><li><strong>Scales Easy</strong>: Handles 10 users or 10,000. Pay for what you use.</li><li><strong>Secure</strong>: Cognito and API Gateway are great options for preventing bad people from accessing the API</li><li><strong>Agile</strong>: Attaching decoupled handlers allows your application to grow easily and new features are added via tiny deployable “microservices”</li></ul><h4><strong>The Bad</strong></h4><ul><li><strong>Vendor Lockin: </strong>Your app becomes tightly coupled with AWS.</li><li><strong>Debugging: </strong>Troubleshooting issues in event driven architectures can be difficult. Xray Tracing to mitigate.</li><li><strong>Recursive Event Loops</strong>: Lambdas may accidentally trigger the event they are listening for. See: <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-recursion.html">Lambda Recursive Loop Detection</a>.</li></ul><h4>Wrapping Up</h4><p>I used this pattern recently on a mobile app and really loved the ease and flexibility it enabled. Utilize CDK and create libraries that make deploying event listeners super easy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f244bde44262" width="1" height="1" alt=""><hr><p><a href="https://blog.kerosene.cloud/architecture-pattern-for-rest-apis-in-aws-f244bde44262">Event Driven Architecture Pattern for REST API’s in AWS</a> was originally published in <a href="https://blog.kerosene.cloud/">Kerosene Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using AWS CloudMap with ECS for Service Discovery]]></title>
            <link>https://blog.kerosene.cloud/using-aws-cloudmap-with-ecs-for-service-discovery-e9c04808e33b?source=rss-7c0be013a925------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9c04808e33b</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[service-discovery]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[aws-ecs]]></category>
            <dc:creator><![CDATA[Kerry Wilson]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 15:12:47 GMT</pubDate>
            <atom:updated>2023-01-12T15:20:47.725Z</atom:updated>
            <content:encoded><![CDATA[<h3>Service Discovery with AWS Cloud Map</h3><p><a href="https://aws.amazon.com/cloud-map/">AWS Cloud Map</a> is a managed service in AWS for service discovery. It provides a mechanism for service to service communication. With AWS Cloud Map one service can talk to another service without the need for a load balancer.</p><p>Put simply, cloud map is a thin wrapper around Route53. It provides a mechanism to manage a hosted zone; either public or private.</p><p>A few key concepts with cloud map:</p><ul><li><strong>Namespace </strong>— Typically corresponding to a hosted zone in Route53, though there are other options. You can think of a namespace being something like <em>yourcompany.local</em> for vpc private or <em>aws.yourcompany.com</em> for something more broadly available across your corporate network.</li><li><strong>Service</strong> — A service will represent a single addressable service such that a DNS request for it may be something like app.yourcompany.local</li><li><strong>Instance</strong> — A running instance of the service. ie, an IP address where the application is running.</li></ul><h3>Elastic Container Service</h3><p><a href="https://aws.amazon.com/ecs/">Elastic Container Service</a> or simply ECS is AWS’ native container orchestration service. With ECS you specify what containers to run and the configuration and it keeps them running. There are two modalities with ECS. You can either run your containers on EC2 instances you manage, or serverless with <a href="https://docs.aws.amazon.com/AmazonECS/latest/userguide/what-is-fargate.html">Fargate</a>. Using Fargate, AWS manages the underlying compute infrastructure and you simply tell it what to run.</p><p><strong>ECS on Fargate is the recommended approach when running containers on ECS</strong></p><p>While this post is not meant to be an exhaustive ECS tutorial, there are three core concepts with ECS that you should be familiar with:</p><ul><li><strong>Cluster</strong> — A collection of services. With Fargate, the concept is abstract, really just a logical grouping of tasks and services with a few configuration options. With ECS on EC2, this will be the EC2 instance(s) that the container will run on.</li><li><strong>Service</strong> — Responsible for managing containers. A service will have a desired count and be associated with a task definition. The service will launch the tasks, associate them with load balancers and cloud map.</li><li><strong>Task Definition </strong>— Provides the configuration of a task, including the container(s) to run, the amount of cpu/memory, environment variables, IAM roles and more.</li></ul><h3>Integrating ECS with Cloud Map</h3><p>ECS integrates with Cloud Map at the service level (for both services). The ECS service is responsible for launching instances of the application and registering that instance with AWS Cloud Map.</p><figure><img alt="ECS Service manages instances in cloud map service which creates records in Route 53" src="https://cdn-images-1.medium.com/max/920/1*u4dSH4V2CJMEu4wh95E_2g.png" /><figcaption>High level overview of ECS and Cloud Map</figcaption></figure><p>A Cloud Map (DNS) namespace creates a hosted zone in Route 53. When we create a service in cloud map, we associate it with a namespace. When the ECS service launches a task, it registers the instance in the cloud map service, which will then create a record in the hosted zone.</p><h3>Things to consider</h3><p>This approach does not give you much control or visibility into the control plane. You cannot specify round robin routing, sticky sessions, or anything like that. It’s governed by DNS so TTL would be obeyed. Complex microservice architectures may benefit from <a href="https://aws.amazon.com/app-mesh/">app mesh</a>, which will give you more control and observability.</p><h3>A CloudFormation Example</h3><p>Below is a snippet from a CloudFormation template to show how to wire a service up with cloud map. This will result in any ECS tasks launched by the service being able to call the application with <em>myapp.mycompany.local</em> from within the VPC.</p><pre>PrivateDnsNamespace:<br>  Type: AWS::ServiceDiscovery::PrivateDnsNamespace<br>  Properties:<br>    Name: &#39;mycompany.local&#39;<br>    Vpc: !Ref VpcId<br><br>ServiceDiscoveryService:<br>    Type: AWS::ServiceDiscovery::Service<br>    Properties:<br>      Description: &#39;myapp nodes&#39;<br>      DnsConfig:<br>        RoutingPolicy: MULTIVALUE<br>        DnsRecords:<br>          - TTL: 30<br>            Type: A<br>          - TTL: 30<br>            Type: SRV<br>      HealthCheckCustomConfig:<br>        FailureThreshold: 1<br>      Name: myapp<br>      NamespaceId: !Ref ServiceDiscoveryNamespace<br><br>EcsCluster:<br>  Type: AWS::ECS::Cluster<br>  Properties:<br>    ClusterName: mycluster<br><br>EcsService:<br>  Type: AWS::ECS::Service<br>  Properties:<br>    Cluster: !Ref EcsCluster<br>    ServiceName: myapp<br>    DesiredCount: 1<br>    LaunchType: FARGATE<br>    TaskDefinition: !Ref TaskDefinition<br>    ServiceRegistries:<br>      - RegistryArn: !GetAtt ServiceDiscoveryService.Arn<br>        Port: 8888</pre><h3>Wrapping Up</h3><p>Hope that was a helpful overview of how to integrate ECS with AWS Cloud Map. Please do let us know if we can do anything to help</p><p>kerry@kerosene.cloud</p><p><a href="https://www.kerosene.cloud/">Kerosene Home</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9c04808e33b" width="1" height="1" alt=""><hr><p><a href="https://blog.kerosene.cloud/using-aws-cloudmap-with-ecs-for-service-discovery-e9c04808e33b">Using AWS CloudMap with ECS for Service Discovery</a> was originally published in <a href="https://blog.kerosene.cloud/">Kerosene Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Most Useful Tag You Need In Your Tagging Policy]]></title>
            <link>https://blog.kerosene.cloud/the-most-useful-tag-you-need-in-your-tagging-policy-b0274bb5b70e?source=rss-7c0be013a925------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0274bb5b70e</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws-tagging]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform-aws]]></category>
            <dc:creator><![CDATA[Kerry Wilson]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 18:59:11 GMT</pubDate>
            <atom:updated>2022-09-20T18:59:11.838Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Tagging is a helpful feature that most AWS resources support. Tags allow you to add metadata to your resources so that you can track usage and do other automation. In this post, I will talk about my favorite tag that I always use when creating resources in AWS.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*dTfZxRHNl1frfnrUVdhx-Q.jpeg" /><figcaption>AirTag because tagging</figcaption></figure><h3>Tag Usage</h3><p>There are many reasons to tag your AWS resources. They are good for cost optimization, automation, and ownership. Larger organizations will implement a tagging policy early on to ensure they can scale their cloud infrastructure. <a href="https://aws.amazon.com/config/">AWS Config</a> provides support for tagging policies by reporting resources that are tagged inappropriately as out of compliance.</p><p>Tagging for cost optimization was a very important feature for many years. However, with many organizations moving to a multi-account setup for AWS, reporting at the resource level has become less important. You can easily report costs per account. However, if you need more granular cost reporting within an account, they can be helpful and you should still add them to your tagging policy.</p><p>Automating the management of your resources with tags is very helpful. For example, you may add an expiration date to your EC2 instances, after which a reaper process will terminate the instances. Another example would be automating backups. <a href="https://aws.amazon.com/backup/">AWS Backup</a> supports this approach. I like this approach as tags are highly visible in the console so it is helpful to see what automated processes are working with them.</p><p>Ownership of AWS resources may take the form of an email for ownership. This will typically point to a distribution list. This can be powerful when used in conjunction with automation for alerting. EC2 instance falls out of compliance? Send an email to the owner. Browsing through the console and wondering what a resource is used for? Send an email to the owner. Often, the root email of the account can be used as ownership for all the resources.</p><h3>Infrastructure as Code Tag</h3><blockquote><strong>The tag I most often see missed in a tagging policy, and the one I most frequently advocate for, is an IAC tag</strong>.</blockquote><p>This tag contains the location of the infrastructure as code that created the resource. This is typically a git repository, which should include a README or other documentation about the resource. In addition, I frequently pair with an IAC:Path or similar that shows the precise path for where the resource is defined within the repository. It may look something like this:</p><pre>IAC=https://github.com/kerosene-cloud/terraform-infrastructure<br>IAC:ModulePath=modules/vpc</pre><h3>Wrapping Up</h3><p>In general, I find the tagging policy conversation to be very tedious and mundane. However, it is a valuable exercise as it is a good way early in a migration to get all teams engaged and providing input into the project. This typically results in a tagging policy that is overly aggressive. Having been a part of many migrations at this point, I can tell you that I have seen many of these tagging policies fall apart after a few months. That’s ok as an organization evolves in the cloud and learns the things that are important to their business and things that aren’t so important. Just remember to update the tagging policy accordingly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0274bb5b70e" width="1" height="1" alt=""><hr><p><a href="https://blog.kerosene.cloud/the-most-useful-tag-you-need-in-your-tagging-policy-b0274bb5b70e">The Most Useful Tag You Need In Your Tagging Policy</a> was originally published in <a href="https://blog.kerosene.cloud/">Kerosene Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplify Deployment of Containers with AWS AppRunner]]></title>
            <link>https://blog.kerosene.cloud/simplify-deployment-of-containers-with-aws-apprunner-96d1a7697b60?source=rss-7c0be013a925------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d1a7697b60</guid>
            <category><![CDATA[aws-app-runner]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Kerry Wilson]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 18:55:51 GMT</pubDate>
            <atom:updated>2022-09-20T18:55:51.885Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>In this post, we will discuss <a href="https://aws.amazon.com/apprunner/">AWS AppRunner</a>, a newer AWS service for building and deploying containers released in May of 2021. This service, similar to Google Cloud Run, is the easiest way to get your containers running in AWS. You can simply point a Git repository to it, or an image stored in ECR.</blockquote><blockquote><strong>Note:</strong> This story was originally posted on our website and has been migrated and edited to reflect recent improvements to the service</blockquote><p>But what are the tradeoffs? Who is this service built for?</p><p>First, an introduction by AWS themselves:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDBbvFA6Up98%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDBbvFA6Up98&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDBbvFA6Up98%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/83b4eb88504add48a3fd3cea6b554af2/href">https://medium.com/media/83b4eb88504add48a3fd3cea6b554af2/href</a></iframe><h3>Building an Image with AppRunner</h3><p><a href="https://aws.amazon.com/apprunner/">AWS AppRunner</a> can manage the building of your images. You configure it to read from a git repository, and it will automatically clone the source code and build the image. You can choose whether this build is automated on git push or manually triggered via CLI or console. When creating the service, you are able to choose between Python3 or NodeJS 12 and configure the build and run commands. Alternatively, you can provide your own custom build configuration via an <a href="https://docs.aws.amazon.com/apprunner/latest/dg/config-file-ref.html">apprunner.yaml</a> file stored in your repository. This approach allows you to configure the build and deployment of your app without updating via CloudFormation or the console.</p><p>You have to choose between Python3 or NodeJS 12 to build your containers with AppRunner. It is not clear why the languages are limited for builds. Most people will do a multi-stage docker build so the host machine has no language requirements. If you do have other applications that do not use these languages or versions you can skip the building of it entirely and tie your AppRunner service to an <a href="https://aws.amazon.com/ecr/">ECR repository</a> directly and handle the building outside of AppRunner.</p><h3>Running your Image</h3><p>Once your build (or ECR repository) is configured, AppRunner can automatically deploy it to AWS infrastructure. This is not in your account. Unlike some service, there are no CloudFormation underpinnings and none of the infrastructure will show in the console outside of the AppRunner console. All you get is a TLS enabled URL to a load balancer.</p><p>As far as scaling is concerned, you configure the vCPU and memory of the container as well as the scaling policy. This is unfortunate, I am still waiting on a service where you can just specify an image and the service would use analytics to determine what combination of vCPU and memory best fits the workload. That would be truly magical.</p><p>Also, important to note that your service endpoints must be public and cannot be constrained to VPC’s. This is the most egregious issue with this AWS offering. Right away, you remove many “enterprise” customers.</p><p>You can, however, connect your service to a VPC with a VPC connector. This allows it to communicate with other services running in your VPC. This gives it the ability to connect to RDS databases, Elasticache, Elasticsearch, or whatever else you may have running in your environment.</p><p>You also have the ability to grant the service a role, so it can make API calls to your account.</p><h3>How Much Does it Cost?</h3><p>Like most AWS services, <a href="https://aws.amazon.com/apprunner/pricing/">pricing</a> is a bit confusing with AppRunner. When the application is not processing requests, you simply pay for the amount of memory you have provisioned. While processing requests, you pay for both Memory and CPU. Pricing is a bit more expensive than <a href="https://aws.amazon.com/fargate/pricing/">ECS Fargate</a>. However, since you only pay for CPU when it is doing work, it will likely work out to be cheaper than an ECS Fargate deployment. But this depends on the usage of your application.</p><h3>Who Should Use it?</h3><p>Startups and other small to medium-sized businesses that do not have sophisticated DevOps practices should try it out. It makes it very simple to deploy and scale your applications. Web applications that need to be up all the time, but take bursty traffic will likely see significant savings with this service.</p><h3>Pros</h3><ul><li>Easy to setup, simple to use</li><li>IAM Role support</li><li>Pay per usage CPU</li><li>API for pausing services</li></ul><h3>Cons</h3><ul><li>Limited Language Support</li><li>No healthcheck configuration</li><li>Public endpoints</li><li>No native EFS support</li></ul><h3>Final Thoughts</h3><p>I long for the days when I do not have to configure my container’s vCPU and Memory and computers will figure it out for me. I don’t know if that is a huge ask, but it seems fairly simple to me. That being said, the scaling model in AppRunner is pretty simple.</p><p>I recommend that everyone look at AppRunner as the first stop for deploying containerized web applications. It’s simple and effective.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96d1a7697b60" width="1" height="1" alt=""><hr><p><a href="https://blog.kerosene.cloud/simplify-deployment-of-containers-with-aws-apprunner-96d1a7697b60">Simplify Deployment of Containers with AWS AppRunner</a> was originally published in <a href="https://blog.kerosene.cloud/">Kerosene Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Kerosene Cloud Accelerator (on Medium)]]></title>
            <link>https://blog.kerosene.cloud/introducing-kerosene-cloud-accelerator-on-medium-4288edd3e23d?source=rss-7c0be013a925------2</link>
            <guid isPermaLink="false">https://medium.com/p/4288edd3e23d</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[consulting-services]]></category>
            <dc:creator><![CDATA[Kerry Wilson]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 18:42:24 GMT</pubDate>
            <atom:updated>2022-09-20T18:45:03.837Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note: This article was originally published on our website, but has been moved to Medium, our new blogging platform.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*-6pZxNWZKwW7F_5mVOxDMA.jpeg" /></figure><p>There is a huge gap in the agility between companies that know how to operate efficiently in the cloud and those that do not. Working in the cloud today requires a unique combination of software engineering and IT operations skills. It has become apparent that there is a huge gap in the knowledge and expertise required to fully utilize the cloud and the expertise on staff at most companies. Large companies have trouble finding the personnel to staff a full-time cloud operations team; startups and other small companies don’t have the budget, let alone the time to manage them. This is why you need a cloud accelerator.</p><p><strong>What is a cloud accelerator?</strong></p><p>A cloud accelerator helps accelerate your cloud operations. By utilizing open source tools and reusable libraries, Kerosene has the ability to get your company up and running in the cloud quickly, using the latest best practices around reliability and security. Once you are up and running, we can help train your staff to use the tools and techniques to support your organization.</p><p><strong>You need a trusted expert in the cloud.</strong></p><p>Most companies do not need a full time cloud expert on staff. AWS will not help you design your applications. Your engineers don’t know how to fully utilize the cloud. We are there to help bridge that gap.</p><p><strong>Kerosene is happy to serve as your trusted expert in the cloud.</strong></p><p>We have many years of experience designing and delivering applications in AWS and have the battle scars to prove it. We can help you design your application for deployment to the cloud, help your organization build a cloud strategy, or get you up and running quickly by installing repeatable solutions.</p><p><a href="https://www.kerosene.cloud/contact">Contact us</a> today to get started!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4288edd3e23d" width="1" height="1" alt=""><hr><p><a href="https://blog.kerosene.cloud/introducing-kerosene-cloud-accelerator-on-medium-4288edd3e23d">Introducing Kerosene Cloud Accelerator (on Medium)</a> was originally published in <a href="https://blog.kerosene.cloud/">Kerosene Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Containerizing Spring Boot Applications]]></title>
            <link>https://blog.kerosene.cloud/containerizing-spring-boot-applications-aa7e2c00ace9?source=rss-7c0be013a925------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa7e2c00ace9</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring-framework]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[java-on-aws]]></category>
            <dc:creator><![CDATA[Kerry Wilson]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 15:36:22 GMT</pubDate>
            <atom:updated>2022-09-20T18:37:21.732Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This is the first of a series of posts on <a href="https://blog.kerosene.cloud/list/java-in-aws-896823ed7b24">running Java in AWS</a>. In this post, we will discuss how to containerize a Spring Boot application so it is ready to be deployed into the AWS environment. If you would like to follow along with the post, please clone the <a href="https://github.com/kerosene-cloud/spring-boot-demo">Github repository</a> and switch to the <strong>containerizing-spring-boot</strong> tag.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ljHUhFnaBissdRBe7DIo6g.png" /></figure><h3>Running Spring Boot Applications</h3><p><a href="https://spring.io/projects/spring-boot">Spring Boot</a> is a popular framework for developing applications in Java. Traditionally enterprise Java applications have been deployed to application servers via a WAR or EAR file. Spring Boot takes a different approach. With it, you create a fat jar that contains all of the dependencies necessary to run your application.</p><p>The jar file approach is nice because you do not have to rely on system dependencies (other than Java) for your application to run in an environment. When we containerize these applications, you no longer have to rely on Java being present on the machine as it will be installed into your container. With Spring boot, starting an application is as simple as running the Jar with the Java command.</p><p>Since we favor a <a href="https://12factor.net/">12 factor approach</a> to software development, we would like to build a single artifact that gets promoted across multiple environments. Spring Boot makes it easy to follow this paradigm. Once compiled, your Jar becomes the deployable artifact.</p><h3><strong>How do we handle configuration differences between environments?</strong></h3><p>Typically for containerized deployments, you utilize environment variables for configuration. Since Spring Boot allows us to override any values in the configuration from environment variables, this makes this approach very simple. In our <a href="https://github.com/kerosene-cloud/spring-boot-demo/tree/containerizing-spring-boot">sample repository</a>, we have a simple Spring Boot “Hello World” application. This application contains a single endpoint that returns our message.</p><p>The message is injected from a configuration value that is set in the <a href="https://github.com/kerosene-cloud/spring-boot-demo/blob/containerizing-spring-boot/src/main/resources/application.properties">application.properties</a> file. You may also use a yml format and override values with a dot syntax similar to the property names.</p><p>In our application we have the following in <em>src/main/resources/application.properties:</em></p><pre>hello.message = World</pre><p>We can quite simply override this property with an environment variable “hello.message=&lt;message&gt;”</p><p>This will also work for yaml, which would look something like this:</p><pre>hello:<br>  message: World</pre><h3>Running the Application in Docker</h3><p>In order to get the application running with Docker. We first need to create a <a href="https://github.com/kerosene-cloud/spring-boot-demo/blob/containerizing-spring-boot/docker/Dockerfile-corretto-17">Dockerfile</a> in the repository. Once we have the Dockerfile, we can build the application with docker build .</p><p>Our sample application uses <a href="https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate&amp;filtered-posts.sort-order=desc">Amazon Corretto JVM</a> with Maven 3 in a <a href="https://docs.docker.com/build/building/multi-stage/">Docker multi-stage build</a>. Multi-stage builds are nice because all developers or CI/CD servers will need to build the project is Docker. In addition, we pull the base images from <a href="https://gallery.ecr.aws/">AWS Public Gallery</a>.</p><p>The Dockerfile looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9278b011761ae59d4d187360c9c6e181/href">https://medium.com/media/9278b011761ae59d4d187360c9c6e181/href</a></iframe><p>Now, we can build and run the application with the following commands:</p><pre>docker build \<br>  --tag spring-boot-demo:corretto-17 \<br>  --file ./docker/Dockerfile-corretto-17 .</pre><pre>docker run -p 8080:8080 spring-boot-demo:corretto-17</pre><p>By default, Spring Boot exposes web applications over port 8080. So you can see the message by navigating to http://localhost:8080</p><p>If we want to pass in configuration on the command line, you can try the following command.</p><pre>docker run \<br>  --publish 8080:8080 \<br>  --env &quot;hello.message=from Docker&quot; \<br>  spring-boot-demo:corretto-17</pre><p>You should see the message “Hello from Docker” in the browser.</p><p>You should now have a working Spring Boot application in Java! Stay tuned for more information on how to run this application in AWS.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa7e2c00ace9" width="1" height="1" alt=""><hr><p><a href="https://blog.kerosene.cloud/containerizing-spring-boot-applications-aa7e2c00ace9">Containerizing Spring Boot Applications</a> was originally published in <a href="https://blog.kerosene.cloud/">Kerosene Cloud</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>