<?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: Apurv</title>
    <description>The latest articles on DEV Community by Apurv (@shethapurv).</description>
    <link>https://dev.to/shethapurv</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%2F863880%2Fce093b74-7989-430c-81d8-175cea13dc10.jpg</url>
      <title>DEV Community: Apurv</title>
      <link>https://dev.to/shethapurv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shethapurv"/>
    <language>en</language>
    <item>
      <title>Running AI Models Locally with Ollama + Spring AI: A Practical Guide for Java Developers</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Wed, 23 Apr 2025 12:10:07 +0000</pubDate>
      <link>https://dev.to/shethapurv/running-ai-models-locally-with-ollama-spring-ai-a-practical-guide-for-java-developers-553d</link>
      <guid>https://dev.to/shethapurv/running-ai-models-locally-with-ollama-spring-ai-a-practical-guide-for-java-developers-553d</guid>
      <description>&lt;p&gt;No Cloud, No Limits: Run AI Locally with Spring Boot and Ollama&lt;/p&gt;

&lt;p&gt;If you’ve been playing around with AI models but hate the idea of sending your data to the cloud every time you make a call to OpenAI or Hugging Face, you’re going to love this: You can now run powerful AI models right on your laptop.&lt;/p&gt;

&lt;p&gt;In this post, I’ll walk you through how to do exactly that using Ollama and integrate it with your Spring Boot applications using Spring AI.&lt;/p&gt;

&lt;p&gt;We’ll cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The different types of models you can run locally (text, audio, visual)&lt;/li&gt;
&lt;li&gt;What models are available on Ollama and their system requirements&lt;/li&gt;
&lt;li&gt;Which models actually run well on a local machine (no crazy GPUs needed)&lt;/li&gt;
&lt;li&gt;How Spring AI makes working with these models ridiculously easy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s dive in.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;h4&gt;
  
  
  First, What Is Ollama?
&lt;/h4&gt;

&lt;p&gt;Think of Ollama like Docker, but for AI models. With a single command, you can pull and run an LLM locally – no GPU required (though it helps). It’s lightweight, fast, and it gives you privacy and control over your AI workflows.&lt;/p&gt;

&lt;p&gt;For example, want to run the mistral model? Just type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ollama run mistral
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Types of Models Ollama Supports
&lt;/h4&gt;

&lt;p&gt;Right now, Ollama is primarily focused on language models, but support for other model types is starting to trickle in. Here’s a quick breakdown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text models: These are your bread and butter for chatbots, summarization, Q&amp;amp;A, etc. (e.g. phi, mistral, llama2, gemma)&lt;/li&gt;
&lt;li&gt;Visual models: Some early support here, like llava, for things like image captioning.&lt;/li&gt;
&lt;li&gt;Audio: Not officially in Ollama yet, but the community is starting to explore integrations with models like Whisper.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bottom line: if you’re building anything text-based, Ollama has you covered today. More is coming soon.&lt;/p&gt;

&lt;h4&gt;
  
  
  What Models Can You Actually Run Locally?
&lt;/h4&gt;

&lt;p&gt;Here’s a handy table that breaks down a few popular models and how much memory they typically need:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4znkf5iso6fho3wh3d2r.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4znkf5iso6fho3wh3d2r.jpeg" width="742" height="258"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pro tip: If you’re working on a MacBook or any device with 8 – 16 GB of RAM and no GPU, start with phi or mistral-mini. They’re fast, smart, and run surprisingly well on basic setups.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Enter Spring AI: AI for Java Devs
&lt;/h4&gt;

&lt;p&gt;Now, let’s talk about Spring AI, which is the Spring ecosystem’s way of saying: “You don’t need to be a Python ninja to use AI in your Java apps.”&lt;/p&gt;

&lt;p&gt;Spring AI gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy integration with LLMs (OpenAI, Ollama, HuggingFace, etc.)&lt;/li&gt;
&lt;li&gt;Chat models: for building conversational experiences&lt;/li&gt;
&lt;li&gt;Prompt templates: like handlebars, but for prompts&lt;/li&gt;
&lt;li&gt;Function calling: let models trigger your Spring services&lt;/li&gt;
&lt;li&gt;Agents + tools: build smarter workflows using custom tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To get started with Ollama, add this to your Spring Boot app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;dependency&amp;gt;
  &amp;lt;groupId&amp;gt;org.springframework.ai&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;spring-ai-ollama-spring-boot-starter&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then configure it in application.yml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;spring:
  ai:
    ollama:
      base-url: http://localhost:11434
      model: mistral
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And boom – you’re now talking to an LLM from your Spring Boot controller 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;@RestController
public class ChatController {

    private final ChatClient chatClient;

    public ChatController(ChatClient chatClient) {
        this.chatClient = chatClient;
    }

    @GetMapping("/ask")
    public String ask(@RequestParam String message) {
        return chatClient.call(message);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s clean, it’s simple, and it keeps your AI interactions private and fast.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;h4&gt;
  
  
  So Why Should You Care?
&lt;/h4&gt;

&lt;p&gt;Here’s why this setup is a game-changer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No more cloud costs: Run models without paying per token.&lt;/li&gt;
&lt;li&gt;Speed: Local models respond instantly.&lt;/li&gt;
&lt;li&gt;Privacy: Your data stays on your machine.&lt;/li&gt;
&lt;li&gt;Portability: Build once, run anywhere – even air-gapped environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re building anything from customer support bots to internal dev tools, this combo of Ollama + Spring AI is about as powerful (and fun) as it gets.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;h4&gt;
  
  
  Bonus: Run It All in Docker
&lt;/h4&gt;

&lt;p&gt;Want to ship your entire AI app as a container? You can run Ollama and your Spring Boot app in a single Docker Compose file. Makes deployment to servers or edge devices super smooth.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;h4&gt;
  
  
  Final Thoughts
&lt;/h4&gt;

&lt;p&gt;AI is no longer locked behind cloud APIs and GPU clusters. With tools like Ollama and Spring AI, you can bring AI right into your own machine – and your own Java app stack.&lt;/p&gt;

&lt;p&gt;Start small, maybe with phi or mistral-mini, wire it up with Spring AI, and see where it takes you. Whether you’re building a side project or enterprise-grade tools, this setup has you covered. Of course, when it comes to scale then gradually can be integrated with external API provider with required functionality implemented locally without spending a single penny.&lt;/p&gt;

&lt;p&gt;If you found this helpful or want a follow-up post on vector search, RAG, or agents with Spring AI, let me know!&lt;/p&gt;

</description>
      <category>technology</category>
      <category>programming</category>
      <category>datascience</category>
      <category>artificialintelligen</category>
    </item>
    <item>
      <title>Spring Boot GraphQL Subscriptions: A Deep Dive into Real-Time Data Delivery</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Sun, 24 Nov 2024 08:12:04 +0000</pubDate>
      <link>https://dev.to/shethapurv/spring-boot-graphql-subscriptions-a-deep-dive-into-real-time-data-delivery-2jb1</link>
      <guid>https://dev.to/shethapurv/spring-boot-graphql-subscriptions-a-deep-dive-into-real-time-data-delivery-2jb1</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In today’s fast-paced digital world, real-time data delivery is paramount. GraphQL, a powerful query language for APIs, has revolutionized how we interact with data. When combined with the robust Spring Boot framework and the real-time capabilities of GraphQL subscriptions, we can build highly responsive and efficient applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Cases
&lt;/h3&gt;

&lt;p&gt;GraphQL subscriptions are ideal for scenarios where you need to push data to clients in real-time, such as:&lt;/p&gt;

&lt;p&gt;* Real-time chat applications: Delivering messages as soon as they’re sent.&lt;/p&gt;

&lt;p&gt;* Live dashboards: Updating metrics and visualizations instantly.&lt;/p&gt;

&lt;p&gt;* Collaborative tools: Syncing changes across multiple users in real-time.&lt;/p&gt;

&lt;p&gt;* Stock tickers: Providing up-to-the-second market data.&lt;/p&gt;

&lt;p&gt;* IoT applications: Receiving sensor data as soon as it’s collected.&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges in Traditional Systems
&lt;/h3&gt;

&lt;p&gt;In traditional systems, delivering real-time updates across multiple clusters can be challenging. For instance, a message published on one cluster may not be immediately accessible to users on another cluster. This can lead to inconsistencies and delays in data delivery.&lt;/p&gt;

&lt;p&gt;Resolving the Challenge with Kafka and Spring Boot Sink&lt;/p&gt;

&lt;p&gt;To address this issue, we can leverage the power of Kafka and Spring Boot’s Sink mechanism. Kafka, a distributed streaming platform, ensures reliable and scalable message delivery. The Spring Boot Sink connector allows us to easily integrate Kafka with our Spring Boot applications.&lt;/p&gt;

&lt;p&gt;Here’s a high-level overview of how this solution works:&lt;/p&gt;

&lt;p&gt;* Message Publication: When a new message is generated, it’s published to a Kafka topic.&lt;/p&gt;

&lt;p&gt;* Kafka Consumption: Spring Boot applications, deployed on different clusters, subscribe to the Kafka topic.&lt;/p&gt;

&lt;p&gt;* Real-Time Delivery: As soon as a new message arrives, the Spring Boot application processes it and pushes the relevant data to the GraphQL subscription clients.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance Considerations
&lt;/h3&gt;

&lt;p&gt;To ensure optimal performance for GraphQL subscriptions, consider the following factors:&lt;/p&gt;

&lt;p&gt;* Efficient Querying: Design GraphQL queries to fetch only the necessary data.&lt;/p&gt;

&lt;p&gt;* Caching: Implement caching strategies to reduce the load on the database and improve response times.&lt;/p&gt;

&lt;p&gt;* Asynchronous Processing: Use asynchronous programming techniques to handle multiple requests concurrently.&lt;/p&gt;

&lt;p&gt;* Load Balancing: Distribute the load across multiple instances to prevent bottlenecks.&lt;/p&gt;

&lt;p&gt;* Kafka Optimization: Tune Kafka’s configuration parameters to optimize performance and scalability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;By combining the power of GraphQL subscriptions, Spring Boot, and Kafka, we can build robust and scalable real-time applications. This approach addresses the challenges of traditional systems and ensures seamless data delivery across multiple clusters. By carefully considering performance factors and optimizing the implementation, we can deliver exceptional user experiences.&lt;/p&gt;

</description>
      <category>technology</category>
      <category>microservicespattern</category>
      <category>programming</category>
      <category>containers</category>
    </item>
    <item>
      <title>Envoy Proxy Explained: How to Secure and Streamline Your Microservices</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Fri, 13 Sep 2024 14:51:03 +0000</pubDate>
      <link>https://dev.to/shethapurv/envoy-proxy-explained-how-to-secure-and-streamline-your-microservices-1i47</link>
      <guid>https://dev.to/shethapurv/envoy-proxy-explained-how-to-secure-and-streamline-your-microservices-1i47</guid>
      <description>&lt;p&gt;Envoy components such as load balancing, OAuth2 authentication, JWT authentication, service-to-service security, role-based access control (RBAC), and advanced logging and monitoring&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AkwYeMQxapsRaSVpL" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AkwYeMQxapsRaSVpL" alt="Harnessing Envoy Proxy for Secure, Scalable, and Efficient Microservices Architecture" width="1024" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Introduction
&lt;/h4&gt;

&lt;p&gt;As I began exploring various proxy options, I aimed to find a solution that could simplify our processes while enhancing security, all without adding extra complexity to the services. That’s when Envoy Proxy caught my attention, and diving into its capabilities has been a game-changer for how we manage our services.&lt;/p&gt;

&lt;h4&gt;
  
  
  Initial Configuration and Seamless OAuth2 Integration
&lt;/h4&gt;

&lt;p&gt;In many setups, requests are typically routed through a service that connects to an enterprise server for authentication. While this method gets the job done, it often adds an extra service hop, which can lead to increased latency and slower performance.&lt;/p&gt;

&lt;p&gt;After exploring Envoy Proxy’s OAuth2 filter, I was amazed by its simplicity and efficiency. This powerful filter seamlessly integrated into our system, eliminating the need for complex, service-level authentication. The result? Reduced latency, faster response times, and a much simpler configuration process. If you’re looking to optimize performance and streamline authentication, Envoy Proxy’s OAuth2 filter is a game-changer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fisswtltjescbeaaukavo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fisswtltjescbeaaukavo.png" alt="OAuth2" width="706" height="716"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Implementing JWT Authentication for Enhanced Service-to-Service Security
&lt;/h4&gt;

&lt;p&gt;So next priority comes ensuring secure communication between services, and Envoy’s JwtAuthentication filter proved to be the perfect solution. This filter checks for a token in the request header or cookie and validates it, making it incredibly easy to implement. The best part? It only required a simple configuration change, with no need to modify our existing services. The quick setup and smooth integration reinforced my trust in Envoy Proxy as a reliable security tool.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F50bjq0gixuw1oi3ak051.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F50bjq0gixuw1oi3ak051.png" alt="JwtAuthentication" width="742" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Role-Based Access Control (RBAC)
&lt;/h4&gt;

&lt;p&gt;Soon after knowing OAuth2 and JWT authentication, I encountered a new challenge — validating users based on their roles. At first, I considered ADFS, but after diving deeper into Envoy’s capabilities, discovered that it supports Role-Based Access Control (RBAC). This feature allowed us to enforce user entitlements effortlessly. Setting up RBAC in Envoy was straightforward, offering the exact access control that one would need without adding unnecessary complexity.&lt;/p&gt;

&lt;p&gt;By leveraging both JWT authentication and RBAC, Envoy Proxy has enabled us to secure service-to-service communication and manage user access with ease.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdwe54h3hi7okbi7i3r0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdwe54h3hi7okbi7i3r0y.png" alt="RBAC" width="610" height="748"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Advanced Logging and Monitoring
&lt;/h4&gt;

&lt;p&gt;Logging is crucial for any application or product, and Envoy Proxy is no exception. Envoy was configured to capture detailed logs, which included valuable insights into the end-to-end user journey.&lt;/p&gt;

&lt;p&gt;Envoy’s logging capabilities enabled us to gather statistics such as the number of users logged in, the number of requests at any given time, the average time taken for each request, and much more. This comprehensive logging and monitoring capability has been instrumental in optimizing system performance and ensuring a smooth user experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffsygntj5vqzaxdqmpn4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffsygntj5vqzaxdqmpn4w.png" alt="Logging" width="675" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;My experience with Envoy Proxy has been truly transformative. From cutting down latency through seamless OAuth2 integration to securing service-to-service communication with JWT authentication, and implementing strong role-based access control, Envoy has consistently proven itself to be a powerful and versatile tool. Its advanced logging and monitoring features have further elevated our ability to manage and fine-tune whole eco system.&lt;/p&gt;

&lt;p&gt;In short, Envoy Proxy has far surpassed our expectations, delivering a secure, efficient, and flexible solution that simplifies configuration while boosting performance. By fully exploring Envoy’s capabilities, one should be able to significantly improve system architecture and provide a better user experience.&lt;/p&gt;

&lt;h4&gt;
  
  
  References
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://www.envoyproxy.io/docs/envoy/latest/" rel="noopener noreferrer"&gt;https://www.envoyproxy.io/docs/envoy/latest/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>envoyproxy</category>
      <category>proxy</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>AWS S3 File Upload via Amazon API Gateway</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Tue, 22 Aug 2023 16:35:47 +0000</pubDate>
      <link>https://dev.to/shethapurv/aws-s3-file-upload-via-amazon-api-gateway-4lid</link>
      <guid>https://dev.to/shethapurv/aws-s3-file-upload-via-amazon-api-gateway-4lid</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Amazon Simple Storage Service&lt;/strong&gt; (Amazon S3) is a cloud object storage service that offers industry-leading scalability, data availability, security, and performance. You can use Amazon S3 to store and retrieve any amount of data from anywhere on the web.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon API Gateway is&lt;/strong&gt; a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. You can use API Gateway to create RESTful APIs and WebSocket APIs that enable real-time two-way communication applications.&lt;/p&gt;

&lt;p&gt;Of course, there are multiple ways to upload file to AWS S3 bucket, however, in this section, we will discuss on how to create an API Gateway endpoint for uploading files to Amazon S3. We will also go through on how to test the API Gateway endpoint. I assume that you have some basic knowledge of AWS services and tools, such as IAM, S3, and API Gateway.&lt;/p&gt;

&lt;h4&gt;
  
  
  Tool(s)/Framework(s)
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Cloud Provider&lt;/strong&gt;  — Amazon Web Service(AWS)&lt;br&gt;&lt;br&gt;
&lt;strong&gt;AWS Services&lt;/strong&gt;  — API Gateway, Simple Storage Service(S3), Identity &amp;amp; Access Management(IAM)&lt;/p&gt;

&lt;h4&gt;
  
  
  High-Level Design
&lt;/h4&gt;

&lt;p&gt;Let me start with high level design &amp;amp; what we are trying to achieve here. First, we will create s3 bucket &amp;amp; then we will configure AWS API Gateway using which we should be able to upload any types of file to S3 bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fcgw5sh6gi3opp0mcfce9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fcgw5sh6gi3opp0mcfce9.gif" width="854" height="264"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 File Upload Via API Gateway&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;h4&gt;
  
  
  → S3 Bucket Creation &amp;amp; Configuration
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Let’s navigate to AWS console &amp;amp; head towards S3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Frw1djvwopcauydmkriuf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Frw1djvwopcauydmkriuf.png" width="800" height="397"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS S3 Console Navigation&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on “Create bucket” button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F77erykaxptzmugaqnkb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F77erykaxptzmugaqnkb9.png" width="800" height="136"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 Bucket — Create&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter only minimal required details &amp;amp; keep all other attributes as it is without any change.
&lt;strong&gt;Bucket name&lt;/strong&gt;  — enter valid bucket name, for Ex: “apigateways3bucket”
&lt;strong&gt;AWS Region&lt;/strong&gt;  — choose appropriate AWS region in which you want to create bucket&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqlpj2l1q0y9dqxz93dbn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqlpj2l1q0y9dqxz93dbn.png" width="800" height="535"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 Bucket — Configuraion&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on “Create bucket” button which will result in bucket to be created.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4bf4goxsx86avqqusyco.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4bf4goxsx86avqqusyco.png" width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we can verify that bucket has been created from S3 dashboard as shown below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fy8infonuu0ise092azqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fy8infonuu0ise092azqg.png" width="800" height="134"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 Bucket — After creation on S3 Dashboard&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now that we have created S3 bucket, Let’s move on to create &amp;amp; configure API Gateway.&lt;/p&gt;

&lt;h4&gt;
  
  
  → API Gateway Creation/Configuration
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to API Gateway from AWS Console&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fpb9ji79nhc3ygd4cmfqs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fpb9ji79nhc3ygd4cmfqs.png" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on “Create API” button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fke8e1edqeiijr6tbj9lz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fke8e1edqeiijr6tbj9lz.png" width="800" height="101"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Create API&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose “Rest API” &amp;amp; click on “Build”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0q3y658xkszoqjd66pyy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0q3y658xkszoqjd66pyy.png" width="800" height="557"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Build&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, let’s enter the required details &amp;amp; click on “Create API” button.
&lt;/li&gt;
&lt;li&gt;“Choose the protocol” — Choose “REST”
&lt;/li&gt;
&lt;li&gt;“Create new API” — Choose “New API”
&lt;/li&gt;
&lt;li&gt;Enter “API name” as “s3upload” &amp;amp; choose “Endpoint Type” as “Regional” as shown below under “Settings” section.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F05jlteaa7v61j9g9cx3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F05jlteaa7v61j9g9cx3t.png" width="800" height="264"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Settings&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can see that API Gateway resource has been created successfully&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fh0uxjdipy33wf6x3phu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh0uxjdipy33wf6x3phu5.png" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Resources&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Also, we can navigate back to the API Gateway dashboard &amp;amp; can see that new API Gateway with name “S3 Upload” is created.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8xpz0h986gsc5ngmilwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8xpz0h986gsc5ngmilwi.png" width="800" height="100"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Dashboard&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, we have to configure resources with request path where
&lt;/li&gt;
&lt;li&gt;Under “Resources” panel of API page, select /.
&lt;/li&gt;
&lt;li&gt;Choose “Create Resource” from the “Actions” menu.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fivukgvcfqdr0muxzx1rd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fivukgvcfqdr0muxzx1rd.png" width="569" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, we will create two resources where each resources signifies the S3 bucket &amp;amp; the object.
&lt;/li&gt;
&lt;li&gt;Create a resource &lt;strong&gt;under “/” (&lt;/strong&gt;root) with “Resource Name” as “folder” and “Resource Path” as “{folder}” &amp;amp; click on “Create Resource”
&lt;/li&gt;
&lt;li&gt;Create another resource &lt;strong&gt;under “/{folder}”&lt;/strong&gt; (root) with “Resource Name” as “object” and “Resource Path” as “{object}” &amp;amp; click on “Create Resource”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffeytyual87l08ig9adnf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffeytyual87l08ig9adnf.png" width="800" height="225"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Create Resource&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once these resources are created which would look something like this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdp4leopapxtchl9emmty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdp4leopapxtchl9emmty.png" width="441" height="176"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Resources&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once resources are created, now let’s create HTTP methods which will help us to upload &amp;amp; download the files to/from S3.&lt;/li&gt;
&lt;li&gt;Select “/{object}” from “Resources” &amp;amp; choose “Create Method”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fj5k7ogka8xm6brvb3i1u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fj5k7ogka8xm6brvb3i1u.png" width="589" height="409"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Create Metod&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, from Actions dropdown, choose ‘ &lt;strong&gt;Put&lt;/strong&gt; ’ method &amp;amp; provide required configuration as given &amp;amp; shown below.
&lt;/li&gt;
&lt;li&gt;Integration Type — AWS Service
&lt;/li&gt;
&lt;li&gt;AWS Region — Choose the appropriate region
&lt;/li&gt;
&lt;li&gt;Execution Rolle — Choose execution role created earlier
&lt;/li&gt;
&lt;li&gt;Under “URL Path Parameters” section, add below parameters.

&lt;ol&gt;
&lt;li&gt;Name — bucket, Mapped From — method.request.path.folder
&lt;/li&gt;
&lt;li&gt;Name — key, Mapped From — method.request.path.object&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdqx8mj3jq60i0bhovyst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdqx8mj3jq60i0bhovyst.png" width="800" height="468"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Put method&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, from Actions dropdown, choose ‘ &lt;strong&gt;Get&lt;/strong&gt; ’ method &amp;amp; provide required configuration as given &amp;amp; shown below.
&lt;/li&gt;
&lt;li&gt;Integration Type — AWS Service
&lt;/li&gt;
&lt;li&gt;AWS Region — Choose the appropriate region
&lt;/li&gt;
&lt;li&gt;Execution Rolle — Choose execution role created earlier
&lt;/li&gt;
&lt;li&gt;Under “URL Path Parameters” section, add below parameters.

&lt;ol&gt;
&lt;li&gt;Name — bucket, Mapped From — method.request.path.folder
&lt;/li&gt;
&lt;li&gt;Name — key, Mapped From — method.request.path.object&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fajgptsw9yyyqyy4q7jaz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fajgptsw9yyyqyy4q7jaz.png" width="800" height="456"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Get Configuration&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let’s setup binary media type to allow file upload/download via HTTP request.
Click on “Add Binary Media Type” &amp;amp; enter “*/*”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fovsexgw5on9e1g4hex0i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fovsexgw5on9e1g4hex0i.png" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Binary Media Type&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Testing
&lt;/h4&gt;

&lt;p&gt;Now, you might be thinking so much of configuration but believe me, you will really enjoy &amp;amp; may explore other functionalities on the way which may excite you more &amp;amp; more.&lt;br&gt;&lt;br&gt;
Huuhhh, enough of configuration now, it’s time for testing :)&lt;/p&gt;

&lt;p&gt;Let’s navigate to the “Put” method which would looks something like shown below. Let’s click on “Test” link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8okpsmtt7roldirmw7iu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8okpsmtt7roldirmw7iu.png" width="800" height="316"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Test&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Enter the required input parameters&lt;br&gt;&lt;br&gt;
{folder} — apigateways3bucket (which we have created ealier)&lt;br&gt;&lt;br&gt;
{object} — testfile (object name by which object would be created under S3 bucket)&lt;br&gt;&lt;br&gt;
Request Body — enter the saple text as file content here&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fv8h61gy8wqcaj6ulemfr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fv8h61gy8wqcaj6ulemfr.png" width="800" height="659"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Test Inputs Parameters&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Once all parameters are set, we are all set to click on “Test” button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2a8kf4bp0nzo7gpi226z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2a8kf4bp0nzo7gpi226z.png" width="678" height="911"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Test&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, navigate to the AWS S3 dashboard &amp;amp; check the bucket. it will have the file uploaded in previous step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8hrcfthlpq5jovhbuwqu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8hrcfthlpq5jovhbuwqu.png" width="699" height="451"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS S3 — verification after upload&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hurrrrayyy, finally we were able to upload file to S3 using AWS API Gateway.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In this section, we have learned how to create an API Gateway endpoint for uploading files to Amazon S3. We have also learned how to test the endpoint. By using this approach, we can leverage the benefits of both Amazon S3 and API Gateway, such as scalability, availability, security, performance, and ease of development. We can also avoid the limitations of uploading files directly to API Gateway, such as the payload size and encoding restrictions. This way, we can create a robust and efficient solution for uploading files to the cloud.&lt;/p&gt;

&lt;p&gt;I hope you have enjoyed this tutorial and found it useful. If you have any questions or feedback, please feel free to &lt;a href="https://shethapurv.github.io/portfolio/" rel="noopener noreferrer"&gt;connect&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If this post was helpful, please clap for few times or follow to show your support which keeps me constantly motivated to share my learnings.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning, sharing &amp;amp; growing together.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>apigateway</category>
      <category>cloud</category>
      <category>s3</category>
      <category>aws</category>
    </item>
    <item>
      <title>The Most Popular File Upload to AWS S3 Using AWS Api Gateway</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Tue, 22 Aug 2023 16:35:47 +0000</pubDate>
      <link>https://dev.to/shethapurv/the-most-popular-file-upload-to-aws-s3-using-aws-api-gateway-d6p</link>
      <guid>https://dev.to/shethapurv/the-most-popular-file-upload-to-aws-s3-using-aws-api-gateway-d6p</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Amazon Simple Storage Service&lt;/strong&gt; (Amazon S3) is a cloud object storage service that offers industry-leading scalability, data availability, security, and performance. You can use Amazon S3 to store and retrieve any amount of data from anywhere on the web.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon API Gateway is&lt;/strong&gt; a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. You can use API Gateway to create RESTful APIs and WebSocket APIs that enable real-time two-way communication applications.&lt;/p&gt;

&lt;p&gt;Of course, there are multiple ways to upload file to AWS S3 bucket, however, in this section, we will discuss on how to create an API Gateway endpoint for uploading files to Amazon S3. We will also go through on how to test the API Gateway endpoint. I assume that you have some basic knowledge of AWS services and tools, such as IAM, S3, and API Gateway.&lt;/p&gt;

&lt;h4&gt;
  
  
  Tool(s)/Framework(s)
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Cloud Provider&lt;/strong&gt;  — Amazon Web Service(AWS)&lt;br&gt;&lt;br&gt;
&lt;strong&gt;AWS Services&lt;/strong&gt;  — API Gateway, Simple Storage Service(S3), Identity &amp;amp; Access Management(IAM)&lt;/p&gt;

&lt;h4&gt;
  
  
  High-Level Design
&lt;/h4&gt;

&lt;p&gt;Let me start with high level design &amp;amp; what we are trying to achieve here. First, we will create s3 bucket &amp;amp; then we will configure AWS API Gateway using which we should be able to upload any types of file to S3 bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fcgw5sh6gi3opp0mcfce9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fcgw5sh6gi3opp0mcfce9.gif" width="854" height="264"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 File Upload Via API Gateway&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;

&lt;h4&gt;
  
  
  → S3 Bucket Creation &amp;amp; Configuration
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Let’s navigate to AWS console &amp;amp; head towards S3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Frw1djvwopcauydmkriuf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Frw1djvwopcauydmkriuf.png" width="800" height="397"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS S3 Console Navigation&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on “Create bucket” button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F77erykaxptzmugaqnkb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F77erykaxptzmugaqnkb9.png" width="800" height="136"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 Bucket — Create&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter only minimal required details &amp;amp; keep all other attributes as it is without any change.
&lt;strong&gt;Bucket name&lt;/strong&gt;  — enter valid bucket name, for Ex: “apigateways3bucket”
&lt;strong&gt;AWS Region&lt;/strong&gt;  — choose appropriate AWS region in which you want to create bucket&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqlpj2l1q0y9dqxz93dbn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqlpj2l1q0y9dqxz93dbn.png" width="800" height="535"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 Bucket — Configuraion&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on “Create bucket” button which will result in bucket to be created.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F4bf4goxsx86avqqusyco.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F4bf4goxsx86avqqusyco.png" width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we can verify that bucket has been created from S3 dashboard as shown below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fy8infonuu0ise092azqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fy8infonuu0ise092azqg.png" width="800" height="134"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;S3 Bucket — After creation on S3 Dashboard&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now that we have created S3 bucket, Let’s move on to create &amp;amp; configure API Gateway.&lt;/p&gt;

&lt;h4&gt;
  
  
  → API Gateway Creation/Configuration
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to API Gateway from AWS Console&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fpb9ji79nhc3ygd4cmfqs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fpb9ji79nhc3ygd4cmfqs.png" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on “Create API” button&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fke8e1edqeiijr6tbj9lz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fke8e1edqeiijr6tbj9lz.png" width="800" height="101"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Create API&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose “Rest API” &amp;amp; click on “Build”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F0q3y658xkszoqjd66pyy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F0q3y658xkszoqjd66pyy.png" width="800" height="557"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Build&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, let’s enter the required details &amp;amp; click on “Create API” button.
&lt;/li&gt;
&lt;li&gt;“Choose the protocol” — Choose “REST”
&lt;/li&gt;
&lt;li&gt;“Create new API” — Choose “New API”
&lt;/li&gt;
&lt;li&gt;Enter “API name” as “s3upload” &amp;amp; choose “Endpoint Type” as “Regional” as shown below under “Settings” section.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F05jlteaa7v61j9g9cx3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F05jlteaa7v61j9g9cx3t.png" width="800" height="264"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Settings&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can see that API Gateway resource has been created successfully&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fh0uxjdipy33wf6x3phu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh0uxjdipy33wf6x3phu5.png" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Resources&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Also, we can navigate back to the API Gateway dashboard &amp;amp; can see that new API Gateway with name “S3 Upload” is created.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8xpz0h986gsc5ngmilwi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8xpz0h986gsc5ngmilwi.png" width="800" height="100"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Dashboard&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, we have to configure resources with request path where
&lt;/li&gt;
&lt;li&gt;Under “Resources” panel of API page, select /.
&lt;/li&gt;
&lt;li&gt;Choose “Create Resource” from the “Actions” menu.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fivukgvcfqdr0muxzx1rd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fivukgvcfqdr0muxzx1rd.png" width="569" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, we will create two resources where each resources signifies the S3 bucket &amp;amp; the object.
&lt;/li&gt;
&lt;li&gt;Create a resource &lt;strong&gt;under “/” (&lt;/strong&gt;root) with “Resource Name” as “folder” and “Resource Path” as “{folder}” &amp;amp; click on “Create Resource”
&lt;/li&gt;
&lt;li&gt;Create another resource &lt;strong&gt;under “/{folder}”&lt;/strong&gt; (root) with “Resource Name” as “object” and “Resource Path” as “{object}” &amp;amp; click on “Create Resource”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ffeytyual87l08ig9adnf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ffeytyual87l08ig9adnf.png" width="800" height="225"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Create Resource&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once these resources are created which would look something like this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdp4leopapxtchl9emmty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdp4leopapxtchl9emmty.png" width="441" height="176"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Gateway — Resources&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once resources are created, now let’s create HTTP methods which will help us to upload &amp;amp; download the files to/from S3.&lt;/li&gt;
&lt;li&gt;Select “/{object}” from “Resources” &amp;amp; choose “Create Method”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fj5k7ogka8xm6brvb3i1u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fj5k7ogka8xm6brvb3i1u.png" width="589" height="409"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Create Metod&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, from Actions dropdown, choose ‘ &lt;strong&gt;Put&lt;/strong&gt; ’ method &amp;amp; provide required configuration as given &amp;amp; shown below.
&lt;/li&gt;
&lt;li&gt;Integration Type — AWS Service
&lt;/li&gt;
&lt;li&gt;AWS Region — Choose the appropriate region
&lt;/li&gt;
&lt;li&gt;Execution Rolle — Choose execution role created earlier
&lt;/li&gt;
&lt;li&gt;Under “URL Path Parameters” section, add below parameters.

&lt;ol&gt;
&lt;li&gt;Name — bucket, Mapped From — method.request.path.folder
&lt;/li&gt;
&lt;li&gt;Name — key, Mapped From — method.request.path.object&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdqx8mj3jq60i0bhovyst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdqx8mj3jq60i0bhovyst.png" width="800" height="468"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Put method&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, from Actions dropdown, choose ‘ &lt;strong&gt;Get&lt;/strong&gt; ’ method &amp;amp; provide required configuration as given &amp;amp; shown below.
&lt;/li&gt;
&lt;li&gt;Integration Type — AWS Service
&lt;/li&gt;
&lt;li&gt;AWS Region — Choose the appropriate region
&lt;/li&gt;
&lt;li&gt;Execution Rolle — Choose execution role created earlier
&lt;/li&gt;
&lt;li&gt;Under “URL Path Parameters” section, add below parameters.

&lt;ol&gt;
&lt;li&gt;Name — bucket, Mapped From — method.request.path.folder
&lt;/li&gt;
&lt;li&gt;Name — key, Mapped From — method.request.path.object&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fajgptsw9yyyqyy4q7jaz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fajgptsw9yyyqyy4q7jaz.png" width="800" height="456"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Get Configuration&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let’s setup binary media type to allow file upload/download via HTTP request.
Click on “Add Binary Media Type” &amp;amp; enter “*/*”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fovsexgw5on9e1g4hex0i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fovsexgw5on9e1g4hex0i.png" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Binary Media Type&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Testing
&lt;/h4&gt;

&lt;p&gt;Now, you might be thinking so much of configuration but believe me, you will really enjoy &amp;amp; may explore other functionalities on the way which may excite you more &amp;amp; more.&lt;br&gt;&lt;br&gt;
Huuhhh, enough of configuration now, it’s time for testing :)&lt;/p&gt;

&lt;p&gt;Let’s navigate to the “Put” method which would looks something like shown below. Let’s click on “Test” link.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8okpsmtt7roldirmw7iu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8okpsmtt7roldirmw7iu.png" width="800" height="316"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Test&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Enter the required input parameters&lt;br&gt;&lt;br&gt;
{folder} — apigateways3bucket (which we have created ealier)&lt;br&gt;&lt;br&gt;
{object} — testfile (object name by which object would be created under S3 bucket)&lt;br&gt;&lt;br&gt;
Request Body — enter the saple text as file content here&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fv8h61gy8wqcaj6ulemfr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fv8h61gy8wqcaj6ulemfr.png" width="800" height="659"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Test Inputs Parameters&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Once all parameters are set, we are all set to click on “Test” button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2a8kf4bp0nzo7gpi226z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2a8kf4bp0nzo7gpi226z.png" width="678" height="911"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API Integration — Test&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, navigate to the AWS S3 dashboard &amp;amp; check the bucket. it will have the file uploaded in previous step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8hrcfthlpq5jovhbuwqu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8hrcfthlpq5jovhbuwqu.png" width="699" height="451"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS S3 — verification after upload&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hurrrrayyy, finally we were able to upload file to S3 using AWS API Gateway.&lt;/p&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;In this section, we have learned how to create an API Gateway endpoint for uploading files to Amazon S3. We have also learned how to test the endpoint. By using this approach, we can leverage the benefits of both Amazon S3 and API Gateway, such as scalability, availability, security, performance, and ease of development. We can also avoid the limitations of uploading files directly to API Gateway, such as the payload size and encoding restrictions. This way, we can create a robust and efficient solution for uploading files to the cloud.&lt;/p&gt;

&lt;p&gt;I hope you have enjoyed this tutorial and found it useful. If you have any questions or feedback, please feel free to &lt;a href="https://shethapurv.github.io/portfolio/" rel="noopener noreferrer"&gt;connect&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If this post was helpful, please clap for few times or follow to show your support which keeps me constantly motivated to share my learnings.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning, sharing &amp;amp; growing together.&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>apigateway</category>
      <category>cloud</category>
      <category>s3</category>
      <category>springboot</category>
    </item>
    <item>
      <title>AWS AppConfig With Spring Boot</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Sat, 13 Aug 2022 07:28:33 +0000</pubDate>
      <link>https://dev.to/shethapurv/aws-appconfig-with-spring-boot-209o</link>
      <guid>https://dev.to/shethapurv/aws-appconfig-with-spring-boot-209o</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Hello AWeSome techies ! Most of us would be familiarized with application configuration by one or the other way &amp;amp; that too with different set of profile depending on the environment or the technical boundaries. A configuration is a collection of settings that influence the behavior of our applications.&lt;/p&gt;

&lt;p&gt;Today, we will learn &lt;strong&gt;how to retrieve AWS AppConfig&lt;/strong&gt; using spring boot microservice.&lt;/p&gt;

&lt;p&gt;Incase you are not sure how to create, configure &amp;amp; deploy AWS AppConfig through AWS management console then I would advise you to go through &lt;a href="https://apurvsheth.medium.com/aws-appconfig-create-configure-deploy-61a13cc69167" rel="noopener noreferrer"&gt;this&lt;/a&gt; article.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tool(s)/Framework(s)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;IDE&lt;/strong&gt;  — IntelliJ Idea/Eclipse&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Language&lt;/strong&gt;  — Java 8 or above&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Framework&lt;/strong&gt;  — Spring boot&lt;br&gt;&lt;br&gt;
&lt;strong&gt;SDK&lt;/strong&gt;  — AWS SDK&lt;br&gt;&lt;br&gt;
&lt;strong&gt;AWS Services — &lt;/strong&gt; AppConfig&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Cloud Provider &lt;/strong&gt; — Amazon Web Service(AWS)&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Build Tool &lt;/strong&gt; — Maven&lt;/p&gt;
&lt;h3&gt;
  
  
  Repository
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/shethapurv/aws/tree/main/aws-app-config-service" rel="noopener noreferrer"&gt;https://github.com/shethapurv/aws/tree/main/aws-app-config-service&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Maven Dependencies
&lt;/h3&gt;

&lt;p&gt;Please refer to the maven dependency given below which is required to get config from AWS AppConfig service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;com.amazonaws&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;aws-java-sdk-appconfig&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.12.272&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Important Concepts
&lt;/h3&gt;

&lt;p&gt;Before getting into the implementation, let’s try to understand few concepts/classes &amp;amp; its significance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;aws-java-sdk-appconfig — &lt;/strong&gt; We will use this maven dependency which will help us to connect to AWS AppConfig service from our spring boot application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AmazonAppConfigClient-&lt;/strong&gt; We will use this class from AWS SDK to connect to AWS AppConfig service from our spring boot microservice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GetConfigurationRequest&lt;/strong&gt; - We will use this class to build the request to retrieve configuration from AWS AppConfig.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fj8g083ipwwf41zvjfwnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fj8g083ipwwf41zvjfwnz.png" width="363" height="181"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Spring Boot Microservices Communication with AWS AppConfig&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As we have understood the important concepts, let’s jump to the implementation.&lt;/p&gt;
&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;p&gt;We will create a AWSAppConfig class which we will use to connect to AWS AppConfig service &amp;amp; to retrieve configuration based on the environment &amp;amp; profile. Let’s have a look,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GetConfigurationRequest.application &lt;/strong&gt; — set the application id for which configuration is created.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;GetConfigurationRequest.configuration &lt;/strong&gt; — To indicate which configuration to pickup.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;GetConfigurationRequest.environment &lt;/strong&gt; — To get configuration for specific environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public AWSAppConfig() {
    appConfig = AmazonAppConfigClient._builder_().build();
    request = new GetConfigurationRequest();
    request. **setApplication** ("aws-app-config-service");
    request. **setConfiguration** ("dev");
    request. **setEnvironment** ("dev");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we will implement a method which should return us a configuration from AWS AppConfig.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AmazonAppConfigClient.getConfiguration &lt;/strong&gt; — this will get the configuration based on the configuration &amp;amp; environment set in the request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public String **getConfiguration** () throws UnsupportedEncodingException {
    GetConfigurationResult result = **appConfig.getConfiguration** (request);
    String message = String._format_("contentType: %s", result.getContentType());
    _LOGGER_.info(message);

    if (!Objects._equals_("application/json", result.getContentType())) {
        throw new IllegalStateException("config is expected to be JSON");
    }

    String content = new String(result.getContent().array(), "ASCII");
    return content;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By now, you might think, all this is fine but how to verify whether it is really fetching the configuration or not! Don’t worry, let’s verify the same in next section.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;Let’s implement an API endpoint using AWSAppConfig to retrieve configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@RestController
@RequestMapping(path = " **/aws**", method = RequestMethod._GET_)
public class AWSAppConfigController {

    @Autowired
    AWSAppConfig awsAppConfig;

    @RequestMapping(path = " **/getConfig**", method = RequestMethod._GET_)
    public String getAWSAppConfig() throws UnsupportedEncodingException {
        return **awsAppConfig.getConfiguration();**

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

&lt;/div&gt;



&lt;p&gt;Now, let’s run the application &amp;amp; hit the url localhost:8080/aws/getConfig. Ta..da.. we got the configuration from AWS AppConfig.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fe8tj4wxa9nghp3axkqyr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fe8tj4wxa9nghp3axkqyr.png" width="800" height="73"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS AppConfig — Output&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If this post was helpful, please clap for few times or follow to show your support which keeps me constantly motivated to share my learnings.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning, sharing &amp;amp; growing together.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>springframework</category>
      <category>springboot</category>
      <category>microservices</category>
    </item>
    <item>
      <title>AWS AppConfig — Create, Configure &amp; Deploy</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Sat, 13 Aug 2022 07:19:52 +0000</pubDate>
      <link>https://dev.to/shethapurv/aws-appconfig-create-configure-deploy-43a</link>
      <guid>https://dev.to/shethapurv/aws-appconfig-create-configure-deploy-43a</guid>
      <description>&lt;h3&gt;
  
  
  AWS AppConfig — Create, Configure &amp;amp; Deploy
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Hello AWeSome techies ! Most of us would be familiarized with application configuration by one or the other way &amp;amp; that too with different set of profile depending on the environment or the technical boundaries. A configuration is a collection of settings that influence the behavior of our applications.&lt;/p&gt;

&lt;p&gt;Today, we will learn &lt;strong&gt;how to configure AWS AppConfig&lt;/strong&gt; from AWS management console.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Login to the AWS Management console &amp;amp; navigate to AppConfig Service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fpq0horuzk754k4wgji5b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fpq0horuzk754k4wgji5b.png" width="800" height="264"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS System Manager — AppConfig service&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on “Create application” button. Enter the application details &amp;amp; click again on “Create application” button.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fquow7w5k8jlvncke13m1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fquow7w5k8jlvncke13m1.png" width="800" height="610"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AppConfig — Create Application&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the “Configuration Profile and Feature Flags” tab under application created in previous step &amp;amp; click on create.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fw9ry1ahige7411ktmejc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fw9ry1ahige7411ktmejc.png" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Choose appropriate configuration profile type. Here, we will choose “Freeform Configuraion” &amp;amp; click on “Select”.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqg1ll0m2wpnvlfjp8yx1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqg1ll0m2wpnvlfjp8yx1.png" width="606" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter “ &lt;strong&gt;Build Freeform configuration profile”&lt;/strong&gt; details &amp;amp; choose “AWS AppConfig hosted configuration”.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8apk2l8uibysk45l1k0q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8apk2l8uibysk45l1k0q.png" width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, choose “JSON” &amp;amp; enter configs in the given text area in json format.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fwzn907ioxc7vpdaaav9l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwzn907ioxc7vpdaaav9l.png" width="800" height="631"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the “Environments” tab &amp;amp; click on “Create environment”&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqlv87bb3a8zlw6l8edhm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqlv87bb3a8zlw6l8edhm.png" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter appropriate name of the environment. For Ex: Dev, SIT, UAT/Test, Prod &amp;amp; likewise.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ftu3vr4tyw3hbxnukb4v4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ftu3vr4tyw3hbxnukb4v4.png" width="800" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once environment is created, then we are all set to start the deployment to make our configuration available.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fwdpq2asb0pncuuzneoio.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwdpq2asb0pncuuzneoio.png" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For &lt;strong&gt;Configuration&lt;/strong&gt; , choose a configuration from the list.
&lt;/li&gt;
&lt;li&gt;Depending on the source of your configuration, use the &lt;strong&gt;Document version&lt;/strong&gt; or &lt;strong&gt;Parameter version&lt;/strong&gt; list to choose the version you want to deploy.
&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;Deployment strategy&lt;/strong&gt; , choose a strategy from the list.
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Start deployment&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Please don’t forget to delete all this AWS resources without fail once you have completed this exercise.&lt;/p&gt;

&lt;h3&gt;
  
  
  Next Steps
&lt;/h3&gt;

&lt;p&gt;You must be surprising, thinking that all this is fine but then how to access this config as a part of your application !&lt;/p&gt;

&lt;p&gt;Don’t worry, you can refer to this article on how to access AWS AppConfig from Spring Boot microservices.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>spring</category>
      <category>configurationmanagem</category>
      <category>amazonwebservices</category>
    </item>
    <item>
      <title>Spring Framework - Handling Prototype Scoped Beans</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Wed, 10 Aug 2022 17:15:03 +0000</pubDate>
      <link>https://dev.to/shethapurv/spring-framework-handling-prototype-scoped-beans-12f</link>
      <guid>https://dev.to/shethapurv/spring-framework-handling-prototype-scoped-beans-12f</guid>
      <description>&lt;h3&gt;
  
  
  Spring Framework - Handling Prototype Scoped Beans
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Whenever we are creating a bean using &lt;a href="http://twitter.com/Service" rel="noopener noreferrer"&gt;@Service&lt;/a&gt;, &lt;a href="http://twitter.com/Component" rel="noopener noreferrer"&gt;@Component&lt;/a&gt;, or any other similar annotations, we are creating a recipe for creating an instance of a class. Along with this recipe, we can also define the scope of that respective instance. It can be any of these, singleton, prototype, session, request, or global session.&lt;/p&gt;

&lt;p&gt;Most of us are already familiar with these bean scopes. But today, we are going to understand whether the prototype scope is creating multiple instances or is being treated as a singleton.&lt;/p&gt;

&lt;p&gt;So, let’s start with a summary of singleton &amp;amp; prototype scoped beans. After which, we will go through the issue which may cause the prototype to be singleton &amp;amp; its possible solutions.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub Repo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/shethapurv/spring-boot/tree/main/lookup-scope-service" rel="noopener noreferrer"&gt;https://github.com/shethapurv/spring-boot/tree/main/lookup-scope-service&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Basics
&lt;/h3&gt;

&lt;p&gt;Let’s define two different service classes named EmployeeService &amp;amp; Department Service. EmployeeService would be singleton scoped &amp;amp; DepartmentService would be of prototype scoped.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Service
**@Scope("prototype")** // prototype scoped
public class **DepartmentService** {
    private Integer departmentId = new Random().nextInt(1000);

    public int getDepartmentId(){
        return departmentId;
    }
}

**@Service** // by default, singleton scoped
public class **EmployeeService** {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, Let’s write a test case and compare the hashcode of each service bean defined above.&lt;/p&gt;

&lt;p&gt;Multiple instances of &lt;strong&gt;singleton scoped bean&lt;/strong&gt; “EmployeeService” will have the same hashcode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Test
public void singletonTest() {
    EmployeeService employeeService1 = applicationContext.getBean("employeeService", EmployeeService.class);
    EmployeeService employeeService2 = applicationContext.getBean("employeeService", EmployeeService.class);
    **Assertions._assertEquals_** (employeeService1.hashCode(), employeeService2.hashCode());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Multiple instance of &lt;strong&gt;prototype scoped bean&lt;/strong&gt; “DepartmentService” will have different hashcode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Test
public void prototypeTest() {
    DepartmentService departmentService1 = applicationContext.getBean("departmentService", DepartmentService.class);
    DepartmentService departmentService2 = applicationContext.getBean("departmentService", DepartmentService.class);
    **Assertions._assertNotEquals_(**departmentService1.hashCode(), departmentService2.hashCode());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yea, so far so good. Test results are very much as expected. isn’t it !&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem
&lt;/h3&gt;

&lt;p&gt;So, here is the problem. Whenever we will inject a prototype scoped bean within a singleton scoped bean, the prototype scoped bean will start behaving as a singleton bean.&lt;/p&gt;

&lt;p&gt;Let’s try to understand with a simple example.&lt;/p&gt;

&lt;p&gt;If you have observed above in DepartmentService bean, “departmentId” class variable is declared which will return a random integer as department id. Now, whenever, we will try to get departmetnId then it should return two different department Id since DepartmentService is a prototype scoped bean but in reality, it will return only the same departmentId.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@RestController
@RequestMapping(path = "/beanScope", method = RequestMethod._GET_)
public class **BeanScopeController** {

    @Autowired
    EmployeeService employeeService;

    @RequestMapping(path = "/prototypeTreatedAsSingleton", method = RequestMethod._GET_)
    public List&amp;lt;Integer&amp;gt; getDepartmentIdWithDeptTreatedAsSingleton() throws InterruptedException {
        return employeeService.getDepartmentIdWithDeptTreatedAsSingleton();
    }
}

// **EmployeeService**

// it will be treated as singleton even though its prototype scoped @Autowired 
DepartmentService **departmentService** ;

public List&amp;lt;Integer&amp;gt; getDepartmentIdWithDeptTreatedAsSingleton() throws InterruptedException {
    **int dep1 = departmentService.getDepartmentId();**
    Thread._sleep_(1000L);
    **int dep2 = departmentService.getDepartmentId();**
    return List._of_(dep1, dep2);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.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%2F1eopgt2sawki2ojhxcdt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F1eopgt2sawki2ojhxcdt.png" width="800" height="63"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we are clear about the problem explained above, now, let’s try to see the different approaches to get away from this issue.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;To treat prototype scoped bean as really it is supposed to be. We have 3 different approaches instead of auto-wiring prototype scoped bean.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Using ApplicationContext
&lt;/h3&gt;

&lt;p&gt;We can use application context to get the prototype scoped bean object. But here, we are violating the principle of inversion of control. We are creating an object instead of a spring container creating an object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Autowired
ApplicationContext **applicationContext** ;

public List&amp;lt;Integer&amp;gt; getDepartmentIdWithApplicationContext() throws InterruptedException {
    int dep1 = **applicationContext.getBean** (DepartmentService.class).getDepartmentId();
    Thread._sleep_(1000L);
    int dep2 = **applicationContext.getBean** (DepartmentService.class).getDepartmentId();
    return List._of_(dep1, dep2);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Using ObjectFactory
&lt;/h3&gt;

&lt;p&gt;We can use object factory instantiation to get a prototype scoped bean but the problem with this approach is, instances will be eagerly initialized.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Autowired
private ObjectFactory&amp;lt;DepartmentService&amp;gt; **departmentServiceObjectFactory** ;

public List&amp;lt;Integer&amp;gt; getDepartmentIdWithObjectFactory() throws InterruptedException {
    int dep1 = **departmentServiceObjectFactory.getObject** ().getDepartmentId();
    Thread._sleep_(1000L);
    int dep2 = **departmentServiceObjectFactory.getObject** ().getDepartmentId();
    return List._of_(dep1, dep2);

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Using @LookUp Annotation
&lt;/h3&gt;

&lt;p&gt;We can use &lt;a href="http://twitter.com/LookUp" rel="noopener noreferrer"&gt;@LookUp&lt;/a&gt; annotation provided by spring. this will help to resolve the inversion of control issue which we faced in option 1 since the spring container itself will take care of instance creation. And, it will also not be eagerly initialized as we saw in option 2.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public List&amp;lt;Integer&amp;gt; getDepartmentIdWithLookUp() throws InterruptedException {
    int dep1 = **getDepartmentService** ().getDepartmentId();
    Thread._sleep_(1000L);
    int dep2 = **getDepartmentService** ().getDepartmentId();
    return List._of_(dep1, dep2);

}

@ **Lookup**
public DepartmentService **getDepartmentService** () {
    return null;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We have gone through the problem which might occur with the prototype scoped bean if it is not handled correctly. We have also seen the different approaches to resolving those issues.&lt;/p&gt;

&lt;p&gt;It is advisable to use &lt;a href="http://twitter.com/LookUp" rel="noopener noreferrer"&gt;@LookUp&lt;/a&gt; annotation to handle the prototype scoped bean which doesn’t violate the spring IoC principle and beans are also not eagerly initialized.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.spring.io/spring-framework/docs/3.0.0.M3/reference/html/ch04s04.html" rel="noopener noreferrer"&gt;4.4 Bean scopes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Lookup.html" rel="noopener noreferrer"&gt;Lookup (Spring Framework 5.3.22 API)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;If this post was helpful, please clap for few times or follow to show your support which keeps me constantly motivated to share my learnings.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning, sharing &amp;amp; growing together.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>spring</category>
      <category>springboot</category>
      <category>java</category>
      <category>springframework</category>
    </item>
    <item>
      <title>Serverless GraphQL — AWS AppSync, Lambda, Spring Boot</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Fri, 10 Jun 2022 01:03:21 +0000</pubDate>
      <link>https://dev.to/shethapurv/serverless-graphql-aws-appsync-lambda-spring-boot-2ci0</link>
      <guid>https://dev.to/shethapurv/serverless-graphql-aws-appsync-lambda-spring-boot-2ci0</guid>
      <description>&lt;h3&gt;
  
  
  Serverless GraphQL - AWS AppSync, Lambda, Spring Boot
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://apurvsheth.medium.com/spring-boot-serverless-aws-lambda-with-api-gateway-258f48b7f22f" rel="noopener noreferrer"&gt;this&lt;/a&gt; &amp;amp; &lt;a href="https://faun.pub/serverless-with-spring-boot-aws-lambda-bc76c1de2b12" rel="noopener noreferrer"&gt;this&lt;/a&gt; article, we have seen how we can implement the standalone AWS Lambda function and its integration via AWS API Gateway. In case you have not gone through those previous articles then I would strongly recommend going through those articles first.&lt;/p&gt;

&lt;p&gt;If you are not familiar with GraphQL concepts then I would request going through &lt;a href="https://apurvsheth.medium.com/how-to-implement-graphql-using-netflixs-dgs-framework-spring-boot-schema-first-approach-32ba701fe8de" rel="noopener noreferrer"&gt;this&lt;/a&gt; &amp;amp; &lt;a href="https://apurvsheth.medium.com/graphql-using-spring-boot-code-first-approach-623ba69a5f04" rel="noopener noreferrer"&gt;this&lt;/a&gt; article.&lt;/p&gt;

&lt;p&gt;Leveraging our learning from the past, we will learn how we can create GraphQL API using the AWS AppSync service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tools/Frameworks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;IDE&lt;/strong&gt;  — IntelliJ Idea/Eclipse&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Language&lt;/strong&gt;  — Java 8 or above&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Framework&lt;/strong&gt;  — Spring boot&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Build Tool&lt;/strong&gt;  — Maven&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Cloud Provider&lt;/strong&gt;  — AWS&lt;br&gt;&lt;br&gt;
&lt;strong&gt;AWS Services&lt;/strong&gt;  — AppSync &amp;amp; Lambda&lt;/p&gt;
&lt;h3&gt;
  
  
  Goal
&lt;/h3&gt;

&lt;p&gt;OK, so let's discuss now what we are trying to achieve. Please refer to the high-level design below.&lt;/p&gt;

&lt;p&gt;We will create AppSync GraphQL API which will invoke the lambda function backed by the spring boot cloud function &amp;amp; return a response.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ftgonruyhnlswri8884uj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ftgonruyhnlswri8884uj.png" width="465" height="388"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;High Level Design — AWS AppSync/Lambda&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Sample Application
&lt;/h3&gt;

&lt;p&gt;Let's assume that we have a sample application (don’t worry! you can refer to the git repository at the end of this article) deployed as a part of the AWS lambda function. Here is the “User” model&lt;/p&gt;

&lt;p&gt;→ &lt;strong&gt;Model&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

    private String name;
    private Integer id;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;→ &lt;strong&gt;Functional API&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will use the “getAllUsers” function to be called as a part of lambda which will return the List&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqr7lxaz252sn67yws132.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqr7lxaz252sn67yws132.png" width="555" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this basic implementation, let's go ahead &amp;amp; create AppSync GraphQL API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create — AWS AppSync GraphQL API
&lt;/h3&gt;

&lt;p&gt;As we have the application background ready, let's jump on how to create/configure AWS AppSync GraphQL API.&lt;/p&gt;

&lt;p&gt;→ Log in to the AWS management console. Search &amp;amp; navigate to the AppSync service.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F9vkfqp0sdzr0aq07nhf1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F9vkfqp0sdzr0aq07nhf1.png" width="800" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;→ Click on the “Create API” button &amp;amp; choose the “Build from scratch” option.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbbx9pf4n1vayreiyj27e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbbx9pf4n1vayreiyj27e.png" width="800" height="119"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5rul0y934l17q6mdxwta.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5rul0y934l17q6mdxwta.jpeg" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;→ Next, let's give our API the name “UserAppSyncApp” &amp;amp; click on create that will create AWS AppSync GraphQL API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Foqapjxjg2w7ksbktvwst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Foqapjxjg2w7ksbktvwst.png" width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure
&lt;/h3&gt;

&lt;p&gt;Now, let's concentrate on the configuration part.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;→&lt;/strong&gt; Let’s navigate to the API which we have created &amp;amp; configure types/schema based on the model for which we want to perform GraphQL &lt;strong&gt;query/mutation&lt;/strong&gt; operation. Here, we can see that the “User” type is in line with the model of the lambda function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fdhjigah64w3mcj80y3ky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fdhjigah64w3mcj80y3ky.png" width="800" height="414"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS AppSync — Schema&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Mutation {
    addUser(id: ID!, name: String): User!
}

type Query {
    getUser(id: ID!): User
    getAllUsers: [User]
}

type User {
    id: ID!
    name: String
}

schema {
    query: Query
    mutation: Mutation
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You might think that schema is created then it should start working, right? But, actually no, it will not work. why? because we have not integrated our lambda function as a data source to our AppSync API.&lt;/p&gt;

&lt;p&gt;So, now let's configure the AWS Lambda function as a data source for our newly created “UserAppSyncApp” AppSync API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;→&lt;/strong&gt; Navigate to the data source &amp;amp; let’s attache our lambda function.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data source name — Enter any meaningful name for the data source&lt;/li&gt;
&lt;li&gt;Data source type — Choose “AWS Lambda function”&lt;/li&gt;
&lt;li&gt;Region — Choose the region to which the lambda function belongs.&lt;/li&gt;
&lt;li&gt;Function ARN — Choose the function which you want to bind to the AppSync API&lt;/li&gt;
&lt;li&gt;Create or use an existing role — Use the appropriate existing role if you have already one else create a new one.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fjiuan4y3nd7791qjxk5b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fjiuan4y3nd7791qjxk5b.png" width="800" height="446"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS AppSync — Data Source Configuration&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;As we have almost all configurations in place, let’s verify.&lt;/p&gt;

&lt;p&gt;→ Navigate to the “Queries” section where you can see all the queries which we have configurated as a part of schema configuration. Click on the play button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbux20v0eevi8tly1lej5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbux20v0eevi8tly1lej5.png" width="800" height="345"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS AppSync — Queries&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;→ Let's see the result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fe8p2nu52ud0js7tajn0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fe8p2nu52ud0js7tajn0y.png" width="800" height="263"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS AppSync — Testing&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yey, we have successfully implemented AWS AppSync GraphQL API using AWS Lambda as a data source.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If this post was helpful, please clap for few times or follow to show your support.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning, sharing &amp;amp; growing together.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Git Repository
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/shethapurv/aws/tree/main/awslambda-appsync-example" rel="noopener noreferrer"&gt;https://github.com/shethapurv/aws/tree/main/awslambda-appsync-example&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/appsync/latest/devguide/what-is-appsync.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/appsync/latest/devguide/what-is-appsync.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://graphql.org/learn/schema/" rel="noopener noreferrer"&gt;Schemas and Types&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>spring</category>
      <category>aws</category>
    </item>
    <item>
      <title>Spring Boot — Reactive Web</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Fri, 27 May 2022 17:55:47 +0000</pubDate>
      <link>https://dev.to/shethapurv/spring-boot-reactive-web-1dj8</link>
      <guid>https://dev.to/shethapurv/spring-boot-reactive-web-1dj8</guid>
      <description>&lt;h3&gt;
  
  
  Spring Boot — Reactive Web
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://apurvsheth.medium.com/h2-in-memory-database-with-spring-boot-1295f3302c93" rel="noopener noreferrer"&gt;this&lt;/a&gt; article, we learned how to use Spring Data &lt;strong&gt;JDBC&lt;/strong&gt; connectivity.&lt;/p&gt;

&lt;p&gt;Today, we will learn to build an application that uses Spring Data &lt;strong&gt;R2DBC&lt;/strong&gt; to store and retrieve data in a relational database using *&lt;em&gt;reactive database *&lt;/em&gt; drivers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tools/Frameworks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;IDE&lt;/strong&gt;  — IntelliJ Idea/Eclipse&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Language&lt;/strong&gt;  — Java 8 or above&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Framework&lt;/strong&gt;  — Spring boot, Project Reactor&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Database&lt;/strong&gt;  — H2&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Build Tool&lt;/strong&gt;  — Maven&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Concept(s)
&lt;/h3&gt;

&lt;p&gt;The heart of the project reactor is &lt;strong&gt;reactive-core&lt;/strong&gt;. The main focus is on the Reactive Streams spec and targets Java 8 streams.&lt;/p&gt;

&lt;p&gt;Project reactor introduced reactive types Flux &amp;amp; Mono that implement Publisher.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flux&lt;/strong&gt;  — It represents an asynchronous sequence of zero or more objects&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mono&lt;/strong&gt; —It represents asynchronous single or empty objects&lt;/p&gt;

&lt;p&gt;The image given below very well describes the flux transformation very well. Please refer to the reference link at the end of the article for further readings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fnce719rcth6ilsbqn02s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnce719rcth6ilsbqn02s.png" width="800" height="351"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Flux Transformation from projectreactor.io&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Since we have gone through the basic concepts, let's jump on the implementation without having any delay.&lt;/p&gt;

&lt;h3&gt;
  
  
  Maven Dependency
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fzo4yu3ql04a46zpfiex7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fzo4yu3ql04a46zpfiex7.png" width="644" height="491"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Reactor — Maven Dependency&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration
&lt;/h3&gt;

&lt;p&gt;First. let’s go through the configuration. As you have noticed, we have used the r2dbc configuration &amp;amp; the URL is prefixed with r2dbc but not with JDBC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2ron04jj4zfnaf6bfh9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2ron04jj4zfnaf6bfh9b.png" width="392" height="137"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;R2DBC Configuration&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;p&gt;Now, let’s have a look at the implementation. To have a reactive nature, we will implement ReactiveCrudRepository as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fx6694wntu4bchnrm5x48.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fx6694wntu4bchnrm5x48.png" width="800" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our service class, we will return the Flux/Mono depending on our functionality.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fzcoe40mb3te1s3azx60e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fzcoe40mb3te1s3azx60e.png" width="689" height="448"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Example — Flux/Mono Service&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In our API resources also, we will return flux/mono as a response as shown below. However, the point to note down here is, that we need to set the “produces” media type as “MediaType.&lt;em&gt;TEXT_EVENT_STREAM_VALUE&lt;/em&gt;”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fnb9rjftcx9kz7azn4rfh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnb9rjftcx9kz7azn4rfh.png" width="800" height="370"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;API/RestController with TEXT_EVENT_STREAM_VALUE media type&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Huh, you might think, enough concepts &amp;amp; implementation but does it really work! Of course, it does, :) Let's go ahead &amp;amp; test.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;I’m not sure if you have observed earlier, that I have kept a delay of 5 seconds before emitting the next objects so that we can verify that it's non-blocking asynchronous emitting of objects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AEIokGH0dfAwB2ueUXE_ztg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AEIokGH0dfAwB2ueUXE_ztg.gif" width="1024" height="1024"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Testing&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yey, we have successfully implemented spring boot reactive web flux &amp;amp; verified the same.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If this post was helpful, please clap for few times or follow to show your support.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Git Repo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/shethapurv/spring-boot/tree/main/spring-reactive-flux-example" rel="noopener noreferrer"&gt;spring-boot/spring-reactive-flux-example at main · shethapurv/spring-boot&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://spring.io/reactive" rel="noopener noreferrer"&gt;Project Reactor and the Spring portfolio work together to enable developers to build enterprise-grade reactive systems that are responsive, resilient, elastic, and message-driven.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://projectreactor.io/" rel="noopener noreferrer"&gt;https://projectreactor.io/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://projectreactor.io/docs/core/release/reference/#intro-reactive" rel="noopener noreferrer"&gt;Reactor 3 Reference Guide&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vmware</category>
      <category>java</category>
      <category>spring</category>
      <category>springframe</category>
    </item>
    <item>
      <title>Spring Boot — Serverless AWS Lambda With API Gateway</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Sun, 15 May 2022 02:08:37 +0000</pubDate>
      <link>https://dev.to/shethapurv/spring-boot-serverless-aws-lambda-with-api-gateway-2mj9</link>
      <guid>https://dev.to/shethapurv/spring-boot-serverless-aws-lambda-with-api-gateway-2mj9</guid>
      <description>&lt;h3&gt;
  
  
  Spring Boot — Serverless AWS Lambda With API Gateway
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In &lt;a href="https://faun.pub/serverless-with-spring-boot-aws-lambda-bc76c1de2b12" rel="noopener noreferrer"&gt;this&lt;/a&gt; article, we have learned how to configure &amp;amp; implement the AWS lambda function with a stand-alone java event.&lt;/p&gt;

&lt;p&gt;Today, we will learn how to configure &amp;amp; implement the lambda function &amp;amp; trigger it using AWS API Gateway with a &lt;strong&gt;practical example.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Tool(s)/Framework(s)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;IDE&lt;/strong&gt;  — IntelliJ Idea/Eclipse&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Language&lt;/strong&gt;  — Java 8 or above&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Framework&lt;/strong&gt;  — Spring boot&lt;br&gt;&lt;br&gt;
&lt;strong&gt;SDK&lt;/strong&gt;  — AWS SDK&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Cloud Provider &lt;/strong&gt; — Amazon Web Service(AWS)&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Build Tool &lt;/strong&gt; — Maven&lt;/p&gt;

&lt;h3&gt;
  
  
  Git Repository
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/shethapurv/aws/tree/main/awslambda-apigateway-example" rel="noopener noreferrer"&gt;aws/awslambda-apigateway-example at main · shethapurv/aws&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Maven Dependency
&lt;/h3&gt;

&lt;p&gt;Please refer to the maven dependency given below which is required for the spring boot cloud function to work on AWS Lambda.&lt;/p&gt;

&lt;p&gt;Here, if you have observed, we don’t need maven dependency for Spring Cloud Function Web adapter since AWS doesn't require it at runtime hence we can exclude that dependency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Feohso4sdgizrxx9d41o6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Feohso4sdgizrxx9d41o6.png" width="796" height="469"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Maven Dependency&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Maven Build
&lt;/h3&gt;

&lt;p&gt;To deploy our spring boot microservice on AWS Lambda, it has to be &lt;strong&gt;shaded&lt;/strong&gt; which will generate two separate jar files,&lt;/p&gt;

&lt;p&gt;— one jar which ends with “-aws” is to be deployed on AWS Lambda &amp;amp;&lt;/p&gt;

&lt;p&gt;— another jar that will have the spring cloud function web dependency&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fn8gy8fvfxm7stozdgmfx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fn8gy8fvfxm7stozdgmfx.png" width="800" height="802"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fh57lf7dysqsc163ujx95.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh57lf7dysqsc163ujx95.png" width="428" height="249"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Maven Build — Generated Artifacts&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;p&gt;You might be thinking that it's all theory but how the implementation would look like &amp;amp; naturally, we start thinking that how we can pass the input params or get the response while triggering the lambda function via AWS API Gateway.&lt;/p&gt;

&lt;p&gt;But it is really very simple than what we might have thought of.&lt;/p&gt;

&lt;p&gt;Let's go through the classes listed below which are important to understand first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;APIGatewayProxyRequestEvent&lt;/strong&gt;  — If we will drill down a little bit to see this class, we can clearly say that we can get all the request params/variables from the instance of this class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fercsh0rpntuj1kmjc2u9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fercsh0rpntuj1kmjc2u9.png" width="800" height="333"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Spring boot — AWS APIGatewayProxyRequestEvent&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;APIGatewayProxyResponseEvent — &lt;/strong&gt; this will hold the response &amp;amp; its status code details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F65q02nixopsovh95b6i6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F65q02nixopsovh95b6i6.png" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we have understood the importance of the request/response wrapper around AWS API Gateway, Let’s look at the handler. we will implement the spring boot request handler which will work as a wrapper &amp;amp; will hold the request &amp;amp; response-related attributes &amp;amp;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fmmdn6fp5rw923l6hq6zf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmmdn6fp5rw923l6hq6zf.png" width="800" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we will have to implement our functional bean “welcome” to accept &lt;strong&gt;APIGatewayProxyRequestEvent&lt;/strong&gt; as a function’s target.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F6o6to0apnj3xpeb2meq9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F6o6to0apnj3xpeb2meq9.png" width="800" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly, if we can use &lt;strong&gt;APIGatewayProxyResponseEvent&lt;/strong&gt; to get the response &amp;amp; any other important attributes like HTTP status code.&lt;/p&gt;

&lt;p&gt;Very cool &amp;amp; easy stuff it was than we thought of, isn’t it? Let’s move to deployment now.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;p&gt;Here, we will concentrate on how to set up AWS API Gateway &amp;amp; will skip the initial AWS Lambda function setup steps since we have learned the same in &lt;a href="https://faun.pub/serverless-with-spring-boot-aws-lambda-bc76c1de2b12" rel="noopener noreferrer"&gt;this&lt;/a&gt; article. so let’s start,&lt;/p&gt;

&lt;p&gt;→ Navigate to the function created &amp;amp; click on “Add trigger” &amp;amp; choose “Trigger configuration” as “API Gateway”&lt;/p&gt;

&lt;p&gt;→ Choose “Create an API” for the lambda function which we created &amp;amp; choose “HTTP API” as API Type keeping security as “Open” &amp;amp; click on “Add”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fb9b3heg8k1jj9mskqfz8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fb9b3heg8k1jj9mskqfz8.png" width="800" height="730"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS API Gateway — setup&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;→ Once, the trigger event is added as an “API Gateway”, the AWS Lambda function would look like this,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fqqbdhadw860h0omf5020.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fqqbdhadw860h0omf5020.png" width="800" height="282"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda Function With API Gateway&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;Now, the question comes that all this is fine but how I can trigger the function &amp;amp; how about the request/response.&lt;/p&gt;

&lt;p&gt;→ let's get the &lt;strong&gt;API Gateway URL&lt;/strong&gt; first. Click &amp;amp; navigate to the “API Gateway” which will give us the API endpoint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fg97xqv2ptojhv19626pa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fg97xqv2ptojhv19626pa.png" width="800" height="102"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS API Gateway — URL&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;→ Copy this URL &amp;amp; access it with the request parameter “userName” which we have configured as part of our functional bean “welcome”.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Ex:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://bdq0e9rc58.execute-api.us-east-1.amazonaws.com/default/HelloWorldFunction" rel="noopener noreferrer"&gt;https://bdq0e9rc58.execute-api.us-east-1.amazonaws.com/default/HelloWorldFunction&lt;/a&gt; &lt;strong&gt;?userName=Apurv&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fonsnzc6sy4rlpebek2fa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fonsnzc6sy4rlpebek2fa.png" width="800" height="154"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS API Gateway — URL Access From Browser&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hurreeeyyy … !!&lt;/p&gt;

&lt;p&gt;Isn’t it easy &amp;amp; very straightforward? of course, it is.&lt;/p&gt;

&lt;p&gt;If I can, anyone &amp;amp; everyone can !&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.spring.io/spring-cloud-function/docs/current/reference/html/aws.html" rel="noopener noreferrer"&gt;https://docs.spring.io/spring-cloud-function/docs/current/reference/html/aws.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>functional</category>
      <category>springframework</category>
      <category>java</category>
    </item>
    <item>
      <title>Serverless With Spring Boot &amp; AWS Lambda</title>
      <dc:creator>Apurv</dc:creator>
      <pubDate>Wed, 11 May 2022 17:04:10 +0000</pubDate>
      <link>https://dev.to/shethapurv/serverless-with-spring-boot-aws-lambda-5dh5</link>
      <guid>https://dev.to/shethapurv/serverless-with-spring-boot-aws-lambda-5dh5</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In the previous article, we learned how to implement &lt;a href="https://apurvsheth.medium.com/java-functional-interface-67c27a4cbf79" rel="noopener noreferrer"&gt;java's functional interface&lt;/a&gt;&amp;amp; &lt;a href="https://apurvsheth.medium.com/serverless-with-spring-f65cbb8bea51" rel="noopener noreferrer"&gt;serverless with spring.&lt;/a&gt; Utilizing this knowledge, we will learn how to build our spring boot microservice application compliant with serverless AWS Lambda.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tool(s)/Framework(s)
&lt;/h3&gt;

&lt;p&gt;Editor — IntelliJ Idea/Eclipse&lt;br&gt;&lt;br&gt;
Language — Java 8 or above&lt;br&gt;&lt;br&gt;
Framework — Spring boot&lt;br&gt;&lt;br&gt;
Cloud Provider — Amazon Web Service(AWS)&lt;br&gt;&lt;br&gt;
Build Tool — Maven&lt;/p&gt;
&lt;h3&gt;
  
  
  GIT Repo -
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/shethapurv/aws/tree/main/serverless-aws-lambda-service" rel="noopener noreferrer"&gt;https://github.com/shethapurv/aws/tree/main/serverless-aws-lambda-service&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Maven Dependency
&lt;/h3&gt;

&lt;p&gt;Please refer to the maven dependency given below which is required for the spring boot cloud function to work on AWS Lambda.&lt;/p&gt;

&lt;p&gt;Here, if you have observed, we don't need maven dependency for Spring Cloud Function Web adapter since it's not required by AWS at runtime hence we can exclude that dependency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fvt5e9yzqr8b1o5e2zw7a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fvt5e9yzqr8b1o5e2zw7a.png" width="796" height="469"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Maven Dependency — AWS Lambda&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Maven Build&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To deploy our spring boot microservice on AWS Lambda, it has to be &lt;strong&gt;shaded&lt;/strong&gt; which will generate two separate jar files,&lt;/p&gt;

&lt;p&gt;— one jar which ends with “-aws” is to be deployed on AWS Lambda &amp;amp;&lt;/p&gt;

&lt;p&gt;— another jar that will have the spring cloud function web dependency&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2hn33mowk1f5zob9qp58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2hn33mowk1f5zob9qp58.png" width="800" height="802"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F39vay51lmii1jc399t25.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F39vay51lmii1jc399t25.png" width="344" height="266"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Maven Shaded Build Plugin — generating two jars&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;p&gt;So now, the question comes of how spring boot interprets the response datatype from the AWS Lambda function. For this purpose, AWS has platform-specific data types which is much more efficient than processing each one individually. so, to make use of these types, there are two choices,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write a function that depends on those AWS types&lt;/li&gt;
&lt;li&gt;Rely on Spring to extract the data from the AWS types and convert it to a Spring Message and convert it to a Spring “Message”.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here, we will write a handler as shown below. which we will use while setting up AWS lambda function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**public class** HelloWorldHandler **extends SpringBootRequestHandler** &amp;lt;String, Object&amp;gt; {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;p&gt;After understanding the basic concepts, let’s jump into deploying the jar on AWS lambda.&lt;/p&gt;

&lt;p&gt;→ Login to AWS console. Search &amp;amp; navigate to Lambda service.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fem1774e632v301alpf43.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fem1774e632v301alpf43.png" width="800" height="381"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS — Search Lambda Service&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;→ Once we are on the Lambda service, locate the “Create function” button to create the AWS Lambda function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fbjc6ln9tj8kz4zreudif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fbjc6ln9tj8kz4zreudif.png" width="800" height="67"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;→ Next, we will see the function creation page where we need to configure a few parameters as shown below &amp;amp; then click on “Create function” button.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Choose the “Author From Scratch” option to create the function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter the appropriate function name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;choose runtime as java 8 or java 11 as appropriate.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fyjz1a3hxpl5atbd6wgcj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fyjz1a3hxpl5atbd6wgcj.png" width="800" height="339"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda — Create Function&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;→ As the function is created now, let's upload the spring-boot jar by clicking on the “upload from” button which will ask us to choose the jar file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fkh8rq555v0z0vhmu049k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fkh8rq555v0z0vhmu049k.png" width="800" height="357"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda — Upload JAR&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;→ Once the jar is uploaded, Let’s edit the runtime setting under the “Code” tab to configure the handler as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fiswtqcugscz5eieo07n5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fiswtqcugscz5eieo07n5.png" width="800" height="286"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda — Runtime Settings-1&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fa7163wu8e4lm7nucizyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fa7163wu8e4lm7nucizyv.png" width="800" height="599"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda — Runtime Settings-2&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;→ Now, let’s configure the function name in the “Configuration” tab under “Environment variables” as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fh5o1krc3u2h8jh4bc9an.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh5o1krc3u2h8jh4bc9an.png" width="800" height="485"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda — Environment variables&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now, we are all set to test our first Lambda function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;Yey guys, so are you excited to test our first lambda function after having the adventurous implementation! Let's try it out :)&lt;/p&gt;

&lt;p&gt;Let’s navigate to the “Test” tab, enter the required parameter under the “Event JSON” text area &amp;amp; click on “Test”.&lt;/p&gt;

&lt;p&gt;We can see below(green area) that our AWS Lambda function test was successful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F8dgq1e1ew7ox3vd6vzsx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F8dgq1e1ew7ox3vd6vzsx.png" width="800" height="402"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda — Test&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If we further expand the “Details” link further, we can see that message is being displayed as per the input provided.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fkqjyebbovukugeqd97xx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fkqjyebbovukugeqd97xx.png" width="800" height="380"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;AWS Lambda — Test Details&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hope this post will be useful for many of us.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Takeaways
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Dependency — Maven dependencies required for AWS Lambda function to work&lt;/li&gt;
&lt;li&gt;Build — maven build changes required to make our application AWS Lambda compliant.&lt;/li&gt;
&lt;li&gt;Request handler — Spring boot &amp;amp; AWS Lambda request handler to handle the responses.&lt;/li&gt;
&lt;li&gt;Test — how we can test the AWS Lambda function.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://docs.spring.io/spring-cloud-function/docs/current/reference/html/aws.html" rel="noopener noreferrer"&gt;https://docs.spring.io/spring-cloud-function/docs/current/reference/html/aws.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://faun.to/bP1m5" rel="noopener noreferrer"&gt;&lt;img src="https://media2.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%2Fbzi0r02eivk83doqraz0.png" width="800" height="107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Join FAUN: &lt;a href="https://faun.to/i9Pt9" rel="noopener noreferrer"&gt;&lt;strong&gt;Website&lt;/strong&gt;&lt;/a&gt; 💻 &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://faun.dev/podcast" rel="noopener noreferrer"&gt;&lt;strong&gt;Podcast&lt;/strong&gt;&lt;/a&gt; 🎙️ &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://twitter.com/joinfaun" rel="noopener noreferrer"&gt;&lt;strong&gt;Twitter&lt;/strong&gt;&lt;/a&gt; 🐦 &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://www.facebook.com/faun.dev/" rel="noopener noreferrer"&gt;&lt;strong&gt;Facebook&lt;/strong&gt;&lt;/a&gt; 👥 &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://instagram.com/fauncommunity/" rel="noopener noreferrer"&gt;&lt;strong&gt;Instagram&lt;/strong&gt;&lt;/a&gt; 📷|&lt;a href="https://www.facebook.com/groups/364904580892967/" rel="noopener noreferrer"&gt;&lt;strong&gt;Facebook Group&lt;/strong&gt;&lt;/a&gt; 🗣️ &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://www.linkedin.com/company/faundev" rel="noopener noreferrer"&gt;&lt;strong&gt;Linkedin Group&lt;/strong&gt;&lt;/a&gt; 💬 &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://faun.dev/chat" rel="noopener noreferrer"&gt;&lt;strong&gt;Slack&lt;/strong&gt;&lt;/a&gt; 📱 &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://thechief.io" rel="noopener noreferrer"&gt;&lt;strong&gt;Cloud Native&lt;/strong&gt;  &lt;strong&gt;News&lt;/strong&gt;&lt;/a&gt; ** ** 📰 &lt;strong&gt;|&lt;/strong&gt; &lt;a href="https://linktr.ee/faun.dev/" rel="noopener noreferrer"&gt;&lt;strong&gt;More&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>cloud</category>
      <category>functional</category>
      <category>java</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
