<?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>Forem: Haseeb Burki</title>
    <description>The latest articles on Forem by Haseeb Burki (@hzburki).</description>
    <link>https://forem.com/hzburki</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%2F129711%2Ff14421e5-fae7-4ea4-85af-a3f9e7e104b4.jpeg</url>
      <title>Forem: Haseeb Burki</title>
      <link>https://forem.com/hzburki</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/hzburki"/>
    <language>en</language>
    <item>
      <title>Configure SSL Certificate — AWS Elastic Beanstalk (Single Instance)</title>
      <dc:creator>Haseeb Burki</dc:creator>
      <pubDate>Fri, 04 Oct 2019 21:48:19 +0000</pubDate>
      <link>https://forem.com/hzburki/configure-ssl-certificate-aws-elastic-beanstalk-single-instance-3hl8</link>
      <guid>https://forem.com/hzburki/configure-ssl-certificate-aws-elastic-beanstalk-single-instance-3hl8</guid>
      <description>&lt;p&gt;SSL secures data transfer between client and server-side. Not only that it also increases your website’s Google ranking, so it's safe to say that SSL certificates are a &lt;em&gt;MUST&lt;/em&gt; have.&lt;/p&gt;

&lt;p&gt;AWS provides a very convenient solution called “AWS Certificate Manager” (ACM). It provides &lt;em&gt;free&lt;/em&gt; public SSL certificates that you can connect to your load balanced Elastic Beanstalk (EB) instances.&lt;/p&gt;

&lt;p&gt;That’s great !! but we can lose the load balancer for instances hosting our development environments and side projects … &lt;em&gt;RIGHT ??&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After all, a single low-cost instance will suffice. We’ll just generate a certificate using ACM use it on our “&lt;em&gt;single instance&lt;/em&gt;” … &lt;em&gt;wait what’s that !! we can’t ??&lt;/em&gt; 😧😧😧&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Apparently, ACM requires a load balancer (or CloudFront distribution). It’s not possible to use the certificate with an instance directly.
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well, that’s mildly annoying 😒 but don’t worry we can still provision a free SSL certificate without enduring unnecessary load balancer expenses, in three easy steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Elastic Beanstalk
&lt;/h3&gt;

&lt;p&gt;The first step is to say goodbye to your load balancer. Convert your instance type to “single instance” from “load balanced.” You can do this from the &lt;em&gt;Capacity&lt;/em&gt; tab inside &lt;em&gt;Configurations&lt;/em&gt;. Just choose single instance in the environment type and that’s it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2518%2F1%2AZpuT8WRGcq9mWVYY0gNByQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2518%2F1%2AZpuT8WRGcq9mWVYY0gNByQ.png" alt="Elastic Beanstalk configuration tab."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2) Certbot
&lt;/h3&gt;

&lt;p&gt;The second step is creating and signing the certificate using “certbot”. You can find it &lt;a href="https://certbot.eff.org/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. I should mention that you’ll need a domain to use the certificate on.&lt;/p&gt;

&lt;p&gt;Open up the terminal on your local machine, I’m using mac so some of the commands might be a little different for you.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;certbot certonly --manual -d domain.com --preferred-challenges dns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;“certonly”&lt;/em&gt;&lt;/strong&gt;: use certbot authenticators&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;“manual”&lt;/em&gt;&lt;/strong&gt;: generate certificates on machines other than web servers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;“d”&lt;/em&gt;&lt;/strong&gt;: specify a domain&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;“preferred-challenges”&lt;/em&gt;&lt;/strong&gt;: a method for domain verification&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The cli will ask you to allow to log your machine’s IP address. You have to agree to continue.&lt;/p&gt;

&lt;p&gt;After that, it’ll ask you to deploy a DNS TXT record with the name &lt;em&gt;_acme-challenge.domain.com&lt;/em&gt;. Press “enter” when you want to verify the new record.&lt;/p&gt;

&lt;p&gt;On successfully creating the certificate the cli will spit out two files “privkey.pem” &amp;amp; “fullchain.pem”.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;certbot certificates
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;You can use the above command to list all the certificates along with paths to their files.&lt;/p&gt;
&lt;h3&gt;
  
  
  3) .ebextensions
&lt;/h3&gt;

&lt;p&gt;Okay so we’re nearly there, the third and last step is enabling HTTPS for your “single instance” by allowing traffic on port 443.&lt;/p&gt;

&lt;p&gt;Create a folder named &lt;strong&gt;&lt;em&gt;.ebextensions&lt;/em&gt;&lt;/strong&gt;, it is important that the name be exactly the same. Then create a configuration file with the extension &lt;strong&gt;&lt;em&gt;“.config”&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;“packages”&lt;/strong&gt; key installs mod24_ssl on the instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;“files”&lt;/strong&gt; key is used to create files which hold the certificate, certificate chain and private key that certbot created.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Note:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Copy the contents of &lt;em&gt;“privkey.pem”&lt;/em&gt; to server.key file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the contents in &lt;em&gt;“fullchain.pem”&lt;/em&gt; to chain.pem file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;There will be two keys in &lt;em&gt;“fullchain.pem”&lt;/em&gt; You only need to copy the first key to server.crt file&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now all you have to do is deploy your code to Elastic Beanstalk. Make sure that your instance is connected to the same URL in &lt;a href="https://aws.amazon.com/route53/" rel="noopener noreferrer"&gt;Route53&lt;/a&gt; that you entered in certbot cli …&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Aaand Voilà !!! &lt;strong&gt;A+&lt;/strong&gt; rating for your very own, free of cost SSL Certificate. You can test your SSL certificate at &lt;a href="https://www.ssllabs.com/ssltest/" rel="noopener noreferrer"&gt;ssllabs.com&lt;/a&gt;.
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4392%2F1%2AlU5YNe-S1O7nN-XlYrptNg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4392%2F1%2AlU5YNe-S1O7nN-XlYrptNg.png" alt="nuff’ said 😎😎😎"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;Happy Coding :)&lt;/em&gt;
&lt;/h2&gt;

</description>
      <category>aws</category>
      <category>elasticbeanstalk</category>
      <category>ssl</category>
    </item>
    <item>
      <title>Migrating API from Laravel to NestJS</title>
      <dc:creator>Haseeb Burki</dc:creator>
      <pubDate>Wed, 18 Sep 2019 19:21:09 +0000</pubDate>
      <link>https://forem.com/hzburki/migrating-api-from-laravel-to-nestjs-332g</link>
      <guid>https://forem.com/hzburki/migrating-api-from-laravel-to-nestjs-332g</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I want your opinion&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I've been working as a full-stack developer on mobile and web-based application backed by an API built in Laravel for 2 years. &lt;/p&gt;

&lt;p&gt;Fast forward to today we have 3 developers (excluding myself) working on the same code. &lt;/p&gt;

&lt;p&gt;Recently I've been seriously considering migrating the API to JavaScript. After doing some research I decided on NestJS.&lt;/p&gt;

&lt;p&gt;When I started looking at javascript (NodeJS) I was disappointed. None of the backend libraries or frameworks offered as much as Laravel does. I had to setup up very trivial things like server-side validation, dependency injection, error logging, etc. things which Laravel offers right out of the box. NestJS removed most of these concerns. &lt;/p&gt;

&lt;h3&gt;
  
  
  Pros of Migrating to NestJS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;I have a personal desire to shift my work to JS. &lt;/li&gt;
&lt;li&gt;Migrating backend to JS closes the language barrier between frontend and backend devs. &lt;/li&gt;
&lt;li&gt;I can handle testing both frontend and backend with Jest.&lt;/li&gt;
&lt;li&gt;There are a lot more developers for Node and JS than for Laravel.&lt;/li&gt;
&lt;li&gt;JS ecosystem (npm) is much better than PHP's ecosystem.&lt;/li&gt;
&lt;li&gt;Node seems to have a leg up in terms of performance. &lt;/li&gt;
&lt;li&gt;Unfortunately Laravel is cursed by its language of choice (PHP). This scares away a lot of potential new developers.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that I run a team and have to retain my employees. I also need to consider what resources are available in case I hire more employees.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Cons of Migrating to NestJS
&lt;/h3&gt;

&lt;p&gt;The only issue I have is the time and effort I will have to put in to migrate all our work to a new framework. I (and my team) are comfortable with Laravel but want to migrate to NestJS.&lt;/p&gt;

&lt;p&gt;I just wanted to get more opinions about whether migrating is a good or bad idea? And do you think it will be worth it in the long run or not? &lt;/p&gt;

</description>
      <category>discuss</category>
      <category>help</category>
      <category>node</category>
      <category>laravel</category>
    </item>
    <item>
      <title>NestJS: Getting Started with SequilizeJS</title>
      <dc:creator>Haseeb Burki</dc:creator>
      <pubDate>Fri, 06 Sep 2019 19:31:56 +0000</pubDate>
      <link>https://forem.com/hzburki/nestjs-getting-started-with-sequilizejs-21p</link>
      <guid>https://forem.com/hzburki/nestjs-getting-started-with-sequilizejs-21p</guid>
      <description>&lt;h2&gt;
  
  
  Preface
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Coming from &lt;em&gt;Laravel&lt;/em&gt;, which has a myriad of built-in features I started to resent shifting to NodeJS. Setting up error handling, logging, dependency injection, etc. was not what I had in mind. Thankfully I found NestJS, with its out-of-the-box architecture and great documentation I started feeling at home again.&lt;/p&gt;

&lt;p&gt;This is one small step in a long technical journey with NestJS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;SequelizeJS is an ORM that offers connectivity to relational databases like MySQL, PostgreSQL, and MSSQL. For this article, I’m going to use MySQL hosted on &lt;a href="https://remotemysql.com/" rel="noopener noreferrer"&gt;RemoteMySQL&lt;/a&gt;, but you can use any relational database you like.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Assuming you have a nest project ready to go. We’ll start by installing the following dependencies.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save sequelize sequelize-typescript mysql2
npm install --save-dev @types/sequelize
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;First, we’ll pass the connection details to SequelizeJS. We can do this by creating a database module and provider.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nest generate module database
nest generate provider database/database.providers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;This is where we will add our entity models to SequelizeJS. I’m adding models right now (even though they are created yet), but you can do this later.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;I have imported and added the &lt;em&gt;user&lt;/em&gt; model to the &lt;em&gt;addModels&lt;/em&gt; function. Now export your database provider so it can be consumed with any module that needs to access the database through SequelizeJS.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;User Entity Model&lt;/strong&gt;
&lt;/h2&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;I’m not going to explain how the code above populates the database table and its attributes. If you’re interested in learning more about SequelizeJS, you can look &lt;a href="http://docs.sequelizejs.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next, we’ll create &lt;em&gt;user.provider.ts&lt;/em&gt; which will be used to export the User model so it can be used in different &lt;em&gt;services&lt;/em&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The &lt;em&gt;USER_REPOSITORY&lt;/em&gt; is stored in a const variable, in a separate file, so it can be used anywhere without being subject to human error.&lt;/p&gt;

&lt;p&gt;At this point, we’re done with our database and SequelizeJS configuration. From now on it’s just a matter of importing database and its models and using them 😀.&lt;/p&gt;

&lt;h2&gt;
  
  
  Onwards with the Code
&lt;/h2&gt;

&lt;p&gt;Let’s move on and create our user *module, controller and service *with the following command.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nest generate module user
nest generate controller user
nest generate service user 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;These are the files responsible for entertaining recurring database requests. But first we’ll create a Data Transfer Object (DTO), this is especially useful for validating &lt;em&gt;body&lt;/em&gt; of the incoming HTTP request or building API documentation with swagger, etc.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;h3&gt;
  
  
  User Module
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The above code is consolidating all the User code (controller, service, model) into one place, the &lt;em&gt;user module&lt;/em&gt; so it can be exported to the &lt;em&gt;app module&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Note that the user &lt;em&gt;controller&lt;/em&gt; and &lt;em&gt;service&lt;/em&gt; have been generated but are empty right at this step. You can opt to populate this file later on.&lt;/p&gt;

&lt;h3&gt;
  
  
  User Service
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Unlike &lt;em&gt;user service&lt;/em&gt; which uses the &lt;em&gt;“Injectable”&lt;/em&gt; decorator, the &lt;em&gt;user provider&lt;/em&gt; we created to use the &lt;em&gt;User Model&lt;/em&gt; is not a part of NestJS, therefore has to be injected manually.&lt;/p&gt;

&lt;p&gt;We do this inside the service’s &lt;em&gt;constructor&lt;/em&gt; method using the &lt;em&gt;“Inject”&lt;/em&gt; decorator.&lt;/p&gt;

&lt;h3&gt;
  
  
  User Controller
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The last step is to inject the &lt;em&gt;user service&lt;/em&gt; in our &lt;em&gt;user controller&lt;/em&gt;. The controller exposes our code base to externally accessible API endpoints.&lt;/p&gt;

&lt;h3&gt;
  
  
  Folder Structure
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AvaJB14wJUGp4QGyoTDhc2A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AvaJB14wJUGp4QGyoTDhc2A.png" alt="Nest-Sequelize Folder Structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re curious, this is how my folder structure looks like.&lt;/p&gt;

&lt;p&gt;The database connection details are in the &lt;em&gt;database&lt;/em&gt; folder, easy to maintain and reuse anywhere in the app.&lt;/p&gt;

&lt;p&gt;The bulk of the files are in the &lt;em&gt;user&lt;/em&gt; folder. You can ignore the &lt;em&gt;.spec&lt;/em&gt; files as they are used to host tests that are out of the scope of this article.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;dto&lt;/em&gt; folder holds “data transfer objects” for each request. The &lt;em&gt;index&lt;/em&gt; file is used to export all *dto-*s.&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>sequelizejs</category>
      <category>node</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Create your first AWS Billing Alarm </title>
      <dc:creator>Haseeb Burki</dc:creator>
      <pubDate>Sun, 01 Sep 2019 19:52:38 +0000</pubDate>
      <link>https://forem.com/hzburki/create-your-first-aws-billing-alarm-2h74</link>
      <guid>https://forem.com/hzburki/create-your-first-aws-billing-alarm-2h74</guid>
      <description>&lt;p&gt;Whether you're a novice, just starting or a highly skilled AWS ninja, you need to keep an eye on those pesky AWS bills. Billing is a very important and sometimes confusing part of AWS and if left unchecked can cause a lot of damage.&lt;/p&gt;

&lt;p&gt;AWS gives a one-year free trial and there are a lot of great tutorials out there, enabling young devs to get started in no time. However, before getting started, it is strongly recommended that you set up a billing alarm to avoid any unnecessary costs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This article assumes that you have already created an AWS account&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What is a Billing Alarm?
&lt;/h2&gt;

&lt;p&gt;Good question! Billing Alarm is a limit that you can set and AWS console lets you know (email) when you exceed that limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's get our hands dirty !! 👩‍💻 👨‍💻
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Assuming you are logged into the console. Click on your &lt;strong&gt;username&lt;/strong&gt; in the top right bar and select the &lt;strong&gt;Billing Dashboard&lt;/strong&gt;. Alternately, you can also search for &lt;strong&gt;billing&lt;/strong&gt; in the search bar, on the main page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the left tab, under the &lt;strong&gt;Preferences&lt;/strong&gt; section click &lt;strong&gt;Billing preferences&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n0HXjQLG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8cuveiuxd8zysb8mzj1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n0HXjQLG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8cuveiuxd8zysb8mzj1m.png" alt="Preference Screen - Haseeb Burki AWS Billing Alarm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check &lt;strong&gt;Receive Billing Alerts&lt;/strong&gt; and press &lt;strong&gt;Save Preferences&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; AWS recently updated its user interface (UI), so many existing tutorials on the net are still based on the older UI.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After that, you'll need to navigate to &lt;strong&gt;CloudWatch&lt;/strong&gt;. Open &lt;strong&gt;Services&lt;/strong&gt; dropdown (top bar) and search for CloudWatch. It should be under &lt;strong&gt;Management and Governance&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the left side tab, click on &lt;strong&gt;Billing&lt;/strong&gt; and then &lt;strong&gt;Create Alarm&lt;/strong&gt; button.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;💡CloudWatch displays all billing alerts in US East (N. Virginia) region only. So you will have to create all alarms in that region.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Create Alarm&lt;/strong&gt; button will take you to a setup wizard. There are four steps in the wizard:&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Specify metrics and conditions&lt;/li&gt;
&lt;li&gt;Configure actions&lt;/li&gt;
&lt;li&gt;Add description&lt;/li&gt;
&lt;li&gt;Preview and create&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;In the first step, you can add the alarm's name, currency, and conditions that trigger the alarm.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XVIrebEi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qw20whamjy12hsqh16ce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XVIrebEi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qw20whamjy12hsqh16ce.png" alt="Specify Metrics - Haseeb Burki AWS Billing Alarm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the second step, you can configure when the alarm is triggered and who it goes out to. To define who receives the notification, you will need to create or choose an existing, SNS topic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Complete the following steps;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Select &lt;strong&gt;Create new topic&lt;/strong&gt; under "Select an SNS topic" subheading&lt;/li&gt;
&lt;li&gt;You can change the topic name if you want.&lt;/li&gt;
&lt;li&gt;Add your email address. You can add multiple email addresses separated by commas (,)&lt;/li&gt;
&lt;li&gt;Press &lt;strong&gt;Create topic&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8W_eEhox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ovjpwulk0pri99r1vn86.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8W_eEhox--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ovjpwulk0pri99r1vn86.png" alt="Creating SNS Topic - Haseeb Burki AWS Billing Alarm"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the third step just add a unique name and description (optional) for the alarm. This is so you can recognize the alarm easily among others you may create in the future.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The last step lets you preview all the information you have added in the setup wizard and create the alarm.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Once the alarm is created, you will need to access your email and confirm the subscription to it.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>100% height to all divs - Gatsby</title>
      <dc:creator>Haseeb Burki</dc:creator>
      <pubDate>Wed, 15 May 2019 16:02:37 +0000</pubDate>
      <link>https://forem.com/hzburki/100-height-to-all-divs-gatsby-33nd</link>
      <guid>https://forem.com/hzburki/100-height-to-all-divs-gatsby-33nd</guid>
      <description>&lt;h1&gt;
  
  
  Use Case
&lt;/h1&gt;

&lt;p&gt;A simple UI containing a header, main and footer. &lt;/p&gt;

&lt;p&gt;The footer should stick to the bottom if content above it (main) does not fill the whole view and get pushed down if the content (main) exceeds the view height.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F2glkxgi99t3w6xougf7a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2glkxgi99t3w6xougf7a.png" alt="What we Have!" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;
What we Have!



&lt;p&gt;&lt;a href="https://media.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%2F2noxbo4vgdd0q584post.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2noxbo4vgdd0q584post.png" alt="What we Want!" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;
What we Want!

     

&lt;h1&gt;
  
  
  The Simple Solution
&lt;/h1&gt;

&lt;p&gt;My first thought was assigning all html tags above the div which holds the &lt;code&gt;&amp;lt;main&amp;gt;&amp;lt;/main&amp;gt;&lt;/code&gt; tags &lt;code&gt;height: '100%'&lt;/code&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  But!!! 😮😮😮
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.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%2F03su52uhnijyifxqqjod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F03su52uhnijyifxqqjod.png" alt="gatsby html structure" width="800" height="371"&gt;&lt;/a&gt;Additional div &lt;strong&gt;Highlighted&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Gatsby uses &lt;a href="https://github.com/reach/router" rel="noopener noreferrer"&gt;@reach/router&lt;/a&gt; which wraps the &lt;code&gt;Layout&lt;/code&gt; component in an additional div. This is done so, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;@reach/router can automatically manage the focus as part of making sure sites are usable by screen readers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So you can see how adding style to a javascript injected div without any &lt;code&gt;class&lt;/code&gt; or &lt;code&gt;id&lt;/code&gt; might be an issue. &lt;/p&gt;

&lt;h1&gt;
  
  
  The Real Solution
&lt;/h1&gt;

&lt;p&gt;Well the &lt;strong&gt;real solution&lt;/strong&gt; is actually still the same, we need to assign a &lt;code&gt;height: '100%'&lt;/code&gt; to all parent divs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new css file and name it &lt;code&gt;global.css&lt;/code&gt;. I've put it in a separate styles folder in my repo.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* 
 * Purpose:
 * Assign height: "100%" to
 * html, body, #___gatsby &amp;amp;  
 * div with role="group"
*/

html, body, #___gatsby {
    height: 100%;
}

body {
    margin: 0px;
}

div[role="group"][tabindex] {
    height: 100%;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In the root of your directory, look for &lt;code&gt;gatsby-browser.js&lt;/code&gt; and import &lt;code&gt;global.css&lt;/code&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import './src/styles/global.css'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;I like to start my projects from scratch. This is my take on &lt;code&gt;Layout&lt;/code&gt; Component.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div style={{
  height: '100%',
  display: 'flex',
  flexDirection: "column"
}}&amp;gt;
  &amp;lt;header&amp;gt;
    &amp;lt;Header siteTitle={data.site.siteMetadata.title} /&amp;gt;
  &amp;lt;/header&amp;gt;

  &amp;lt;main 
    style={{
      backgroundColor: 'pink',
      flexGrow: 1
    }}
  &amp;gt;{children}&amp;lt;/main&amp;gt;

  &amp;lt;footer style={{
    backgroundColor: 'aquamarine'
  }}&amp;gt;
    © {new Date().getFullYear()}, Built with
    {` `}
    &amp;lt;a href="https://www.gatsbyjs.org"&amp;gt;Gatsby&amp;lt;/a&amp;gt;
  &amp;lt;/footer&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  The Result as Promised !!
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.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%2F3v2rj8ymk92rju263oxm.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3v2rj8ymk92rju263oxm.gif" alt="Gatsby CSS - 100% Height" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;
Footer pushed down by content



&lt;blockquote&gt;
&lt;p&gt;This solution is based on a &lt;a href="https://github.com/gatsbyjs/gatsby/issues/7310" rel="noopener noreferrer"&gt;github thread&lt;/a&gt;. &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>gatsby</category>
      <category>css</category>
      <category>react</category>
    </item>
  </channel>
</rss>
