<?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: Fadare shola</title>
    <description>The latest articles on DEV Community by Fadare shola (@surelay).</description>
    <link>https://dev.to/surelay</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%2F747699%2Ff15cfc5c-2e13-49af-a6a3-d40188813667.jpeg</url>
      <title>DEV Community: Fadare shola</title>
      <link>https://dev.to/surelay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/surelay"/>
    <language>en</language>
    <item>
      <title>How To Set Up A Secure AWS Client VPN With Okta Integration (SSO and Self-service) Using Terraform (PART 2)</title>
      <dc:creator>Fadare shola</dc:creator>
      <pubDate>Sun, 09 Apr 2023 14:22:18 +0000</pubDate>
      <link>https://dev.to/surelay/how-to-set-up-a-secure-aws-client-vpn-with-okta-integration-sso-and-self-service-using-terraform-part-2-40b2</link>
      <guid>https://dev.to/surelay/how-to-set-up-a-secure-aws-client-vpn-with-okta-integration-sso-and-self-service-using-terraform-part-2-40b2</guid>
      <description>&lt;p&gt;In the previous part of this article, we explored how to generate the SAML applications metadata using Okta. In this second part, we will continue with the next steps to set up an AWS Client VPN endpoint and associate it with a VPC network, and then configure it to authenticate Okta users. By integrating AWS Client VPN with Okta, we can ensure secure and centralized access control for remote users. Let's dive in and explore the remaining steps involved in setting up AWS Client VPN.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Requirements:&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;To follow along with this tutorial, you need to have the following prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Account&lt;/li&gt;
&lt;li&gt;Terraform installed on your machine&lt;/li&gt;
&lt;li&gt;An Okta account and Okta SAML application metadata .xml file from part 1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;p&gt;The following steps will guide you through the process to complete the integration of Okta with AWS to setup a Client VPN using Terraform.&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 1: Generate the server and client certificates with keys to be uploaded to ACM
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Clone the OpenVPN easy-rsa repo to your local computer and navigate to the easy-rsa/easyrsa3 folder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;$ git clone &lt;a href="https://github.com/OpenVPN/easy-rsa.git" rel="noopener noreferrer"&gt;https://github.com/OpenVPN/easy-rsa.git&lt;/a&gt;&lt;br&gt;
$ cd easy-rsa/easyrsa3&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Initialize a new PKI environment.&lt;br&gt;
$ ./easyrsa init-pki&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To build a new certificate authority (CA), run this command and follow the prompts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;$ ./easyrsa build-ca nopass&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate the server certificate and key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;$ ./easyrsa build-client-full client1.domain.tld nopass&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the server certificate and key and the client certificate and key to a custom folder. you can use the same custom folder for the downloaded provider's metadata.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  STEP 2: Write the terraform to deploy necessary resources
&lt;/h2&gt;

&lt;p&gt;In the main.tf file, this section creates two resources of aws_acm_certificate type to upload the server certificate and client certificate to the AWS Certificate Manager (ACM). The certificates are uploaded from the local computer. The private_key, certificate_body, and certificate_chain arguments specify the location of the certificate files, and the tags argument adds a name tag to the certificates for easy identification.&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%2Fxy5lfgtil2y7gwf85vfp.jpeg" 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%2Fxy5lfgtil2y7gwf85vfp.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;u&gt;Create the SAML provider&lt;/u&gt;
&lt;/h5&gt;

&lt;p&gt;To create a SAML provider, you need to provide the SAML metadata file in either XML or JSON format. You can either upload the file directly to AWS or provide the file path to the aws_iam_saml_provider resource in your Terraform configuration.&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%2F7w4chqb1ybqxj58s5mhs.jpeg" 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%2F7w4chqb1ybqxj58s5mhs.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;u&gt;Create a Client VPN endpoint&lt;/u&gt;
&lt;/h5&gt;

&lt;p&gt;The resource block "aws_ec2_client_vpn_endpoint" create the Client VPN endpoint. The endpoint is associated with the server certificate uploaded earlier. The authentication_options block defines the SAML provider ARNs for federated authentication and self-service authentication. The client_cidr_block argument specifies the IP address range for the Client VPN subnet, and dns_servers argument provides a list of DNS servers that will be used by clients to resolve domain names. The split_tunnel argument defines whether or not to split the client's internet traffic over the VPN. The self_service_portal argument specifies whether to enable or disable the self-service portal. The connection_log_options argument specifies whether to enable or disable connection logging.&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%2Fyro31u4db3934cma0zmv.jpeg" 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%2Fyro31u4db3934cma0zmv.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Associate a target network&lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;This section creates a resource of aws_ec2_client_vpn_network_association type to associate the Client VPN endpoint with a target network. The count argument is set to the number of subnets created in the next step, and the client_vpn_endpoint_id argument specifies the ID of the Client VPN endpoint created. The subnet_id argument specifies the ID of the subnet to which the endpoint is associated. The security_groups argument specifies the ID of the security group to apply to the endpoint. The ignore_changes argument is set to ignore any changes made to the subnet_id argument.&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%2Fjtvf9p2dmyb01nxluzpu.jpeg" 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%2Fjtvf9p2dmyb01nxluzpu.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Add an authorization rule for the VPC&lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;This block creates a resource of aws_ec2_client_vpn_authorization_rule type to add an authorization rule for the VPC. The client_vpn_endpoint_id argument specifies the ID of the Client VPN endpoint created. The target_network_cidr argument specifies the IP address range of the target VPC. The authorize_all_groups argument allows all clients in the target network to connect to the Client VPN endpoint.&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%2F2wpk0ujkjbjvhxh1v9lh.jpeg" 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%2F2wpk0ujkjbjvhxh1v9lh.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Provide access to the internet to vpn user&lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;This step creates a resource of aws_ec2_client_vpn_route type to provide internet access to the connected clients. The count argument is set to the number of subnets created. The client_vpn_endpoint_id argument specifies the ID of the Client VPN endpoint created. The destination_cidr_block argument specifies the IP address range of the internet.destination_cidr_block = "0.0.0.0/0" - This is defining the destination CIDR block for this route. In this case, it is "0.0.0.0/0", which means all traffic will be routed through this VPN.&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%2F3ci10ogsphzl3g4g1y7a.jpeg" 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%2F3ci10ogsphzl3g4g1y7a.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Verify security group requirements&lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;This step creates a resource of aws_security_group type to verify security group requirements. The vpc_id argument specifies the ID of the VPC created in previous steps. The name argument assigns a name to the security group. The ingress and egress blocks define inbound and outbound rules for the security group, respectively. The inbound rule allows UDP traffic on port 443 from any source IP address.&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%2Fsk4dz1666kos59qxacmx.jpeg" 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%2Fsk4dz1666kos59qxacmx.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To properly organize the project, I created a separate terraform file(vpc.tf) that contains all resources associated with creating the VPC and Subnet to which the VPN Client is connecting to.&lt;/p&gt;


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

&lt;p&gt;resource "aws_vpc" "main" {&lt;br&gt;
  cidr_block = "172.20.0.0/16"&lt;/p&gt;

&lt;p&gt;enable_dns_hostnames = true&lt;br&gt;
  enable_dns_support = true&lt;br&gt;
  instance_tenancy = "default"&lt;br&gt;
  tags = local.global_tags&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;resource "aws_default_security_group" "default" {&lt;br&gt;
  vpc_id = aws_vpc.main.id&lt;/p&gt;

&lt;p&gt;egress {&lt;br&gt;
    from_port = 0&lt;br&gt;
    to_port = 0&lt;br&gt;
    protocol = "-1"&lt;br&gt;
    cidr_blocks = ["0.0.0.0/0"]&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;tags = local.global_tags&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;resource "aws_subnet" "sn_az" {&lt;br&gt;
  count = length(local.availability_zones)&lt;/p&gt;

&lt;p&gt;availability_zone = local.availability_zones[count.index]&lt;/p&gt;

&lt;p&gt;vpc_id = aws_vpc.main.id&lt;br&gt;
  map_public_ip_on_launch = false&lt;/p&gt;

&lt;p&gt;cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 5, count.index+1)&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;resource "aws_internet_gateway" "igw" {&lt;br&gt;
  vpc_id = aws_vpc.main.id&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;resource "aws_route_table" "rt" {&lt;br&gt;
  vpc_id = aws_vpc.main.id&lt;/p&gt;

&lt;p&gt;route {&lt;br&gt;
    cidr_block = "0.0.0.0/0"&lt;br&gt;
    gateway_id = aws_internet_gateway.igw.id&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;resource "aws_route_table_association" "rt_assoc" {&lt;br&gt;
  count = length(aws_subnet.sn_az)&lt;/p&gt;

&lt;p&gt;route_table_id = aws_route_table.rt.id&lt;br&gt;
  subnet_id = aws_subnet.sn_az[count.index].id&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;data "aws_availability_zones" "available" {&lt;br&gt;
  state = "available"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;locals {&lt;br&gt;
  region = "us-east-2"&lt;br&gt;
  global_tags = {&lt;br&gt;
    "environment" = "vpn-example"&lt;br&gt;
  }&lt;br&gt;
  availability_zones = sort(data.aws_availability_zones.available.names)&lt;br&gt;
}&lt;/p&gt;

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

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  STEP 3: Run terraform commands to deploy the resources to AWS&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;cd into the directory containing the terraform files and run the terraform commands to deploy the VPN to AWS&lt;/p&gt;

&lt;p&gt;$ terraform init&lt;br&gt;
$ terraform plan&lt;br&gt;
$ terraform apply&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 4: Download the client config from the AWS console or the user Self-service portal
&lt;/h2&gt;

&lt;p&gt;They are two way to get the Client Configuration&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The AWS console&lt;/li&gt;
&lt;/ol&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%2Fwfsd42mbisg8l3sczt99.jpeg" 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%2Fwfsd42mbisg8l3sczt99.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Self-service portal for end users&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Login to the service portal with the link&lt;br&gt;
&lt;strong&gt;LINK&lt;/strong&gt;: &lt;a href="https://self-service.clientvpn.amazonaws.com/endpoints/Client" rel="noopener noreferrer"&gt;https://self-service.clientvpn.amazonaws.com/endpoints/Client&lt;/a&gt; VPN endpoint ID&lt;br&gt;
Note: End users will the okta Verify app to complete the login to generate login MFA code&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%2Fpq9j8so1bd9gn7dicgf3.jpeg" 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%2Fpq9j8so1bd9gn7dicgf3.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 5: Download the Client VPN app either from the self-service page or the link below
&lt;/h2&gt;

&lt;p&gt;Download link: &lt;a href="https://aws.amazon.com/vpn/client-vpn-download/" rel="noopener noreferrer"&gt;https://aws.amazon.com/vpn/client-vpn-download/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 6: Configure the VPN app by adding the VPN client configuration that was downloaded from the self-service page
&lt;/h2&gt;

&lt;p&gt;To connect using the AWS provided client for Windows&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the AWS VPN Client app.&lt;/li&gt;
&lt;li&gt;Choose File, Manage Profiles.&lt;/li&gt;
&lt;li&gt;Choose Add Profile.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Display Name can be Anything &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%2F75qp47od9wecl128mjqh.jpeg" 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%2F75qp47od9wecl128mjqh.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 7: Verify the connection to the VPC by checking that the “Connected” text shows above the display name.
&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%2Fh4tuamazmei4bkezkowg.jpeg" 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%2Fh4tuamazmei4bkezkowg.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;p&gt;You can find the module to this project on my &lt;a href="https://github.com/devmatthew1/terraform-aws-clientvpn-okta-2" rel="noopener noreferrer"&gt;GitHub Page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Visit &lt;a href="https://dev.to/surelay/how-to-set-up-a-secure-aws-client-vpn-with-terraform-and-okta-integration-for-sso-and-self-service-part-1-4nmm"&gt;Part 1&lt;/a&gt; if you missed it&lt;/p&gt;

&lt;p&gt;Please like, comment and share to help improve this article.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>aws</category>
      <category>terraform</category>
      <category>devops</category>
    </item>
    <item>
      <title>How To Set Up A Secure AWS Client VPN With Okta Integration (SSO and Self-service) Using Terraform (PART 1)</title>
      <dc:creator>Fadare shola</dc:creator>
      <pubDate>Sat, 08 Apr 2023 11:30:26 +0000</pubDate>
      <link>https://dev.to/surelay/how-to-set-up-a-secure-aws-client-vpn-with-terraform-and-okta-integration-for-sso-and-self-service-part-1-4nmm</link>
      <guid>https://dev.to/surelay/how-to-set-up-a-secure-aws-client-vpn-with-terraform-and-okta-integration-for-sso-and-self-service-part-1-4nmm</guid>
      <description>&lt;p&gt;This article is going to be a two part series, this first part demonstrates how to deploy the SAML application to Okta in order to generate provider .xml file and the second part creates all the required AWS resources and deploys the Client VPN to AWS using terraform. This is really an interesting project for me and i'm so sure it will be useful to someone out there.&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%2F7cxkrzx37xgdhvihspxk.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%2F7cxkrzx37xgdhvihspxk.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a VPN
&lt;/h3&gt;

&lt;p&gt;Virtual Private Networks (VPNs) are essential for secure remote access to company resources. AWS provides a service called AWS Client VPN that allows users to access resources within a Virtual Private Cloud (VPC) securely. In this article, we will demonstrate how to create a Client VPN in AWS using Terraform and integrate it with Okta for authentication and self service.&lt;/p&gt;

&lt;h4&gt;
  
  
  Random
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Personally, before I embark on a terraform project using any provider, I make sure that I am convenient using their services on the web console before automation and okta is not an exception, so if you are a beginner i will advise you understand the manual process before automation to organize your thought on how find and use the right terraform resources. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But if you are familiar with Okta and AWS you can just skip the manual step and go straight to write the terraform configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Okta account configuration
&lt;/h2&gt;

&lt;p&gt;To start, we need to configure Okta as our Identity Provider (IdP). If you don't have an Okta account, you can sign up for a free developer account.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login to your Okta account to get the organization name, base url and api token. The org_name and base_url can be gotten from the url after log in (check the image below)&lt;/li&gt;
&lt;li&gt;For my test environment account, check the image&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;org_name  = "trial-7458580"&lt;br&gt;
   base_url  = "okta.com"&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%2Fg9pcls5397lozjqeadwk.jpeg" 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%2Fg9pcls5397lozjqeadwk.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  And to get the api key
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Click on the “Admin” button&lt;/li&gt;
&lt;li&gt;At the left-hand nav bar,Click “Security” and under security click on the “API” tab&lt;/li&gt;
&lt;li&gt;Click on the “Tokens” tab and click “Create Token” to get your token &lt;/li&gt;
&lt;/ul&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%2F45322bg2fsvh33zx8usi.jpeg" 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%2F45322bg2fsvh33zx8usi.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Okta Terraform Configuration
&lt;/h2&gt;

&lt;p&gt;The Okta provider is used to manage authentication and authorization for applications and services in the cloud. In this code snippet, the provider is being configured with the required parameters, such as the organization name and base URL. Additionally, an API token is provided for testing purposes, which can be generated from the Okta security page. This code demonstrates the ease of integrating Okta into your infrastructure code, allowing for efficient and secure management of your cloud applications.&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%2F6xzzeka9cjo7p2v7dwoc.jpeg" 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%2F6xzzeka9cjo7p2v7dwoc.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Creating the SAML applications in order to download the provider's .xml file to be uploaded to aws&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;The terraform file will be creating two SAML applications, a SAML application for single sign-on (SSO) and another SAML application to access the AWS Self Service Page. The below section of the code is used to create a SAML application for single sign-on (SSO) VPN authentication. Specifically, it is creating an Okta SAML application for AWS Client VPN. The okta_app_saml resource is used to define the configuration of the application, including the label, SSO URL, recipient, destination, audience, subject name ID template, response signing, signature and digest algorithms, authentication context class reference, and self-service accessibility. Additionally, it includes an attribute statement for specifying group information and a lifecycle block to ignore changes to the groups attribute. The code is designed to help streamline the process of setting up SSO VPN authentication.&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%2F2a43m73mcvoadilvzmws.jpeg" 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%2F2a43m73mcvoadilvzmws.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This section creates a SAML application for self-service, this enables users to download the latest version of the application after any administrator modification or updates to the network&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%2Fopnkr04y7hg5duaff3ad.jpeg" 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%2Fopnkr04y7hg5duaff3ad.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a group and assigning the apps to the group
&lt;/h3&gt;

&lt;p&gt;The first resource block creates an Okta group that can be used to organize users within an application. The Okta_group resource requires a name and a description to be provided. The name and description help identify the group in the Okta console and provide a brief description of the group's purpose.&lt;/p&gt;

&lt;p&gt;The second and third resource blocks assign an Okta application to the group created in the first resource block. The Okta_app_group_assignment resource allows you to specify an Okta app_id and a group_id that the application should be assigned to. This assignment enables all users within the group to access the assigned application.&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%2Flhi99ris79s8nwgmeokl.jpeg" 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%2Flhi99ris79s8nwgmeokl.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating app users&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This block creates Okta users. The Okta_user resource requires an email address, first name, last name, login, and password to be provided. The login is usually set to the user's email address, and the password is provided in plain text. For security purposes, it's recommended to use a secure password and a Terraform variable to store the password. You can also enable password change inside the this resource&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%2Futoweialpakb9sis4quz.jpeg" 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%2Futoweialpakb9sis4quz.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding the users to the group with access to the apps&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This resource block adds users to the group created. The Okta_group_memberships resource requires a group_id and a list of user ids to be provided. Once the users are added to the group, they will have access to any applications assigned to that group.&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%2F3qjt929nre6hpnn6leoh.jpeg" 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%2F3qjt929nre6hpnn6leoh.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 3: Run terraform commands to create okta resources
&lt;/h2&gt;

&lt;p&gt;cd into the directory —- okta-module/  and run the terraform commands&lt;/p&gt;

&lt;p&gt;$ terraform init&lt;br&gt;
$ terraform plan&lt;br&gt;
$ terraform apply&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 4: Log in to Okta admin account to copy the App metadata
&lt;/h2&gt;

&lt;p&gt;The okta terraform config creates two applications on okta.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The self-service app&lt;/li&gt;
&lt;li&gt;The SSO app&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Copy the Self service and SSO metadata of the provider. These two are for the different apps created on okta&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%2Fr5q24dwtgb3l6r7ij4bs.jpeg" 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%2Fr5q24dwtgb3l6r7ij4bs.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To download the metadata for both &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to “applications”
&lt;/li&gt;
&lt;li&gt;select one of the apps created, then click on “Sign On” tab &lt;/li&gt;
&lt;/ul&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%2Fawfmwcx9ta6dxr9hfwjc.jpeg" 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%2Fawfmwcx9ta6dxr9hfwjc.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the Metadata URL and paste in the browser to save and download it with the .xml extension&lt;/li&gt;
&lt;/ul&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%2Fjdqdt0o9j6erbxjze7bs.jpeg" 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%2Fjdqdt0o9j6erbxjze7bs.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fantastic, we now have the SAML application metadata ready to be uploaded to AWS as the provider's SAML file, wooray. The image below shows how the metadata is being uploaded to AWS using the "aws_iam_saml_provider" resource, this will be explained in detail in &lt;a href="https://dev.to/surelay/how-to-set-up-a-secure-aws-client-vpn-with-okta-integration-sso-and-self-service-using-terraform-part-2-40b2"&gt;Part 2&lt;/a&gt;. &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%2F0v4w9ju423qa8aotlkpc.jpeg" 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%2F0v4w9ju423qa8aotlkpc.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;p&gt;You can find the Okta module in my &lt;a href="https://github.com/devmatthew1/terraform-aws-clientvpn-okta" rel="noopener noreferrer"&gt;Github page&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Please like, comment and share to help improve this article.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>terraform</category>
    </item>
    <item>
      <title>How To Recover Access To EC2 Instance After Losing Pem File(SSH Keys) 2022</title>
      <dc:creator>Fadare shola</dc:creator>
      <pubDate>Fri, 08 Jul 2022 18:00:42 +0000</pubDate>
      <link>https://dev.to/surelay/how-to-recover-access-to-my-ec2-instance-after-losing-pem-filessh-keys-2022-133d</link>
      <guid>https://dev.to/surelay/how-to-recover-access-to-my-ec2-instance-after-losing-pem-filessh-keys-2022-133d</guid>
      <description>&lt;p&gt;Losing credentials or log-in details to any platform or Infrastructure can be frustrating and can have a lot of consequences which is why we must protect our security credentials with all intentions. &lt;/p&gt;

&lt;p&gt;Imagine losing credentials to your vault and you can't access your money &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r3rfgl9zkcp7pxiga9q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r3rfgl9zkcp7pxiga9q.jpg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Never lost my ssh keys tho. So this article is a request from someone and I'm writing just to show a walk-through of how to recover missing Pem file to an AWS instance. let's go&lt;/p&gt;

&lt;h2&gt;
  
  
  RECOVERING ACCESS TO MY EC2 INSTANCE AFTER LOSING PEM FILE
&lt;/h2&gt;

&lt;p&gt;For Pem file recovery to be possible, the lunched instance with the missing Pem file must be an EBS-Backed Instance because it is not possible on an instance backed by an instant store.&lt;/p&gt;

&lt;p&gt;Assume that your instance with lost Pem file is "Lost pem server"&lt;/p&gt;

&lt;p&gt;I. To confirm the backed-storage type&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Click/Check the instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the “storage” tab.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87722r17tfjf1fd4l7mw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87722r17tfjf1fd4l7mw.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;II. Launch a Recovery Instance&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Launch the “Recovery Instance” in the same AZ as the “Lost pem server”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To Launch a New Instance in the same Availability Zone as the instance(Lost pem server) with the missing Pem file….Make sure to check which AZ the instance is running(The above is running in us-east-2a).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the same network(VPC) and subnet as the old instance(Lost pem server).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;III. Create key pair for the new instance(Recovery server) and connect to it using ssh. Be sure you can connect to the instance.&lt;/p&gt;

&lt;p&gt;IV. Now stop the old instance(Lost pem server). &lt;/p&gt;

&lt;p&gt;V. Detach the EBS volume connected to the “Lost pem server”.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Click on the instance with lost Pem and select the “Storage” Tab.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll down to blocked devices and click on the ID for the Root Device. In my case, the root device is &lt;strong&gt;dev/sda1&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fse6vbf6pr2d4uai0nyhn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fse6vbf6pr2d4uai0nyhn.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make sure the Root Storage is still selected, then click on Action&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, select “Detach volume”&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0r6rmc6fgtxlin6h43im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0r6rmc6fgtxlin6h43im.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to “volumes” under EBS(Elastic Block Store) and select the volume you previously detached from the “Lost pem server”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F435afhvm1eiatf5p0glb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F435afhvm1eiatf5p0glb.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the volume and click “Action” &lt;/li&gt;
&lt;li&gt;Select “Attach Volume”.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcb91lwxcft7mgjbp0x7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcb91lwxcft7mgjbp0x7.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the recovery server(Recovery Server).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fje0wpzubcz3yin3i2vlt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fje0wpzubcz3yin3i2vlt.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;VI. Go back to the shh terminal to the “Recovery server” and check the EBS volume &lt;br&gt;
&lt;strong&gt;NOTE:&lt;/strong&gt; The attached EBS volume won’t mount automatically, so you have to mount it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to your terminal and ssh into the Recovery server. In my case, I’m using &lt;strong&gt;WSL&lt;/strong&gt; in &lt;strong&gt;visual studio&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Enter the following commands
&lt;/h2&gt;

&lt;p&gt;I. Optionally: you might want to copy the pem file from where it is to the .ssh folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp /mnt/c/Users/YourName/desktop/pem/recovery.pem ~/.ssh/recovery.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;II. Connect to the instance using SSH&lt;/p&gt;

&lt;p&gt;III. To check the list of storage on the device to see if the attached EBS was mounted or not. Though it doesn’t mount automatically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsblk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fam01o3miupb3etf44ftf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fam01o3miupb3etf44ftf.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NOTE: The attached EBS(XVDF) has not been mounted to any path as you can see in the screenshot above.&lt;/p&gt;

&lt;p&gt;IV. Also, confirm that the attached EBS is not empty because u can’t mount an empty EBS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo file -s /dev/xvdf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output: /dev/xvdf: DOS/MBR boot sector, extended partition table (last)&lt;/p&gt;

&lt;p&gt;Output like this means the drive is not empty, so you can go ahead and mount.  &lt;/p&gt;

&lt;p&gt;V. Create a temporary directory to mount the EBS volume(for the Lost pem server) in the Recovery server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir /mnt/tempvolume 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The path = /mnt/tempvolume&lt;/p&gt;

&lt;p&gt;VI. Mount the storage on path /mnt/tempvolume. Mount the drive with a number at the end &lt;strong&gt;“/dev/xvdf1”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/dev/xvdf1&lt;/strong&gt; is the disk to be mounted.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mount /dev/xvdf1 /mnt/tempvolume 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;VII. Check if the EBS has mounted&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsblk  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lqdl3btye5zwseqw0jb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lqdl3btye5zwseqw0jb.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check the list of storage on the device again.&lt;/p&gt;

&lt;p&gt;VIII. Copy the SSH key of your “Recovery server” into the attached drive belonging to the “Lost pem server”&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp .ssh/authorized_keys /mnt/tempvolume/home/ubuntu/.ssh/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: Ubuntu in path /mnt/tempvolume/home/ubuntu/.ssh/ is the server name, it can be ec2-user if u launched linux server.&lt;/p&gt;

&lt;p&gt;IX. Check the list of contents in the temporary location on the storage you copied the key to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -lah /mnt/tempvolume/home/ubuntu/.ssh/ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmidqsz9xbemjkf8qkdgk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmidqsz9xbemjkf8qkdgk.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The key “Authozied_keys” is now in the folder you copied it to.&lt;/p&gt;

&lt;p&gt;X. Unmount the attached storage from the “Recovery server so you can attach it back to the “Lost pem server”.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo umount /mnt/tempvolume/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;XI. Check if the disk has unmounted.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsblk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3c1dchgx1kz0fezcd58.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3c1dchgx1kz0fezcd58.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The mount point of /dev/xvdf1 is no longer  /mnt/tempvolume&lt;/p&gt;

&lt;p&gt;XII. Now detach the attached “Lost pem EBS” from the “Recovery server” to attach it back to its original server “Lost pem server”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fei665dwjmsv4cpn4vmx3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fei665dwjmsv4cpn4vmx3.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;XIII. Attached the EBS to the  “Lost pem server” and edit the name to &lt;strong&gt;/dev/sda1&lt;/strong&gt; and save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4sps7gbj221yanuicuxv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4sps7gbj221yanuicuxv.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fserhxvuvqso4cmdnwoha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fserhxvuvqso4cmdnwoha.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To confirm the time the EBS was attached, check “Attachment time”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg4l075raz2ejudr9nige.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg4l075raz2ejudr9nige.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;br&gt;
XIV. Connect to the “Lost pem server” with the key of the “Recovery Server”.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -i "ggfgvfv.pem" ubuntu@ec2-3-145-xxx-92.us-east-2.compute.amazonaws.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;XV. Connect to the “Lost pem server” with the key of the “Recovery Server”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3idu4kgkxi1rb44nruuj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3idu4kgkxi1rb44nruuj.png" alt="Image description" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NOTE: Don’t forget to terminate the instance if it’s not a free tier instance to avoid extra cost.&lt;/p&gt;

&lt;p&gt;Thank you and next time don't misplace your key 😄&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How To Identity Components In A Design Mockup To Build A React Application</title>
      <dc:creator>Fadare shola</dc:creator>
      <pubDate>Sat, 28 May 2022 17:15:01 +0000</pubDate>
      <link>https://dev.to/surelay/how-to-identity-components-in-a-design-mockup-to-build-a-react-application-86g</link>
      <guid>https://dev.to/surelay/how-to-identity-components-in-a-design-mockup-to-build-a-react-application-86g</guid>
      <description>&lt;p&gt;Are you curious about React JS as a JavaScript developer and can’t wait to start building something interesting with it? If YES let's journey together. &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%2Fo4kdklnqap5filj2fye2.jpg" 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%2Fo4kdklnqap5filj2fye2.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s talk about React&lt;/p&gt;

&lt;h2&gt;
  
  
  What is React
&lt;/h2&gt;

&lt;p&gt;React is a JavaScript library for building user interfaces. It is about building JavaScript applications that can scale. React apps don’t run on the server they run in the browser.&lt;/p&gt;

&lt;p&gt;Now let jump into WHY we use React.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why use React
&lt;/h2&gt;

&lt;p&gt;As your application becomes huge and complex, targeting elements in the DOM of your application becomes more stressful. Also, the UI state of the application becomes difficult to manage with vanilla JavaScript. Therefore considering React JS is an efficient way of building scalable JavaScript applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  HOW TO IDENTIFY COMPONENTS IN A DESIGN MOCKUP
&lt;/h2&gt;

&lt;p&gt;Wow, now you know what React JS is and why you should build your applications with it. To build applications with React you need to know and understand the steps required to convert mockups into making a React application but this lesson is on Splitting the Mockup Into “useful Components”. The word “useful components” is deliberate as any section can be a component but knowing when not to make component is also important.&lt;/p&gt;

&lt;h1&gt;
  
  
  Split the mockup into components
&lt;/h1&gt;

&lt;p&gt;Pay attention here, To build a React application you have to break down the UI(User Interface) design into what is referred to as components. &lt;/p&gt;

&lt;h2&gt;
  
  
  What are components
&lt;/h2&gt;

&lt;p&gt;Components allow you to write reusable, manageable and maintainable code. React uses components to build user interfaces. Working with components makes it easier to work with teams and also makes it easier to manage the code.&lt;/p&gt;

&lt;p&gt;Now take a look at the image below, it’s a regular web page with a header, sidebar, headline and article content section. These sections of the page are what are referred to as components(the header component, sidebar component etc.) from the UI point of view. &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%2Fw3u7wkhjh5umoh8s25cm.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%2Fw3u7wkhjh5umoh8s25cm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: If you are trying to divide a mockup page into components, One technique to be used is the &lt;a href="https://en.wikipedia.org/wiki/Single-responsibility_principle" rel="noopener noreferrer"&gt;single responsibility principle&lt;/a&gt; which means that a component should ideally only do one thing. If the component becomes complex, it should be decomposed into smaller subcomponents which also perform one function.&lt;/p&gt;

&lt;p&gt;For example, the header, sidebar, headline, and article content section component displays only the header, sidebar, headline and article content section respectively.&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%2Fw3u7wkhjh5umoh8s25cm.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%2Fw3u7wkhjh5umoh8s25cm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In addition, if you are going to display JSON or Object data then break down your UI into components, where each component matches one piece of your data model. Let me use the example on the official React page to demonstrate the understanding of how to break down components.&lt;/p&gt;

&lt;p&gt;Example: Assuming you have been given the mockup design and with an API endpoint with the data below.&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%2Fpxq7gs3xwv0kdcb5nh10.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%2Fpxq7gs3xwv0kdcb5nh10.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
                          Mockup design&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%2Fcbv12mckopm7zy688zne.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%2Fcbv12mckopm7zy688zne.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
                         Sample data&lt;/p&gt;

&lt;p&gt;Now let’s analyze the mockup with respect to the given JSON data to determine our components&lt;/p&gt;

&lt;h1&gt;
  
  
  I personally take these steps to determine components in a mockup
&lt;/h1&gt;

&lt;p&gt;In no particular order&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Draw a box around the contents of the mockup that are strictly values from the JSON data. &lt;/li&gt;
&lt;li&gt;Draw a box around every section of the UI that are reusable.&lt;/li&gt;
&lt;li&gt;Multiple values from the JSON or Object data should be in a single box if there are to be displayed as one content(eg. The product row).&lt;/li&gt;
&lt;li&gt;Draw a box around inputs of forms(should contain all input types needed).&lt;/li&gt;
&lt;li&gt;Wrap smaller boxes with bigger ones in case of subcomponents.
Static content and non-reusable can be part of a wrapping box not as the box on its own.&lt;/li&gt;
&lt;li&gt;Cover all contents in one outer box which represents the outermost component.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After carefully analyzing the mockup and JSON data, you should have something like the image below.&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%2F7jh97vw4xrq4ez46djdh.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%2F7jh97vw4xrq4ez46djdh.PNG" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The numbers in the image correspond to the numbers below.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;FilterableProductTable (orange box): The outer box for the entire example&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SearchBar (blue box): All user’s input box&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;product table (green box): Displays and filters the data collection based on user input&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ProductCategoryRow (turquoise box): The heading for each category&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ProductRow (red box): The row for each product&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now that you have been able to identify the components from the UI point of view, the next thing to do is to start coding i.e turning the components into React components. In the next article we will discuss on how to code a React component with examples but before then let's know what a React component is in it simplest form.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basics of writing a React component
&lt;/h2&gt;

&lt;p&gt;A React component is simply a JavaScript function with the function name starting with Uppercase. The function also returns the HTML code you want to return to the DOM. In React the HTML to be returned is regarded as jsx(note the use of className below as a substitute for class in normal HTML) just to remind you that it isn’t pure HTML but jsx(JavaScript XML).  &lt;/p&gt;

&lt;p&gt;Basic React component sample&lt;/p&gt;

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

function Person(){

    return(
        &amp;lt;div className="person"&amp;gt;
            &amp;lt;h1&amp;gt;James&amp;lt;/h1&amp;gt;
            &amp;lt;p&amp;gt; Your age is: 20&amp;lt;/p&amp;gt; 
        &amp;lt;/div&amp;gt;
    );
}



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

&lt;/div&gt;

&lt;p&gt;Thanks for reading and hopefully someone finds this useful. &lt;br&gt;
Please leave a comment to help improve this article.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Quick Steps To Host A React Application Using Firebase</title>
      <dc:creator>Fadare shola</dc:creator>
      <pubDate>Mon, 23 May 2022 23:18:11 +0000</pubDate>
      <link>https://dev.to/surelay/quick-steps-to-host-a-react-application-using-firebase-39o2</link>
      <guid>https://dev.to/surelay/quick-steps-to-host-a-react-application-using-firebase-39o2</guid>
      <description>&lt;p&gt;Yeah, you finished a React side project and you can't wait for it to be live. Don't stress Firebase is here to put a smile on your face. Oh Firebase is superman, so you know yourself.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjc93s4vxzb292pkml6fp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjc93s4vxzb292pkml6fp.jpg" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Firebase
&lt;/h2&gt;

&lt;p&gt;Let me quickly introduce Firebase that's if you have never heard of it. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Firebase is an app development platform that helps you build and grow apps and games users love. Backed by Google and trusted by millions of businesses around the world.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But today we will be making use of the Firebase hosting service with step-by-step guide to deploy a react application. let's go&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a firebase account if you have not or login to firebase if you have one.&lt;br&gt;
&lt;a href="https://firebase.google.com/" rel="noopener noreferrer"&gt;https://firebase.google.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click “Go to console” at the top right corner of the home page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click “Add Project” to add a new project and follow the steps&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi1ztrzcb1vib9dwy564.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi1ztrzcb1vib9dwy564.PNG" alt="Image description" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Enter the project name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Turn On and enable google analytics for the project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose “Default account for firebase” as the google analytics account.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click “Create project”&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Install firebase tools globally on your computer using the command.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g firebase-tools
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note : node.js must be installed on your system&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now login to firebase in your terminal, to do this you must be inside the root directory of your React project before you enter the login command.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;firebase login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;When you see the login command response “Allow Firebase to collect CLI usage and error reporting information”  enter YES.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee130i0ws4p3i4ew2v7b.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee130i0ws4p3i4ew2v7b.PNG" alt="Image description" width="800" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you enter yes it will redirect you to the Google authentication/sign-in page, then click “ALLOW” to login successfully.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj5ikot6edyrad4zuk5hv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj5ikot6edyrad4zuk5hv.PNG" alt="Image description" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the react Build command on your application if you have not, to ensure that you are hosting the build version of your application.
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now initialize Firebase in your project and answer the questions that follows
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;firebase init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Are you ready to proceed? (Y/n) YES&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Which Firebase features do you want to set up for this directory? &lt;/p&gt;

&lt;p&gt;To select an option&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use up and down arrow to navigate.&lt;/li&gt;
&lt;li&gt;Press Space to select features&lt;/li&gt;
&lt;li&gt;then Enter to confirm your choices &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Selected option &amp;gt; Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Next select “use exiting project” in order to pick the project created initially in the Firebase console. Select the project you want&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next question is :  What do you want to use as your public directory? (public) build&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Type “build” as the answer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Next question is : Configure as a single-page app (rewrite all urls to /index.html)? (y/N)&lt;br&gt;
Type “y” as the answer&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next question is :Set up automatic builds and deploys with GitHub? (y/N)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Type “N” as the answer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next question is :File build/index.html already exists. Overwrite?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Type “N” as the answer&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75e4jw9yvjyrr13au5l8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F75e4jw9yvjyrr13au5l8.PNG" alt="Image description" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the deploy command to host the application on firebase.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Firebase deploy 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wow that was easy and fast. &lt;/p&gt;

&lt;p&gt;Thanks for reading and please leave a comment to help improve this article&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>react</category>
      <category>firebase</category>
    </item>
  </channel>
</rss>
