<?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: Vijay Panwar</title>
    <description>The latest articles on DEV Community by Vijay Panwar (@vijayk512).</description>
    <link>https://dev.to/vijayk512</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%2F1251865%2F86f48987-d65d-46c2-8488-21682acb1553.jpeg</url>
      <title>DEV Community: Vijay Panwar</title>
      <link>https://dev.to/vijayk512</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vijayk512"/>
    <language>en</language>
    <item>
      <title>Amazon AWS API Gateway and creating, publishing, maintaining, monitoring, and securing APIs at any scale.</title>
      <dc:creator>Vijay Panwar</dc:creator>
      <pubDate>Mon, 05 Feb 2024 18:00:22 +0000</pubDate>
      <link>https://dev.to/vijayk512/amazon-aws-api-gateway-and-creating-publishing-maintaining-monitoring-and-securing-apis-at-any-scale-32od</link>
      <guid>https://dev.to/vijayk512/amazon-aws-api-gateway-and-creating-publishing-maintaining-monitoring-and-securing-apis-at-any-scale-32od</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;APIs (Application Programming Interfaces) serve as the backbone of modern software applications, enabling seamless integration and communication between different systems and services. As the digital landscape evolves, managing these APIs efficiently becomes crucial for businesses aiming to provide scalable, secure, and highly available services. AWS API Gateway emerges as a leading solution in this domain, offering a robust platform for creating, publishing, maintaining, monitoring, and securing APIs at any scale.&lt;/p&gt;

&lt;p&gt;This blog post delves into the significance of AWS API Gateway, highlighting its benefits, providing a practical example of its application, and comparing its efficiency with traditional API management solutions. By the end, you'll understand why AWS API Gateway is an indispensable tool for developers and businesses seeking to optimize their API-driven projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is AWS API Gateway?
&lt;/h3&gt;

&lt;p&gt;AWS API Gateway is a fully managed service that makes it easier for developers to create, publish, maintain, monitor, and secure APIs at any scale. It acts as a front-door for applications to access data, business logic, or functionality from backend services, such as workloads running on AWS Lambda, Amazon Elastic Compute Cloud (EC2), or any web application.&lt;/p&gt;

&lt;p&gt;Core features of AWS API Gateway include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;API Lifecycle Management&lt;/strong&gt;: Tools to create, deploy, and manage APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traffic Management&lt;/strong&gt;: Abilities to handle spikes in traffic, including throttling requests to prevent overloading backend services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authorization and Access Control&lt;/strong&gt;: Integration with AWS Identity and Access Management (IAM) and Amazon Cognito for authenticating and authorizing API requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring and Analytics&lt;/strong&gt;: Integration with Amazon CloudWatch to monitor API usage and performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance at Scale&lt;/strong&gt;: Ability to scale automatically based on the incoming traffic volume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer Portal&lt;/strong&gt;: An optional feature that allows developers to publish their APIs for external developers to discover and use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Integrating seamlessly with other AWS services, API Gateway provides a powerful tool for building a serverless architecture, enabling developers to focus on their core product instead of managing infrastructure.&lt;/p&gt;

&lt;p&gt;In the next sections, we'll explore the benefits of using AWS API Gateway, showcase a practical implementation example, and compare its efficiency with other API management solutions.&lt;/p&gt;

&lt;p&gt;Continuing from where we left off, let's delve into the benefits of using AWS API Gateway and follow up with a practical example.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of Using AWS API Gateway
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Simplified API Development
&lt;/h4&gt;

&lt;p&gt;AWS API Gateway simplifies the process of API development by providing a user-friendly interface and a set of tools that streamline the creation, deployment, and management of APIs. Developers can define APIs directly in the AWS Management Console, create new resources and methods, and set up integration responses without dealing with complex code. This significantly reduces the time and effort required to bring an API from concept to production.&lt;/p&gt;

&lt;h4&gt;
  
  
  Performance at Scale
&lt;/h4&gt;

&lt;p&gt;One of the critical advantages of AWS API Gateway is its ability to handle API requests at scale. It automatically scales in response to incoming traffic, ensuring that the API remains responsive and available, even during unexpected spikes in demand. This elasticity eliminates the need for developers to provision or manage infrastructure, allowing them to focus on building their applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  Security Features
&lt;/h4&gt;

&lt;p&gt;Security is a paramount concern for any API, and AWS API Gateway provides robust security features to protect your APIs. It supports native OIDC and OAuth 2.0 authorization and integrates with AWS Identity and Access Management (IAM) for fine-grained access control. Additionally, API Gateway offers mechanisms to protect against common threats such as DDoS attacks, including AWS WAF integration for customizable web application firewall rules.&lt;/p&gt;

&lt;h4&gt;
  
  
  Monitoring and Analytics
&lt;/h4&gt;

&lt;p&gt;AWS API Gateway integrates seamlessly with Amazon CloudWatch, giving developers comprehensive insights into API performance and usage metrics. This integration allows for real-time monitoring of API calls, latency, and error rates, enabling teams to quickly identify and address issues. CloudWatch also supports setting alarms and automated actions based on specific metrics, enhancing the ability to maintain high API performance standards.&lt;/p&gt;

&lt;h4&gt;
  
  
  Cost-Effectiveness
&lt;/h4&gt;

&lt;p&gt;With a pay-as-you-go pricing model, AWS API Gateway allows businesses to manage costs effectively. There are no upfront fees or required ongoing commitments. Charges are based on the number of API calls received and the amount of data transferred out. This model enables businesses of all sizes to start small and scale their usage as their applications grow, without facing substantial initial investments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practical Example of Using AWS API Gateway
&lt;/h3&gt;

&lt;p&gt;Let's walk through a simple example of setting up a RESTful API using AWS API Gateway that integrates with AWS Lambda to create a serverless backend.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a Lambda Function&lt;/strong&gt;: Begin by creating an AWS Lambda function in the AWS Management Console. This function will serve as the backend for your API, processing the requests it receives. For this example, assume the Lambda function is written in Python and returns a simple message.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Set Up API Gateway&lt;/strong&gt;: Navigate to the AWS API Gateway section in the AWS Management Console and create a new API. Select the 'REST API' option and configure the new API by naming it and setting up the endpoint type as either regional, edge-optimized, or private, depending on your needs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Define Resources and Methods&lt;/strong&gt;: Create a new resource within your API, such as &lt;code&gt;/message&lt;/code&gt;, and define a GET method for this resource. Configure the method to integrate with your Lambda function, allowing the API Gateway to trigger the function whenever the GET method is called.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deploy API&lt;/strong&gt;: Once your API is configured, deploy it to a new or existing stage. Stages in API Gateway allow you to manage different versions of your API, such as development, testing, and production environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Test Your API&lt;/strong&gt;: After deployment, use the Invoke URL provided by API Gateway to test your API. Accessing this URL with the appropriate method (in this case, a GET request to &lt;code&gt;/message&lt;/code&gt;) should trigger your Lambda function and return the expected response.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This example demonstrates the simplicity and power of AWS API Gateway in creating and deploying scalable, serverless APIs without managing servers or infrastructure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comparative Efficiency Analysis
&lt;/h3&gt;

&lt;p&gt;Comparing AWS API Gateway with traditional API management solutions highlights several efficiency gains, particularly in scalability, security, and cost.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;: Traditional solutions often require manual scaling of infrastructure, which can lead to over-provisioning or bottlenecks during unexpected traffic spikes. AWS API Gateway's automatic scaling eliminates these concerns, ensuring efficient resource utilization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;: Implementing comprehensive security measures in traditional systems can be complex and time-consuming. AWS API Gateway's built-in security features and integrations provide robust protection out of the box, reducing the burden on developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost&lt;/strong&gt;: The upfront and ongoing costs associated with traditional API management (e.g., hardware, software licenses, maintenance) can be significant. AWS API Gateway's pay-as-you-go model offers a cost-effective alternative, allowing organizations to pay only for what they use.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;AWS API Gateway stands out as a highly efficient, scalable, and secure solution for API management. Its integration with AWS services, combined with features like automatic scaling, robust security, and detailed monitoring, make it an attractive option for businesses looking to streamline their API development and management processes. By leveraging AWS API Gateway, organizations can accelerate their API deployments, reduce costs, and focus on creating value-added features for their users, rather than worrying about the underlying infrastructure.&lt;/p&gt;

&lt;p&gt;Whether you're building new applications or optimizing existing ones, AWS API Gateway provides the tools and features necessary to support your API initiatives at any scale. Its efficiency, coupled with AWS's ecosystem, makes it a compelling choice for developers and businesses aiming to lead in the digital transformation era.&lt;/p&gt;

&lt;p&gt;This exploration of AWS API Gateway's benefits, practical application, and efficiency compared to traditional solutions underscores why it is a preferred choice for modern API management. As APIs continue to play a critical role in software development and digital strategy, AWS API Gateway offers a path to managing them more effectively, securely, and at scale.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>network</category>
      <category>api</category>
      <category>devops</category>
    </item>
    <item>
      <title>Unlocking the Power of SQL Server: The Importance of Stored Procedures for Complex Queries</title>
      <dc:creator>Vijay Panwar</dc:creator>
      <pubDate>Sun, 04 Feb 2024 16:55:58 +0000</pubDate>
      <link>https://dev.to/vijayk512/unlocking-the-power-of-sql-server-the-importance-of-stored-procedures-for-complex-queries-3j15</link>
      <guid>https://dev.to/vijayk512/unlocking-the-power-of-sql-server-the-importance-of-stored-procedures-for-complex-queries-3j15</guid>
      <description>&lt;p&gt;Introduction:&lt;br&gt;
In the realm of database management, SQL Server stands as a stalwart guardian of data integrity and accessibility. As the complexity of queries grows, the significance of leveraging stored procedures becomes paramount. This article delves into the importance of using stored procedures in SQL Server, elucidating their benefits through real-world examples.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Enhanced Performance:&lt;/strong&gt;
Stored procedures compile and optimize execution plans, resulting in faster query execution. This efficiency is particularly crucial when dealing with intricate SQL queries that involve multiple joins, subqueries, or complex filtering conditions. Consider the difference in performance between a complex ad-hoc query and its equivalent stored procedure.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Ad-hoc Query&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TotalAmount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Equivalent Stored Procedure&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;PROCEDURE&lt;/span&gt; &lt;span class="n"&gt;GetHighValueOrders&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
    &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CustomerID&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TotalAmount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Code Reusability and Maintainability:&lt;/strong&gt;
Stored procedures encapsulate SQL logic, promoting code reusability. When dealing with complex queries used across multiple parts of an application, a stored procedure acts as a centralized repository. Any modifications or updates to the query are applied in one location, ensuring consistency and ease of maintenance.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Ad-hoc Query&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderTotal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;AvgOrderTotal&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;OrderDate&lt;/span&gt; &lt;span class="k"&gt;BETWEEN&lt;/span&gt; &lt;span class="s1"&gt;'2023-01-01'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="s1"&gt;'2023-12-31'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Equivalent Stored Procedure&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;PROCEDURE&lt;/span&gt; &lt;span class="n"&gt;GetAverageOrderTotal&lt;/span&gt;
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;StartDate&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;EndDate&lt;/span&gt; &lt;span class="nb"&gt;DATE&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;OrderTotal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;AvgOrderTotal&lt;/span&gt;
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt;
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;OrderDate&lt;/span&gt; &lt;span class="k"&gt;BETWEEN&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;StartDate&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;EndDate&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Security and Access Control:&lt;/strong&gt;
Stored procedures allow for fine-grained control over database access. By granting execution permissions solely on stored procedures, sensitive data is shielded from direct access. This is especially crucial for intricate queries dealing with confidential or regulated information.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Granting Permissions for Ad-hoc Query&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Orders&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;ApplicationUser&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Granting Permissions for Stored Procedure&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;EXECUTE&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;GetHighValueOrders&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;ApplicationUser&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Parameterized Queries:&lt;/strong&gt;
Stored procedures facilitate the use of parameterized queries, promoting flexibility and preventing SQL injection attacks. This is imperative when dealing with complex queries that require dynamic filtering based on user input or application requirements.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Ad-hoc Query susceptible to SQL Injection&lt;/span&gt;
&lt;span class="k"&gt;EXEC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SELECT * FROM Users WHERE UserName = &lt;/span&gt;&lt;span class="se"&gt;''&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;InputUserName&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="se"&gt;''&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;-- Parameterized Stored Procedure&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;PROCEDURE&lt;/span&gt; &lt;span class="n"&gt;GetUserByUsername&lt;/span&gt;
    &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;InputUserName&lt;/span&gt; &lt;span class="n"&gt;NVARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;UserName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;InputUserName&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conclusion:&lt;br&gt;
In the realm of SQL Server, the utilization of stored procedures for complex queries emerges not only as a best practice but as a fundamental strategy for optimizing performance, ensuring code maintainability, fortifying security, and promoting parameterized queries. As the data landscape continues to evolve, embracing the power of stored procedures becomes a key element in the arsenal of database administrators and developers alike.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>sqlserver</category>
      <category>database</category>
      <category>performance</category>
    </item>
    <item>
      <title>Streamlining AWS API Gateway with Network Load Balancer using CloudFormation</title>
      <dc:creator>Vijay Panwar</dc:creator>
      <pubDate>Sat, 03 Feb 2024 19:15:23 +0000</pubDate>
      <link>https://dev.to/vijayk512/streamlining-aws-api-gateway-with-network-load-balancer-using-cloudformation-4aeg</link>
      <guid>https://dev.to/vijayk512/streamlining-aws-api-gateway-with-network-load-balancer-using-cloudformation-4aeg</guid>
      <description>&lt;p&gt;Introduction:&lt;/p&gt;

&lt;p&gt;AWS CloudFormation is a powerful tool that enables users to automate the provisioning and management of AWS infrastructure. In this blog post, we will explore how to set up an AWS API Gateway with a Network Load Balancer (NLB) using CloudFormation. This configuration is particularly useful when you want to distribute incoming API traffic across multiple Amazon EC2 instances for improved availability and fault tolerance.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;p&gt;AWS Account: Ensure you have an active AWS account with the necessary permissions to create resources using CloudFormation.&lt;/p&gt;

&lt;p&gt;Basic Understanding: Familiarity with AWS services such as API Gateway, EC2, NLB, and CloudFormation is beneficial.&lt;/p&gt;

&lt;p&gt;CloudFormation Template:&lt;/p&gt;

&lt;p&gt;Let's start by creating a CloudFormation template that defines the resources required for our setup. Save the following code in a file named &lt;strong&gt;'apigateway_nlb_cf_template.yaml'&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;AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  VPCId:
    Type: String
    Description: VPC ID where resources will be created
Resources:
  NLB:
    Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
    Properties:
      Name: MyNLB
      Subnets:
        - SubnetId1
        - SubnetId2
      Scheme: internet-facing
  TargetGroup:
    Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
    Properties:
      Name: MyTargetGroup
      Port: 80
      Protocol: HTTP
      VpcId: !Ref VPCId
  APIGateway:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Name: MyAPIGateway
  Integration:
    Type: 'AWS::ApiGateway::Integration'
    Properties:
      IntegrationHttpMethod: POST
      IntegrationType: HTTP_PROXY
      IntegrationUri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunctionArn}/invocations
      RestApiId: !Ref APIGateway
      ResourceId: !GetAtt APIGateway.RootResourceId
      Credentials: "arn:aws:iam::xxxxxxxxxxxx:role/apigateway-lambda-role"
  ApiMethod:
    Type: 'AWS::ApiGateway::Method'
    Properties:
      AuthorizationType: NONE
      HttpMethod: POST
      ResourceId: !GetAtt APIGateway.RootResourceId
      RestApiId: !Ref APIGateway
      Integration:
        IntegrationHttpMethod: POST
        Type: AWS_PROXY
        Uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunctionArn}/invocations
      MethodResponses:
        - StatusCode: 200
  ApiGatewayNLBIntegration:
    Type: 'AWS::ApiGateway::Integration'
    Properties:
      IntegrationHttpMethod: ANY
      IntegrationType: HTTP
      IntegrationUri: !Sub "http://${NLB.DNSName}"
      RestApiId: !Ref APIGateway
      ResourceId: !GetAtt APIGateway.RootResourceId
Outputs:
  ApiGatewayURL:
    Description: URL of the API Gateway
    Value: !Sub "https://${APIGateway}.execute-api.${AWS::Region}.amazonaws.com"

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

&lt;/div&gt;



&lt;p&gt;This CloudFormation template defines an NLB, a target group, an API Gateway, and an integration between the API Gateway and the NLB.&lt;/p&gt;

&lt;p&gt;Explanation of the template:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NLB&lt;/strong&gt;: Defines the Network Load Balancer.&lt;br&gt;
&lt;strong&gt;TargetGroup&lt;/strong&gt;: Specifies the target group for the NLB.&lt;br&gt;
&lt;strong&gt;APIGateway&lt;/strong&gt;: Sets up the API Gateway.&lt;br&gt;
&lt;strong&gt;Integration&lt;/strong&gt;: Configures the integration between API Gateway and the NLB.&lt;br&gt;
&lt;strong&gt;ApiMethod&lt;/strong&gt;: Defines the API Gateway method (POST in this case).&lt;br&gt;
&lt;strong&gt;ApiGatewayNLBIntegration&lt;/strong&gt;: Establishes the integration between API Gateway and NLB.&lt;br&gt;
Make sure to replace placeholders like &lt;strong&gt;'SubnetId1'&lt;/strong&gt;, &lt;strong&gt;'SubnetId2'&lt;/strong&gt;, &lt;strong&gt;'LambdaFunctionArn'&lt;/strong&gt;, and &lt;strong&gt;'xxxxxxxxxxxx'&lt;/strong&gt; with actual values specific to your setup.&lt;/p&gt;

&lt;p&gt;Deploy the CloudFormation Stack:&lt;/p&gt;

&lt;p&gt;Now that we have our CloudFormation template, let's deploy it using the AWS Management Console or the AWS Command Line Interface (CLI).&lt;/p&gt;

&lt;p&gt;Using AWS CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws cloudformation create-stack --stack-name MyApiGatewayNLBStack --template-body file://apigateway_nlb_cf_template.yaml --parameters ParameterKey=VPCId,ParameterValue=vpc-xxxxxxxx

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

&lt;/div&gt;



&lt;p&gt;Replace &lt;strong&gt;'vpc-xxxxxxxx'&lt;/strong&gt; with your VPC ID.&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;/p&gt;

&lt;p&gt;By leveraging AWS CloudFormation, you can easily set up an API Gateway integrated with a Network Load Balancer. This architecture ensures a scalable and fault-tolerant solution for handling incoming API traffic. Feel free to customize the template to suit your specific requirements and extend the setup based on your application's needs. Happy coding!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>network</category>
      <category>api</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
