<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AWS Archives - Michael Soriano</title>
	<atom:link href="https://michaelsoriano.com/category/aws/feed/" rel="self" type="application/rss+xml" />
	<link>https://michaelsoriano.com/category/aws/</link>
	<description>I turn code into captivating user experiences for the web</description>
	<lastBuildDate>Sat, 02 Jul 2022 22:46:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.4</generator>
	<item>
		<title>Woo Hoo! I passed the AWS Certified Developer Exam :)</title>
		<link>https://michaelsoriano.com/passed-the-aws-certified-developer-exam/</link>
					<comments>https://michaelsoriano.com/passed-the-aws-certified-developer-exam/#respond</comments>
		
		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Fri, 29 May 2020 22:12:00 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=7107</guid>

					<description><![CDATA[<p>After a few months of studying, I finally got my AWS developer certificate. I felt like I was back in school. Flashcards, memorization, projects, practice exams &#8211; the works. AWS is a ginormous collection of services. See, even though its a developer cert &#8211; you have to know a lot more than that. For starters [&#8230;]</p>
<p>The post <a href="https://michaelsoriano.com/passed-the-aws-certified-developer-exam/">Woo Hoo! I passed the AWS Certified Developer Exam :)</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>After a few months of studying, I finally got my AWS developer certificate. I felt like I was back in school. Flashcards, memorization, projects, practice exams &#8211; the works. </p>


<p><img decoding="async" src="https://michaelsoriano.com/wp-content/uploads/2020/08/undraw_Beer_celebration_cefj.png" alt="celebrate" class="wp-image-7162"></p>


<p><strong>AWS is a ginormous collection of services</strong>. See, even though its a developer cert &#8211; you have to know a lot more than that. For starters &#8211; storage, databases, servers, cache &#8211; and that&#8217;s just the fundamentals. You also need to know networking, messaging, CICD, Docker, Git &#8211; I learned a lot. </p>


<p>And this is the result: </p>


<p><img fetchpriority="high" decoding="async" width="857" height="368" src="https://michaelsoriano.com/wp-content/uploads/2020/07/aws-cert.png" alt="aws developer" class="wp-image-7162" srcset="https://michaelsoriano.com/wp-content/uploads/2020/07/aws-cert.png 857w, https://michaelsoriano.com/wp-content/uploads/2020/07/aws-cert-300x129.png 300w, https://michaelsoriano.com/wp-content/uploads/2020/07/aws-cert-768x330.png 768w" sizes="(max-width: 857px) 100vw, 857px" /></p>


<p>Well, that and our training bonus incentive at work 🙂</p>


<p>I think Ice Cube said it best &#8211; &#8220;<strong><em>Today was a good day</em></strong>&#8220;.</p>
<p>The post <a href="https://michaelsoriano.com/passed-the-aws-certified-developer-exam/">Woo Hoo! I passed the AWS Certified Developer Exam :)</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://michaelsoriano.com/passed-the-aws-certified-developer-exam/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>My First AWS Lambda Function and API Gateway</title>
		<link>https://michaelsoriano.com/my-first-aws-lambda-function/</link>
					<comments>https://michaelsoriano.com/my-first-aws-lambda-function/#respond</comments>
		
		<dc:creator><![CDATA[Michael Soriano]]></dc:creator>
		<pubDate>Mon, 11 Feb 2019 16:50:31 +0000</pubDate>
				<category><![CDATA[AWS]]></category>
		<guid isPermaLink="false">http://michaelsoriano.com/?p=6813</guid>

					<description><![CDATA[<p>I was given a task to create a simple API that would fetch jobs from our new system Workday. This API would accept a few parameters, and spit out the relevant jobs from it. My thoughts are always &#8211; if I was to build something, might as well learn something new in the process. I&#8217;ve [&#8230;]</p>
<p>The post <a href="https://michaelsoriano.com/my-first-aws-lambda-function/">My First AWS Lambda Function and API Gateway</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I was given a task to create a simple API that would fetch jobs from our new system Workday. This API would accept a few parameters, and spit out the relevant jobs from it. My thoughts are always &#8211; if I was to build something, might as well learn something new in the process. </p>



<p>I&#8217;ve always wanted to pickup more AWS technologies, because it seems that that&#8217;s where all of development is heading. Everything now is in the cloud. Not just SaaS, but we also have FaaS &#8211; which stands for Function as a Service. </p>



<p>So  how was it? First, off &#8211; in the expense of not having a server, you would need to learn how to get around in AWS UI. If you can find Lambda, you will be presented with a screen to create your first function. </p>



<p>Then there is the designer. Which I&#8217;m not sure I like very much. It&#8217;s a bit confusing &#8211; with the &#8220;flowchart&#8221; like layout etc. I see that the function is at the very top &#8211; and everything else stems from it. Hmmm. </p>



<figure class="wp-block-image border"><img decoding="async" width="894" height="406" src="https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-preview.png" alt="" class="wp-image-6817" srcset="https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-preview.png 894w, https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-preview-300x136.png 300w, https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-preview-768x349.png 768w" sizes="(max-width: 894px) 100vw, 894px" /><figcaption>A preview of the Lambda Designer</figcaption></figure>



<p>On the other end of the spectrum, we have the API Gateway. This is where the public actually get&#8217;s to hit your function. </p>



<p>There is a resources section &#8211; where you actually get to see the stages of your call. From configuring the Request, all the way to the response. It has a an interface that outlines the whole process. I&#8217;m not sure how I feel about it either. </p>



<figure class="wp-block-image border"><img decoding="async" width="1113" height="578" src="https://michaelsoriano.com/wp-content/uploads/2019/02/API-Gateway.png" alt="" class="wp-image-6819" srcset="https://michaelsoriano.com/wp-content/uploads/2019/02/API-Gateway.png 1113w, https://michaelsoriano.com/wp-content/uploads/2019/02/API-Gateway-300x156.png 300w, https://michaelsoriano.com/wp-content/uploads/2019/02/API-Gateway-1024x532.png 1024w, https://michaelsoriano.com/wp-content/uploads/2019/02/API-Gateway-768x399.png 768w" sizes="(max-width: 1113px) 100vw, 1113px" /><figcaption>API Gateway</figcaption></figure>



<p>Okay, let&#8217;s see how I did. First of all, I used NodeJS to build my small function. All it does is make an &#8220;<strong>https</strong>&#8221; call to another API. Accept a few parameters, and filter the response according to it. </p>



<h2 class="wp-block-heading">The Function</h2>



<p>As you can see below, it&#8217;s a simple snippet of code. Everything is wrapped around the handler. This basically sets up the https module and executes it. The data that comes back is stuffed into a variable called &#8220;data&#8221;.</p>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript line-numbers">const https = require('https');
exports.handler = (event, context, callback) =&gt; {
    let options = {
        host : 'somesite',
        path:  '/path1/'
    };
    const req = https.request(options, (res) =&gt; {
        let body = '';
        // console.log('Status:', res.statusCode);
        // console.log('Headers:', JSON.stringify(res.headers));
        res.setEncoding('utf8');
        res.on('data', (chunk) =&gt; body += chunk);
        res.on('end', () =&gt; {
            console.log('Successfully processed HTTPS response');
        });
    });
    req.on('error', callback);
    req.write(JSON.stringify(event));
    req.end();
};</code></pre>



<p>Quick note: the Cloud9 editor &#8211; is one of the best I&#8217;ve seen. I am really impressed with it. It&#8217;s very solid, has plenty of features and parallels many of the desktop IDE&#8217;s / Text editors that I&#8217;ve used. </p>



<figure class="wp-block-image"><img decoding="async" width="835" height="329" src="https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-cloud9.png" alt="" class="wp-image-6818" srcset="https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-cloud9.png 835w, https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-cloud9-300x118.png 300w, https://michaelsoriano.com/wp-content/uploads/2019/02/lambda-cloud9-768x303.png 768w" sizes="(max-width: 835px) 100vw, 835px" /><figcaption>Cloud9 Editor</figcaption></figure>



<p>The parameters that is passed into the function is in the object called &#8220;event&#8221;. Which I&#8217;m not really going into at the moment. This is basically a general overview of my function, and the steps to make it work. </p>



<p>Although Cloud9 is good, the Labmda UI works, it still doesn&#8217;t replace working locally. The steps that you have to go through &#8211; testing your code, changing params, clicking the buttons here and there &#8211; it&#8217;s still just too slow. </p>



<h2 class="wp-block-heading">Working Locally</h2>



<p>So I had to get this same project locally. Lambda has an option of uploading a .zip file, so that&#8217;s what I did. </p>



<p>I also have a server.js file &#8211; which is not part of the API &#8211; but a file that I call locally to make the whole thing work in my machine. </p>



<p>Basically, what this is doing is running a server locally, and calling our Lambda function directly. Notice the line &#8220;<strong>index.handler</strong>&#8230;&#8221;</p>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript line-numbers">var http = require('http');
var index = require('./index');
var { parse } = require('querystring');
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
var httpserver = http.createServer(function(req,res){
  let params = '';
  req.on('data', chunk =&gt; {
    params += chunk.toString(); // convert Buffer to string
  });
  req.on('end', () =&gt; {
    if(req.headers['content-type'] == 'application/x-www-form-urlencoded') {
      index.handler(parse(params),"",function(empty, result){
        res.setHeader('Content-Type', 'application/json');
        res.write(JSON.stringify(result));
        res.end("");
      });
    }else{
      res.end("No params passed");
    }
  });
});
var port = 5050;
httpserver.listen(port,function(){
  console.log('Server is running on port -&gt; ' + port);
});</code></pre>



<p>So now, I can run my function without having to go through the Lambda API UI to test, reload etc. </p>



<p>All I need is to run </p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">nodemon server.js</code></pre>



<p>Nodemon is a NodeJS module that automatically restarts and reloads your server when you save.</p>



<p>Also, I use <a href="https://www.getpostman.com">PostMan</a>, and save  both endpoints (local and live), to track the results etc.</p>
<p>The post <a href="https://michaelsoriano.com/my-first-aws-lambda-function/">My First AWS Lambda Function and API Gateway</a> appeared first on <a href="https://michaelsoriano.com">Michael Soriano</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://michaelsoriano.com/my-first-aws-lambda-function/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
