<?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: Durga Prasad Katrapally</title>
    <description>The latest articles on DEV Community by Durga Prasad Katrapally (@durga533).</description>
    <link>https://dev.to/durga533</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%2F457612%2F37eb4892-a127-4fc8-ae8f-8c9ba7ed0a3f.png</url>
      <title>DEV Community: Durga Prasad Katrapally</title>
      <link>https://dev.to/durga533</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/durga533"/>
    <language>en</language>
    <item>
      <title>Security best practices on AWS </title>
      <dc:creator>Durga Prasad Katrapally</dc:creator>
      <pubDate>Mon, 14 Sep 2020 12:34:23 +0000</pubDate>
      <link>https://dev.to/durga533/security-best-practices-on-aws-4b1k</link>
      <guid>https://dev.to/durga533/security-best-practices-on-aws-4b1k</guid>
      <description>&lt;p&gt;Security is real key thing in any environment and especially on Cloud.In this post I want to put few things that are really essential ( bare minimum ) to keep your AWS environment secure. &lt;/p&gt;

&lt;h3&gt;
  
  
  Root Access:
&lt;/h3&gt;

&lt;p&gt;Always limit root access only to user creation and billing. It should not be used to create any resources or to perform any other operations on resources. &lt;/p&gt;

&lt;p&gt;Implement MFA for root and all users. This will ensure that even if credentials are leaked the other form of authentication is still needed. &lt;/p&gt;

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

&lt;h3&gt;
  
  
  Principle of least privilege:
&lt;/h3&gt;

&lt;p&gt;Any resource/role/user should never be given elevated access privileges than required. Always ensure only the required permissions only are granted not more. This will limit the blast radius just in case if there is a compromise in any credentials for any users. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5uDK401i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/keh54i374j9dpuh0udd0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5uDK401i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/keh54i374j9dpuh0udd0.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Roles
&lt;/h3&gt;

&lt;p&gt;Always try to use roles where ever possible as roles get temporary tokens to get to a service and they can be revoked if needed. &lt;/p&gt;

&lt;h6&gt;
  
  
  Services : IAM , Roles
&lt;/h6&gt;

&lt;h3&gt;
  
  
  Log everything:
&lt;/h3&gt;

&lt;p&gt;Always log all API calls on all accounts. Use Cloud trail to log all logs to central security account or other and encrypt the logs to implement data integrity. &lt;/p&gt;

&lt;p&gt;Logs provide key information in case of any security incident and play a key role in planning risk mitigation. So having all logs in a central location with only limited authorized access ( preferably read only ) will really help in getting to the core of security incident. &lt;/p&gt;

&lt;h6&gt;
  
  
  Services in AWS : Cloud Trail and S3
&lt;/h6&gt;

&lt;h3&gt;
  
  
  Encryption:
&lt;/h3&gt;

&lt;p&gt;It is always best practice to have encryption at rest with all the sensitive data in cloud. AWS has several options depending on where you store the data. &lt;/p&gt;

&lt;h6&gt;
  
  
  Services : KMS , Cloud HSM , Own keys
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nlxR8IEy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gk12wm85e482t9jvtoes.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nlxR8IEy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gk12wm85e482t9jvtoes.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Record changes:
&lt;/h3&gt;

&lt;p&gt;It is always recommended to have a record of all changes that happen in any environment.  AWS has Config service that allows to assess, audit, and evaluate the configurations of your AWS resources. &lt;/p&gt;

&lt;p&gt;AWS config integrates with Cloud watch where cloud based event rules can be configured to notify any changes.  &lt;/p&gt;

&lt;h6&gt;
  
  
  Services : AWS Config , Cloud watch, SNS
&lt;/h6&gt;

&lt;h3&gt;
  
  
  Automate security responses:
&lt;/h3&gt;

&lt;p&gt;The challenge with security compromise is that there is no time on when a security event occurs. Always find ways to automate the security response so the risk of a compromise can be limited. &lt;/p&gt;

&lt;p&gt;Use services such as Cloud watch events to trigger event based actions to Lambda so that as soon as something unexpected happens the response is all automated &lt;/p&gt;

&lt;h6&gt;
  
  
  Services : Cloud watch, Lambda, SNS
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IlsaP98P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8rls72xtfxyrb4qvdeva.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IlsaP98P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8rls72xtfxyrb4qvdeva.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Patch regularly:
&lt;/h3&gt;

&lt;p&gt;While there are many managed services on AWS, if your setup has any of the EC2 instances it is always advised to have all of them patched regularly. AWS handles security of the Hypervisor NOT the OS that you use. Understanding this is key in having secure environment for EC2.&lt;/p&gt;

&lt;p&gt;Services such as AWS inspector will really help to getting the vulnerability reports for EC2 and AWS patch manager can be leveraged to automate patch cycles. &lt;/p&gt;

&lt;h6&gt;
  
  
  Services : Patch manager, AWS Inspector
&lt;/h6&gt;

&lt;h3&gt;
  
  
  Other key security products:
&lt;/h3&gt;

&lt;h6&gt;
  
  
  ACM , AWS Guard duty, AWS shield , AWS WAF are few of the other products for protection against Layer 3/4 and 7 attacks.
&lt;/h6&gt;

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

&lt;p&gt;Security is really vast topic and there are many things that still need to implemented depending on where a given environment stands. These are just minimal things that are needed to keep things secure at a very high level. &lt;/p&gt;

&lt;p&gt;It is highly recommended to check the AWS security white paper which covers in depth on all aspects. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>security</category>
    </item>
    <item>
      <title>Top 5 reasons to consider cloud storage as an alternative to traditional on premise storage</title>
      <dc:creator>Durga Prasad Katrapally</dc:creator>
      <pubDate>Tue, 08 Sep 2020 11:42:04 +0000</pubDate>
      <link>https://dev.to/durga533/top-5-reasons-to-consider-cloud-storage-as-an-alternative-to-traditional-on-premise-storage-1p87</link>
      <guid>https://dev.to/durga533/top-5-reasons-to-consider-cloud-storage-as-an-alternative-to-traditional-on-premise-storage-1p87</guid>
      <description>&lt;p&gt;Storage is the most the valued component in Infrastructure and often companies end up spending lot for deploying and maintaining on-prem storage.&lt;/p&gt;

&lt;p&gt;There are other over heads of maintaining RPO/RTO on storage, patching etc when leveraging on-prem storage.&lt;/p&gt;

&lt;p&gt;With cloud emerging so fast and rapid, there are many key offerings on Cloud that would drive any organization to use cloud. Here are the top 5:&lt;/p&gt;

&lt;p&gt;Costs: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QC1Aq6BR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7yjzq2fqpqydhyt0oivo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QC1Aq6BR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7yjzq2fqpqydhyt0oivo.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cloud storage is cheap compared to on-prem. The costs including maintenance, power are the direct savings that any organization would benefit. On top of this, all cloud service offer pay per use model which allow organization to pay only to what they use.&lt;/p&gt;

&lt;p&gt;Organizations can also leverage cloud as a “ Disaster Recovery” strategy where they can move/replicate their production data loads for DR purposes. This strategy is much cheaper compared to having an exact DR strategy on another on premises Data Center.&lt;/p&gt;

&lt;p&gt;Scalability:&lt;/p&gt;

&lt;p&gt;One of the pain points of Data Center based storage solutions exists in the fact that scaling the existing storage. Storage projections may or may not match the actual usage. Sometimes companies end up spending more thinking of “buffer” for future. Cloud provides great scalability where organizations do not need to worry on data growth patterns.&lt;/p&gt;

&lt;p&gt;Durability:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XHAO_kaZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zo8g000bc0llbo89j3a0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XHAO_kaZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zo8g000bc0llbo89j3a0.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cloud providers in general offer a great level of durability on the data that is stored in cloud. AWS for that matter offers 99.99999999999 ( 11 9’s ) durability which means that there is a chance of losing one file in roughly 659000 years.&lt;/p&gt;

&lt;p&gt;Ease of access:&lt;/p&gt;

&lt;p&gt;One of the greatest advantages of the having data on cloud is ease of access, with a simple internet connection and proper authentication/authorization one can access data from anywhere. ( There are certain intricacies on how data on cloud is managed like how/who/what can access data and how to securely access storage which I’m not touching here. Security is broader topic and any component on cloud should be tightly coupled with proper security to avoid data going to wrong hands. )&lt;/p&gt;

&lt;p&gt;Storage independence:&lt;/p&gt;

&lt;p&gt;On traditional Data center based storage, there are always conversation on a given make/model/vendor is not supported after sometime and there has to be a move to a better model, this is continuous process. This is always pain process. With Cloud, organizations need not worry on who is the storage vendor/what model and when will their end of life approach as this will be the responsibility of Cloud provider. This is very big leverage for any organization which allow them to focus on how to organize their data, how to use that data.&lt;/p&gt;

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

&lt;p&gt;In conclusion there are many aspects that drive any organization to move to cloud storage. The points discussed above are some of the key areas with are most beneficial to any organization. However, there are certain aspects like Compliance, Data Management, Security and Bandwidth limitations which are the anti patterns to cloud. One has to balance every aspect and make a move to use cloud storage to get the most out of it.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>storage</category>
      <category>cost</category>
    </item>
    <item>
      <title>How did I re-architect my web application to serve dynamic forms serverless</title>
      <dc:creator>Durga Prasad Katrapally</dc:creator>
      <pubDate>Mon, 31 Aug 2020 13:06:43 +0000</pubDate>
      <link>https://dev.to/durga533/how-did-i-re-architect-my-web-application-to-serve-dynamic-forms-serverless-epl</link>
      <guid>https://dev.to/durga533/how-did-i-re-architect-my-web-application-to-serve-dynamic-forms-serverless-epl</guid>
      <description>&lt;p&gt;This use case is useful for the "contact us" or " feedback" section for most of the websites. Instead of having the entire website running on web server and supporting DB, the proposed architecture really helps to have the same functionality without having to manage any servers.&lt;/p&gt;

&lt;p&gt;I want to touch on how I changed existing setup for my Web application that typically had my web portfolio on it. Web site has fairly static content and only a form data that was more of dynamic in nature which when someone contacts will push the contact form data to database.&lt;/p&gt;

&lt;p&gt;This is the current architecture:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tExybsqy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/21qsp85wnii0abzdt8y2.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tExybsqy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/21qsp85wnii0abzdt8y2.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This has two problems:&lt;/p&gt;

&lt;p&gt;Even though the contents are all static except form data , this need to go on a server as we need to handle the form data. My web portfolio:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5MYUyy2v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvolou1myydci86niu14.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5MYUyy2v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvolou1myydci86niu14.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u2gQ0JCZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/73x3uynk2cfbhocl72s0.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u2gQ0JCZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/73x3uynk2cfbhocl72s0.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The server is always up and running, we end up paying the cost for the server even if it is serving only static content or limited form data.&lt;/p&gt;

&lt;p&gt;Solution:&lt;/p&gt;

&lt;p&gt;If there is only form data that needs to be handled, the above solution can be changed as below and still have same functionality but without server. Proposed architecture :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qLfw8jlt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i0c08edmofw7wmzhccy2.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qLfw8jlt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i0c08edmofw7wmzhccy2.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The solution is achieved through following steps:&lt;/p&gt;

&lt;p&gt;Host the static content from S3.&lt;br&gt;
Create an API gateway&lt;br&gt;
Create Lambda that would get the form data from API gateway ( json data)&lt;br&gt;
Use the json data and send an email or&lt;br&gt;
Push the json data to Dynamo DB.&lt;br&gt;
Implementation:&lt;/p&gt;

&lt;p&gt;In this implementation I would dwell on points 1 to 4 since implementing 5 is fairly similar as that of sending SES.&lt;/p&gt;

&lt;p&gt;Hosting static website on S3. This is straight forward, the documentation from AWS is very clear on how you can host. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html"&gt;https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Only call out here is I had to adjust my contact page HTML to embed with the following java-script to handle the form data and send it to the API gateway. SendtoAPI is the function that actually triggers when send button is clicked on web page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sendToAPI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;API Gateway URL here &amp;gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;subject&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;subject&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Please Fill All Required Field&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;email&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;subject&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;body&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;

    &lt;span class="p"&gt;};&lt;/span&gt;


    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;xmlhttp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;XMLHttpRequest&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;xmlhttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;API Gateway URL here &amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;xmlhttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setRequestHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;xmlhttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="nx"&gt;xmlhttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onreadystatechange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xmlhttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;readyState&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xmlhttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;responseText&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;xmlhttp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;successful&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;contact-form&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;h1&amp;gt;Thank you for your message &amp;lt;br&amp;gt; I will get back to you soon!&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;failed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;contact-form&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;reset&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

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



&lt;p&gt;Contact page html :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="col-md-7"&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
    &amp;lt;input name="email" type="email" class="form-control" id="email" placeholder="Email"&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
    &amp;lt;input name="subject" type="text" class="form-control" id="subject" placeholder="Subject"&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
    &amp;lt;textarea name="textmessage" class="form-control" rows="5" " id="body" placeholder="Enter your message"&amp;gt;&amp;lt;/textarea&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;button type="submit" onClick​="sendToAPI(event)" class="btn btn-default btn-lg"&amp;gt;Send&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;

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



&lt;ol&gt;
&lt;li&gt;Creating Lambda function:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This Lambda will run on nodejs runtime. Be sure to verify your email on SES, otherwise this will throw error for email verification.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var AWS = require('aws-sdk');
var ses = new AWS.SES();

var RECEIVER = 'email@address';
var SENDER = 'email@address';


var response = {
 "isBase64Encoded": false,
 "headers": { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'},
 "statusCode": 200,
 "body": "{\"result\": \"Success.\"}"
 };


exports.handler = function (event, context) {
    console.log('Received event:', event);
    sendEmail(event, function (err, data) {
        context.done(err, null);
    });
};

function sendEmail (event, done) {
    var params = {
        Destination: {
            ToAddresses: [
                RECEIVER
            ]
        },
        Message: {
            Body: {
                Text: {
                    Data: 'email ' + event.email + '\n subject ' + event.subject+ '\n body ' + event.body ,
                    Charset: 'UTF-8'
                }
            },
            Subject: {
                Data: 'Someone contacted you on your contact form ' + event.name,
                Charset: 'UTF-8'
            }
        },
        Source: SENDER
    };
    ses.sendEmail(params, done);

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



&lt;ol&gt;
&lt;li&gt;API Gateway:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;API and Lambda go hand in hand. Integrating API gateway to trigger lambda is key for any serverless implementation. Be sure to enable CORS on API gateway otherwise the data cannot be reached to API gateway and Deploy your API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dAa2C2oP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fb389euh7b9b2j4b5vwn.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dAa2C2oP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fb389euh7b9b2j4b5vwn.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Integrating everything:&lt;/p&gt;

&lt;p&gt;If everything is setup in a right way, when we put some content in the contact page , the contents will be passed to API gateway which will trigger Lambda and which will in turn send email all the contents to the email verified.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tQ-oRnAF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q62nq62yva9xssuxzd1m.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tQ-oRnAF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q62nq62yva9xssuxzd1m.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we click send, it should return us another HTML page and send the same contents to our email.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HSZSdje4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bjgwebbvyzm0a75icd4s.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HSZSdje4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bjgwebbvyzm0a75icd4s.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Email:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_sU-5q6V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n50t78pe51vvbwxo39a9.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_sU-5q6V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n50t78pe51vvbwxo39a9.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similar flow can be redirected to have the contents posted to DynamoDB at the back if there is need to store the details. But we have everything now running full managed and serverless.&lt;/p&gt;

&lt;p&gt;GitHub link:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/durga533/serverless"&gt;https://github.com/durga533/serverless&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/blogs/architecture/create-dynamic-contact-forms-for-s3-static-websites-using-aws-lambda-amazon-api-gateway-and-amazon-ses/"&gt;https://aws.amazon.com/blogs/architecture/create-dynamic-contact-forms-for-s3-static-websites-using-aws-lambda-amazon-api-gateway-and-amazon-ses/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>lambda</category>
      <category>s3</category>
    </item>
    <item>
      <title>My Experience with AWS Elastic Beanstalk and python</title>
      <dc:creator>Durga Prasad Katrapally</dc:creator>
      <pubDate>Wed, 26 Aug 2020 12:01:50 +0000</pubDate>
      <link>https://dev.to/durga533/my-experience-with-aws-elastic-beanstalk-and-python-20ph</link>
      <guid>https://dev.to/durga533/my-experience-with-aws-elastic-beanstalk-and-python-20ph</guid>
      <description>&lt;p&gt;I’m not from programming but wanted to start my learning with Python ! I recently purchased a Udemy course for Python for my personal learning and that had a project to build Web based portfolio. It also showed on how to host your Web portfolio using pythonanywhere.com. ( For those of you who do not what is Pythonanywhere.com, it is place to host your python application , you can actually host one application for free !!! That’s what I did on my Web portfolio ).&lt;/p&gt;

&lt;p&gt;It was all fine and happy !!! Check the link below for Web portfolio:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://durga533.pythonanywhere.com/"&gt;http://durga533.pythonanywhere.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’m avid lover of AWS and like the range of offerings it has .. So, I wanted to have my Web portfolio hosted on AWS to enhance my learning with Python and AWS. The straight option for me was to use AWS Beanstalk. This is a managed service which provides Platform as Service and you can run your code on small to medium work loads without worrying about the underlying Infrastructure.&lt;/p&gt;

&lt;p&gt;Launching sample applications on beanstalk was very straight forward and the results are almost instantaneous ! But there are certain twists on actual code implementation. My code was getting uploading without any issue and application was showing healthy yet my end point URL was not reachable.&lt;/p&gt;

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

&lt;p&gt;I got internal 505 errors, after a lot search on Web ( thanks Google and stackoverflow ) it was due to my application code.&lt;/p&gt;

&lt;p&gt;There are two things that I did to keep this working.&lt;/p&gt;

&lt;p&gt;First , Elastic beanstalk expects a file called “ application” on the top level of the your directory. If it does not finds one it would throw error like what I got. This is what I did. I renamed my previous server.py to application.py&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3DrfE1Xh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7sau85wojq1bg0np821r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3DrfE1Xh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7sau85wojq1bg0np821r.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Secondly, the story does not end here, I tried after renaming but still saw the error. I had to my variable for Flask from app to application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--P-yakTom--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/013dp16orxglb90cnrjq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P-yakTom--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/013dp16orxglb90cnrjq.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These two changes helped me to finally launch the my Website on AWS. Tadaaa !!!!!!! Happy me !!!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o-4H1Zt7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9zkbbtlt4tr9ir4eqk4k.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o-4H1Zt7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9zkbbtlt4tr9ir4eqk4k.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My Learning and conclusion:&lt;/p&gt;

&lt;p&gt;Not every code that we see can be implemented as-is, every platform has its own dependencies that we should satisfy to host. Launching a sample application for learning gives us confidence but launching something in real world throws lot of challenges and great learning !!!!!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>elasticbeanstalk</category>
      <category>elb</category>
    </item>
  </channel>
</rss>
