<?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: Josue Bustos</title>
    <description>The latest articles on Forem by Josue Bustos (@josuebustos).</description>
    <link>https://forem.com/josuebustos</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%2F233041%2Fe9411e8e-a142-491a-b3dc-22a2a5fd99a6.png</url>
      <title>Forem: Josue Bustos</title>
      <link>https://forem.com/josuebustos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/josuebustos"/>
    <language>en</language>
    <item>
      <title>Post Messages To Slack Using AWS Lambda Function URLs</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Sun, 01 May 2022 00:12:25 +0000</pubDate>
      <link>https://forem.com/josuebustos/post-messages-to-slack-using-aws-lambda-function-urls-5f2a</link>
      <guid>https://forem.com/josuebustos/post-messages-to-slack-using-aws-lambda-function-urls-5f2a</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This tutorial will show you how to post messages to Slack apps using their Incoming Webhook API and the AWS Lambda Function URL.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is an AWS Lambda Function URL?&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A function URL is a dedicated HTTP(S) endpoint for your Lambda function. You can create and configure a function URL through the Lambda console or the Lambda API. Lambda automatically generates a unique URL endpoint for you when you make a function URL.&lt;/em&gt; -- AWS docs. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learn more about AWS Function URLS &lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a Slack Incoming Webhook?&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Incoming Webhooks are a simple way to post messages from apps into Slack. Creating an Incoming Webhook gives you a unique URL to which you send a JSON payload with the message text and some options. You can use all the usual formatting and layout blocks with Incoming Webhooks to make the messages stand out. -- Slack API Docs&lt;/em&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learn more about Slack Incoming Webhooks &lt;a href="https://api.slack.com/messaging/webhooks" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To follow along, you will need the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A AWS account (create one &lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;AWS CLI installed and configured. Set up instructions &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A Slack account (create one &lt;a href="https://slack.com/get-started" rel="noopener noreferrer"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;AWS Lambda Function (fundamentals)&lt;/li&gt;
&lt;li&gt;AWS IAM Roles, Policies (fundamentals).&lt;/li&gt;
&lt;li&gt;Comfortable executing terminal commands without GUI.&lt;/li&gt;
&lt;li&gt;Comfortable using and debugging Node.js and JavaScript.&lt;/li&gt;
&lt;/ul&gt;



&lt;blockquote&gt;
&lt;p&gt;Cool Idea 💡: In the future, you can use this example in an AWS SAM or AWS CDK project. Like this one &lt;a href="https://dev.to/josuebustos/aws-cdk-node-js-hello-world-38c5"&gt;AWS CDK Node.JS: Hello World&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;



&lt;p&gt;&lt;strong&gt;Okay, let's get started!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Slack App Channel
&lt;/h2&gt;

&lt;p&gt;First, you want to predetermine which Slack app channel to use to receive incoming messages. For example, you can use an existing channel like #random or create a new channel. For this example, I will be using the #my-test-app naming convention. See the image below for reference.&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%2Fztg7rdxk4ncovpa7civr.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%2Fztg7rdxk4ncovpa7civr.png" alt="select channel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a Slack App
&lt;/h2&gt;

&lt;p&gt;To receive messages from external applications, say from your website or a mobile application, you must configure your Slack "API app" settings.&lt;/p&gt;

&lt;p&gt;Sign in to your Slack account and navigate the Slack API portal "Your Apps" page. Copy-paste this link to jump there now: &lt;a href="https://api.slack.com/apps" rel="noopener noreferrer"&gt;https://api.slack.com/apps&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If this is your first time creating a Slack account &lt;strong&gt;Your Apps&lt;/strong&gt; list will be empty. Otherwise, you will see a list of your API apps.&lt;/p&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2uzsor9qvl35use398xl.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%2F2uzsor9qvl35use398xl.png" alt="create app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, click on the &lt;strong&gt;Create New App&lt;/strong&gt; or &lt;strong&gt;Create an App&lt;/strong&gt; green button to open the "Create an app" modal window.&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;From scratch&lt;/strong&gt; option.&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%2Fr3ap78icm0yy6p44os8m.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%2Fr3ap78icm0yy6p44os8m.png" alt="from scratch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;App Name&lt;/strong&gt;, type your app name. I use "Send Me Tacos" for this example, but you can choose anything you like. :)&lt;/p&gt;

&lt;p&gt;Next, use the dropdown menu to locate the workspace where you want to send messages. The workspace is the name of the account you created. In this example, I named it "Taco Paradise".&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Can you tell I'm thinking about yummy food?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When done, click on &lt;strong&gt;Create App&lt;/strong&gt;. This last step will take you to a new page. See the image for reference.&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%2Fcqeq714xe9wa6nrcad2o.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%2Fcqeq714xe9wa6nrcad2o.png" alt="create app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After creating your new app, stay on the same page and scroll down to locate the &lt;strong&gt;Incoming Webhooks&lt;/strong&gt; link on the left menu list. Click on the link to display the webhook configuration page. Notice how next to the words "Activate Incoming Webhooks" is set to off. &lt;/p&gt;

&lt;p&gt;Click on that switch to enable it. It should turn green and display the text "On."&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%2F4a3tclmm8qbokitep7hw.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%2F4a3tclmm8qbokitep7hw.png" alt="app nane"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well done!&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a Webhook
&lt;/h3&gt;

&lt;p&gt;Finally, click on the &lt;strong&gt;Add New Webhook to Workspace&lt;/strong&gt; button to create a webhook URL. This step opens a new window.&lt;/p&gt;

&lt;p&gt;In the new window, notice where it says, "Test App requires a channel to post to as an app" click on the dropdown menu and select the channel you want to send your messages.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: We referenced this step at the beginning of the tutorial. In this example, I chose #my-test-app.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can now take your new webhook URL for a spin. Using your preferred terminal application or API client, Copy-paste YOUR sample curl request into the API client or terminal and execute the command/s.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Replace the webhook URL with yours.&lt;/p&gt;
&lt;/blockquote&gt;

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

curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Content-type: application/json'&lt;/span&gt; &lt;span class="nt"&gt;--data&lt;/span&gt; &lt;span class="s1"&gt;'{"text":"Hello, World!"}'&lt;/span&gt; https://hooks.slack.com/services/5CKKM62NX5J/8G8XMGQ3RXM/aadCZ8act32sLJ7dgaC8HLrx


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

&lt;/div&gt;

&lt;p&gt;After executing the command, navigate back to the Slack app, web, or mobile and notice the new message; "Hello, World!". &lt;/p&gt;

&lt;p&gt;Tada!&lt;br&gt;
SO COOL!!!&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%2F9bov63sl4xay4vkf4qo4.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%2F9bov63sl4xay4vkf4qo4.png" alt="hello world"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may not notice it right away, but two things happened. 1) Your incredible message was displayed in the Slack app, and 2) your Slack API app is now integrated into the Slack app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cool Idea 💡  : You can use Postman and Insomnia API clients to test and prototype your Slack webhooks and AWS Function URLs. ;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can stop here and call it a day, but continue the next section if you want to flex.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create an AWS Lambda Function URL
&lt;/h2&gt;

&lt;p&gt;Right then! &lt;/p&gt;

&lt;p&gt;Let's take this tutorial to the next level. In this next section, I will show you how to create and configure an AWS Lambda Function URL so you can use the Slack Incoming Webhooks.😃 &lt;/p&gt;

&lt;p&gt;Also, we're going to use the AWS command-line interface to create AWS identity permission called roles and policies to allow the function URL to work. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you need a refresher, visit the AWS IAM docs &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ready!? Let's go!&lt;/p&gt;

&lt;h3&gt;
  
  
  Create AWS IAM Role
&lt;/h3&gt;

&lt;p&gt;First, we need to access your ARN, which is AWS specific formatted string. Similar to this one: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;arn:aws:iam::123456789123:user/username&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And to access that, we can execute the following AWS CLI command in the terminal like so:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Change Paulo to your user name&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-user &lt;span class="nt"&gt;--user-name&lt;/span&gt; Paulo


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

&lt;/div&gt;

&lt;p&gt;The response should look similar to the JSON text below. Save your text somewhere to reference it later, or you can rerun the command.&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"User"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"UserName"&lt;/span&gt;: &lt;span class="s2"&gt;"Paulo"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Path"&lt;/span&gt;: &lt;span class="s2"&gt;"/"&lt;/span&gt;,
        &lt;span class="s2"&gt;"CreateDate"&lt;/span&gt;: &lt;span class="s2"&gt;"2019-09-21T23:03:13Z"&lt;/span&gt;,
        &lt;span class="s2"&gt;"UserId"&lt;/span&gt;: &lt;span class="s2"&gt;"AIDA123456789EXAMPLE"&lt;/span&gt;,
        &lt;span class="s2"&gt;"Arn"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::123456789012:user/Paulo"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Attach AWS Policy to IAM Role
&lt;/h3&gt;

&lt;p&gt;Next, create a file called &lt;strong&gt;trust-policy.json&lt;/strong&gt; &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;trust-policy.json&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Service"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lambda.amazonaws.com"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


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

&lt;/div&gt;

&lt;p&gt;Pause here and change the role name &lt;strong&gt;function-url-role&lt;/strong&gt; to something else or keep it until you create another one.  &lt;/p&gt;

&lt;p&gt;Once you're ready, open your terminal or command prompt, copy-paste the command below, and press enter. &lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam create-role &lt;span class="nt"&gt;--role-name&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="nt"&gt;-url-role&lt;/span&gt; &lt;span class="nt"&gt;--assume-role-policy-document&lt;/span&gt; file://trust-policy.json


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

&lt;/div&gt;

&lt;p&gt;A successful response will return some more JSON text.&lt;/p&gt;

&lt;p&gt;This next step will attach an AWSLambdaBasicExecutionRole policy to your newly created IAM role. This policy gives you the basic user permissions to run your function.&lt;/p&gt;

&lt;p&gt;Go ahead and copy-paste and execute the command below into your terminal app.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Remember to replace your function role name with yours. In this example its &lt;strong&gt;function-url-role&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam attach-role-policy &lt;span class="nt"&gt;--role-name&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="nt"&gt;-url-role&lt;/span&gt; &lt;span class="nt"&gt;--policy-arn&lt;/span&gt; arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Create AWS Function URL
&lt;/h3&gt;

&lt;p&gt;In this section, you will create and configure your AWS Lambda Function and enable the new function URL feature with some basic settings.&lt;/p&gt;

&lt;p&gt;First, we need access to the ARN role string. To do that, execute the AWS CLI command below.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;aws iam get-role &lt;span class="nt"&gt;--role-name&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="nt"&gt;-url-role&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The response output should return some JSON similar to the text below. &lt;/p&gt;

&lt;p&gt;Pause for a second and locate your the &lt;strong&gt;"Arn"&lt;/strong&gt; string value which similar to this text &lt;strong&gt;arn:aws:iam::123456789012:role/my-function-url&lt;/strong&gt; and save it somewhere for later.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;terminal&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;JSON&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ouput&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"RoleName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"my-function-url"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"RoleId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AIDA123456789EXAMPLE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Arn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:iam::123456789012:role/my-function-url"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"CreateDate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2022-04-16T22:32:36+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"AssumeRolePolicyDocument"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"Principal"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="nl"&gt;"Service"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lambda.amazonaws.com"&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allows Lambda functions to call AWS services on your behalf."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"MaxSessionDuration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"RoleLastUsed"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"LastUsedDate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2022-04-30T00:29:38+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Region"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"us-west-2"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Prepare Your Files
&lt;/h3&gt;

&lt;p&gt;Before creating an AWS Lambda Function, you need to prepare some code, execute a few AWS CLI commands and finally deploy your project for live testing. For this example, we're going to use JavaScript for Node.js.&lt;/p&gt;

&lt;p&gt;First, create a file called &lt;strong&gt;index.js&lt;/strong&gt;, then prepare the file for editing. Use the command below with your preferred terminal app, or you can manually modify it.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;index.js &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; vim index.js


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

&lt;/div&gt;

&lt;p&gt;Next, copy-paste the following JavaScript code into the vim edit session in the terminal or use your preferred code editor. Make sure to replace the "string" where it says &lt;strong&gt;&amp;lt;-- YOUR WEBHOOK  GOES HERE --&amp;gt;&lt;/strong&gt; with your Slack API webhook URL.&lt;/p&gt;

&lt;p&gt;For example, from this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;path: '&amp;lt;-- YOUR WEBHOOK  GOES HERE --&amp;gt;'&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To this&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;path: '/services/T02S60H1F0Q/B03DH5L14S1/CPHv2eu0ctGgB9g99DNZiNCi'&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;span class="c1"&gt;// index.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;https&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postRequest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hooks.slack.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;-- YOUR WEBHOOK  GOES HERE --&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/x-www-form-urlencoded; charset=UTF-8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Length&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;rawData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;chunk&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;rawData&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;});&lt;/span&gt;

            &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;end&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
                    &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;rawData&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
                &lt;span class="p"&gt;});&lt;/span&gt;
            &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;

        &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nf"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;

        &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;postRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Finally, zip your files using the command below or manually.&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;zip &lt;span class="k"&gt;function&lt;/span&gt;.zip index.js


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

&lt;/div&gt;

&lt;p&gt;You create an AWS Lambda Function using the AWS CLI in the following sections.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create AWS Lambda Function
&lt;/h3&gt;

&lt;p&gt;Pause for a second here. Think of a name for your new function. In this example, I'm using &lt;strong&gt;my-url-function&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Remember that ARN string you saved earlier? Replace the ARN string with yours. &lt;/p&gt;

&lt;p&gt;For example, from this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;--role [YOUR ARN GOES HERE]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To this&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;--role arn:aws:iam::123456789012:role/my-function-url&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When you're ready, copy-paste and execute the following command in the terminal:&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;aws lambda create-function &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--function-name&lt;/span&gt; my-url-function &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--runtime&lt;/span&gt; nodejs14.x &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--zip-file&lt;/span&gt; fileb://function.zip &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--handler&lt;/span&gt; index.handler &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--role&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;YOUR ARN GOES HERE]


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

&lt;/div&gt;

&lt;p&gt;The output should return an extended JSON response with your AWS Lambda Function details.&lt;/p&gt;

&lt;p&gt;You can verify if your lambda function was created by using the following command in the terminal.&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;awd lambda get-functionn &lt;span class="nt"&gt;--function-name&lt;/span&gt; my-url-function


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Enable AWS Function URL
&lt;/h3&gt;

&lt;p&gt;Traditionally, you would have to go through more than a dozen steps to create a simple endpoint using AWS Lambda, API Gateway, and rightfully so when creating secure endpoints, but now there's a better way.&lt;/p&gt;

&lt;p&gt;Execute the following command, and remember to replace your function name with yours.&lt;/p&gt;

&lt;p&gt;From this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;--function-name YOUR-FUNCTION-NAME \&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;--function-name my-url-function \&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;aws lambda create-function-url-config &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--function-name&lt;/span&gt; YOUR-FUNCTION-NAME &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--auth-type&lt;/span&gt; NONE &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--cors&lt;/span&gt; &lt;span class="s1"&gt;'{"AllowOrigins": ["*"],"AllowCredentials": false}'&lt;/span&gt;


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

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: For this demo, the link is public. You're responsible for securing your endpoints in all of your production environments.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Test Your AWS Function URL
&lt;/h3&gt;

&lt;p&gt;Now for the moment you've been waiting for. Use the following command in your terminal and execute.&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="s1"&gt;'&amp;lt;YOUR FUNCTION URL GOES HERE&amp;gt;'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"text": "Feed me Seymour!"}'&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;A successful response should return some JSON text similar to the one below.&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"body"&lt;/span&gt;:&lt;span class="s2"&gt;"ok"&lt;/span&gt;,&lt;span class="s2"&gt;"statusCode"&lt;/span&gt;:200&lt;span class="o"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;If you are successful, you should see another message in the Slack app channel with the text "Feed me, Seymour!".&lt;/p&gt;

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

&lt;p&gt;AND THAT'S IT!&lt;/p&gt;

&lt;p&gt;I hope you leveled up some of your AWS Cloud Serverless skills and enjoyed this tutorial.&lt;/p&gt;

&lt;p&gt;I appreciate you getting this far, and I hope to see you next time!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>AWS Lambda: Send a Message with Discord Webhooks</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Sat, 25 Dec 2021 08:02:07 +0000</pubDate>
      <link>https://forem.com/josuebustos/aws-lambda-send-a-message-with-discord-webhooks-12fa</link>
      <guid>https://forem.com/josuebustos/aws-lambda-send-a-message-with-discord-webhooks-12fa</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Learn how to send a message from AWS Lambda to a Discord channel using Discord's built-in Webhooks function. This tutorial will show you how to configure the AWS Lambda and a Discord webhook endpoint to send messages to a specific Discord channel.&lt;/p&gt;

&lt;p&gt;What is AWS Lambda?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lambda is a compute service that lets you run code without provisioning or managing servers.&lt;/li&gt;
&lt;li&gt;Lambda runs your function only when needed and scales automatically, from a few requests per day to thousands per second.&lt;/li&gt;
&lt;li&gt;You can run code for virtually any type of application or backend service.&lt;/li&gt;
&lt;li&gt;Learn more about AWS Lambda &lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/welcome.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is a Discord Webhook?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Discord's built-in Webhooks function as an easy way to get automated messages and data updates sent to a text channel in your server. Learn more about webhook &lt;a href="https://discord.com/developers/docs/resources/webhook" rel="noopener noreferrer"&gt;here&lt;/a&gt;
)&lt;/li&gt;
&lt;li&gt;Tip: Discord messages have "Rate Limits, meaning you can only send a specific number of messages, or requests to be exact, per second.  You can learn about it &lt;a href="https://discord.com/developers/docs/topics/rate-limits" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;This tutorial assumes you are familiar and comfortable utilizing the terminal, navigating the file system without a GUI, and navigating the AWS Console. To take full advantage of this tutorial, review the list of prerequisites below.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Access to AWS account&lt;/li&gt;
&lt;li&gt;Access to Discord account&lt;/li&gt;
&lt;li&gt;Python installed on your system&lt;/li&gt;
&lt;li&gt;Familiarity with Python programming&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Create a Discord Server
&lt;/h3&gt;

&lt;p&gt;We will first create a Discord server and use the default Discord channel to prepare incoming messages.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you already have a discord server created and a channel ready, you can skip this step and jump to the "Prepare AWS Lambda Layer" section.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Navigate to the Discord website or open the Discord desktop app to access your account. Next, create a discord server by clicking on the green button with the big plus symbol.&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%2F339ljhnktif0zhgqe0jy.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%2F339ljhnktif0zhgqe0jy.png" alt="create now button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the &lt;strong&gt;Create a server&lt;/strong&gt; window, click the &lt;strong&gt;Create My Own&lt;/strong&gt; button.&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%2Fmgfvvmms8f46869mjnx8.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%2Fmgfvvmms8f46869mjnx8.png" alt="create server"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the following &lt;strong&gt;Tell us more about your server&lt;/strong&gt; window, click on the &lt;strong&gt;For me and my friends&lt;/strong&gt; button.&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%2Fcjoc28l3cfhsmje8bbps.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%2Fcjoc28l3cfhsmje8bbps.png" alt="tell us more"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, on the &lt;strong&gt;Customize your server&lt;/strong&gt; window, you can change the server's name in the &lt;strong&gt;Server Name&lt;/strong&gt; field or click on the &lt;strong&gt;Create&lt;/strong&gt; button to complete the server setup.&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%2Fl2k5ec44as7hmf01ux8q.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%2Fl2k5ec44as7hmf01ux8q.png" alt="customize your server"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a Discord Webhook
&lt;/h3&gt;

&lt;p&gt;In this example, I will use the default channel to create my webhook url, but you can create another channel if you desire.&lt;/p&gt;

&lt;p&gt;Locate the &lt;strong&gt;Edit Channel&lt;/strong&gt; button, which looks like a "Gear" icon on the left-hand side of the &lt;strong&gt;Text Channels&lt;/strong&gt; pane. Click on the "Gear" icon to display the settings window.&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%2Fvj5vp6l8hvgt61kykjch.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%2Fvj5vp6l8hvgt61kykjch.png" alt="settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, click on the &lt;strong&gt;Integrations&lt;/strong&gt; button to display Integrations settings. Then click on the &lt;strong&gt;Webhooks&lt;/strong&gt; button to open a new webhooks window.&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%2Foytwxokd57e4pdn09a0v.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%2Foytwxokd57e4pdn09a0v.png" alt="create webhook"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can leave everything as is or if you have more than one channel, use the drop-down menu to select another channel. You can also take this time to change the title of the channel.&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%2F21gbaz1v6qd7vkz3f50a.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%2F21gbaz1v6qd7vkz3f50a.png" alt="change webhook settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And finally, click on the &lt;strong&gt;Copy Webhook URL&lt;/strong&gt; button, which copies the string to your clipboard. Next, close the window by clicking on the "X" button in the top right corner.&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%2Fx50qpm1jaqqxj4lwqlcz.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%2Fx50qpm1jaqqxj4lwqlcz.png" alt="copy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it!  Move on to the next section to configure your AWS Lambda.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prepare AWS Lambda Layer
&lt;/h2&gt;

&lt;p&gt;To utilize Python packages in an AWS Lambda project, you must first upload a zip file containing all your Python packages to an &lt;strong&gt;AWS Lambda Layer&lt;/strong&gt;. I will show you how to set that up in the following few sections.&lt;/p&gt;

&lt;p&gt;Let's begin.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create local directory
&lt;/h3&gt;

&lt;p&gt;We're only installing one package called &lt;strong&gt;discord-webhook&lt;/strong&gt;to keep our project simple.  For more code examples and usage visit the link &lt;a href="https://pypi.org/project/discord-webhook/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, create a directory/folder and give it a unique name or open a terminal and type the command below like so:&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;my-project


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Download Python packages
&lt;/h3&gt;

&lt;p&gt;For this next step, you will need to access the Terminal window. If it's not already open, open the Terminal window and type the following command to change the directory and install the &lt;strong&gt;discord-webhook&lt;/strong&gt; package in the current directory.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Desktop/my-project &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pip3 &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; discord-webhook


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

&lt;/div&gt;

&lt;p&gt;The &lt;strong&gt;-t&lt;/strong&gt; flag forces Python to install all your packages in the current folder by "targeting" the current working directory/folder. In our case, it's the current directory indicated by the period symbol &lt;strong&gt;"."&lt;/strong&gt; located after the "-t" and "discord-webhook" is our Python package.&lt;/p&gt;

&lt;p&gt;Next, remove unnecessary files by typing the command below like so:&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;dist-info __pycache__


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

&lt;/div&gt;

&lt;p&gt;Suppose you see a warning like the one below. It just means that a specific folder doesn't exist. Some systems include this folder when downloading python packages.&lt;/p&gt;

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

rm: __pycache__: No such file or directory


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

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;At the time of this writing, the current version of discord-webhook is 0.14.0.&lt;/p&gt;
&lt;/blockquote&gt;



&lt;h3&gt;
  
  
  Compress and Zip directory
&lt;/h3&gt;

&lt;p&gt;You can zip the folder manually or use this handy terminal command by typing the following like so:&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;zip &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="nt"&gt;-q&lt;/span&gt; ~/Desktop/my-project.zip &lt;span class="nb"&gt;.&lt;/span&gt;


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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configure AWS Lambda Layer in the cloud
&lt;/h2&gt;

&lt;p&gt;Before launching and executing our main program from the AWS Lambda console, we need to set up our AWS Lambda Layer containing the Python packages you download earlier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create AWS Lambda Layer
&lt;/h3&gt;

&lt;p&gt;Open a web browser and sign in to your Amazon Web Services console. Next, locate the search bar, type "lambda," then click on the &lt;strong&gt;Lambda&lt;/strong&gt; link to navigate the AWS Lambda Function web page. See the image below for guidance.&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%2Ffxi6aouqby6njrfq0f9f.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%2Ffxi6aouqby6njrfq0f9f.png" alt="aws lambda console"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the sidebar on the left-hand side, locate and click on the &lt;strong&gt;Layers&lt;/strong&gt; link to jump to the Layers page. Next, find and click on the &lt;strong&gt;Create layer&lt;/strong&gt; button to initiate the "AWS Lambda Layer" creation process. See the image below for guidance.&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%2Fl8wh63v8wut7ob41g8m6.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%2Fl8wh63v8wut7ob41g8m6.png" alt="create layer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Upload Zip File
&lt;/h3&gt;

&lt;p&gt;Use the list and image below to help fill out the form.&lt;/p&gt;

&lt;p&gt;1) Name: &lt;strong&gt;Discord-Layer&lt;/strong&gt;&lt;br&gt;
2) Description: &lt;strong&gt;Write description for your layer&lt;/strong&gt;&lt;br&gt;
3) Select: &lt;strong&gt;Upload a .zip file&lt;/strong&gt;&lt;br&gt;
4) Upload file: &lt;strong&gt;my-project.zip&lt;/strong&gt;&lt;br&gt;
5) Select architecture: &lt;strong&gt;x86_64&lt;/strong&gt;&lt;br&gt;
6) Select runtimes: &lt;strong&gt;Python 3.9&lt;/strong&gt;&lt;br&gt;
7) Click &lt;strong&gt;Create&lt;/strong&gt; button&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%2F8zqnixfc35a0aci89hzj.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%2F8zqnixfc35a0aci89hzj.png" alt="layer form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Excellent! Now you're ready to create your AWS Lambda Function!&lt;/p&gt;

&lt;h2&gt;
  
  
  Create AWS Lambda Function
&lt;/h2&gt;

&lt;p&gt;On the left-hand sidebar, locate and click on the &lt;strong&gt;Functions&lt;/strong&gt; link, then on your right-hand side, locate and click on the &lt;strong&gt;Create function&lt;/strong&gt; button; this will open a new window.&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%2F9t06clbaxbj4qrv6f0bp.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%2F9t06clbaxbj4qrv6f0bp.png" alt="create lambda function"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, the &lt;strong&gt;Author from scratch&lt;/strong&gt; is selected. Leave it as is and scroll down to fill out the form. You can also use the image below to guide you.&lt;/p&gt;

&lt;p&gt;1) Function Name: &lt;strong&gt;Discord-Webhook&lt;/strong&gt;&lt;br&gt;
2) Runtime: &lt;strong&gt;Python 3.9&lt;/strong&gt;&lt;br&gt;
3) Architechture: &lt;strong&gt;x86_64&lt;/strong&gt;&lt;br&gt;
4) Click &lt;strong&gt;Create function&lt;/strong&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%2F710m8gqqxudmlshiymai.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%2F710m8gqqxudmlshiymai.png" alt="lambda function form"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can leave the rest of the settings and wait a moment for the AWS Function configuration process to finish.&lt;/p&gt;

&lt;h3&gt;
  
  
  Import Python modules
&lt;/h3&gt;

&lt;p&gt;When you arrive at your AWS Function page, scroll to the bottom of the page, locate and click the &lt;strong&gt;Add a layer&lt;/strong&gt; button.&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%2F59q54z4d5fcay750zb5l.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%2F59q54z4d5fcay750zb5l.png" alt="add layer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1) Layer Source: &lt;strong&gt;Custom layers&lt;/strong&gt;&lt;br&gt;
2) Custom layers: &lt;strong&gt;Discord-Layer&lt;/strong&gt;&lt;br&gt;
3) Version: &lt;strong&gt;1&lt;/strong&gt;&lt;br&gt;
4) Click &lt;strong&gt;Add&lt;/strong&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%2Fghzd8muaifcpxg0il3hl.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%2Fghzd8muaifcpxg0il3hl.png" alt="import layer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure Test Event
&lt;/h3&gt;

&lt;p&gt;Before we can execute our AWS Lambda Function, you need to configure a Test event.&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%2Fabzvd5tche4wds0sd6av.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%2Fabzvd5tche4wds0sd6av.png" alt="configure event"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1) Saved Test Events: &lt;strong&gt;MyDiscordEvent&lt;/strong&gt;&lt;br&gt;
2) Click &lt;strong&gt;Create&lt;/strong&gt; button&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%2Fpe7zwg283qtxbusb3o7p.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%2Fpe7zwg283qtxbusb3o7p.png" alt="save event"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Import Python Modules
&lt;/h3&gt;

&lt;p&gt;Now for the fun stuff!&lt;/p&gt;

&lt;p&gt;Go ahead and copy-paste the code below into the cloud nine text editor. Make sure to replace this &lt;strong&gt;&lt;/strong&gt; with your Discord channel url webhook.&lt;/p&gt;


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

&lt;p&gt;&lt;span class="n"&gt;webhook&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DiscordWebhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;replace_with_your_hook&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="n"&gt;embed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DiscordEmbed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;br&gt;
    &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Taco Love&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;br&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You deserve some taco love today!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;br&gt;
    &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;03b2f8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="n"&gt;embed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set_image&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&lt;a href="https://cdn.dribbble.com/users/545781/screenshots/3157610/happy-taco.jpg" rel="noopener noreferrer"&gt;https://cdn.dribbble.com/users/545781/screenshots/3157610/happy-taco.jpg&lt;/a&gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span class="n"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_embed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;embed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;br&gt;
&lt;span class="n"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;span class="k"&amp;gt;return&amp;lt;/span&amp;gt; &amp;lt;span class="p"&amp;gt;{&amp;lt;/span&amp;gt;
    &amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="s"&amp;gt;statusCode&amp;lt;/span&amp;gt;&amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="p"&amp;gt;:&amp;lt;/span&amp;gt; &amp;lt;span class="mi"&amp;gt;200&amp;lt;/span&amp;gt;&amp;lt;span class="p"&amp;gt;,&amp;lt;/span&amp;gt;
    &amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="s"&amp;gt;body&amp;lt;/span&amp;gt;&amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="p"&amp;gt;:&amp;lt;/span&amp;gt; &amp;lt;span class="p"&amp;gt;{&amp;lt;/span&amp;gt;&amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="s"&amp;gt;message&amp;lt;/span&amp;gt;&amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="p"&amp;gt;:&amp;lt;/span&amp;gt; &amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="s"&amp;gt;Hello World&amp;lt;/span&amp;gt;&amp;lt;span class="sh"&amp;gt;"&amp;lt;/span&amp;gt;&amp;lt;span class="p"&amp;gt;}&amp;lt;/span&amp;gt;
&amp;lt;span class="p"&amp;gt;}&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

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

&lt;/div&gt;
&lt;h3&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Send Discord Message&lt;br&gt;
&lt;/h3&gt;

&lt;p&gt;Now, for the moment of truth!&lt;/p&gt;

&lt;p&gt;Open your discord channel and click on the orange &lt;strong&gt;Test&lt;/strong&gt; button.&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%2Flinmx0luctp1gt94iinn.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%2Flinmx0luctp1gt94iinn.png" alt="launch function"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If everything was done correctly, you should see a nice happy taco!&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%2Fz8taemlh13kkg63edv8k.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%2Fz8taemlh13kkg63edv8k.png" alt="happy taco"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  conclusion
&lt;/h3&gt;

&lt;p&gt;Recap:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You created and configured a AWS Lambda Function&lt;/li&gt;
&lt;li&gt;You created and configured a Discord Webhook&lt;/li&gt;
&lt;li&gt;Implemented a Discord API using Python programming language&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  --
&lt;/h2&gt;

&lt;p&gt;If you've gotten this far YOU. ARE. AWESOME! &lt;/p&gt;

&lt;p&gt;At times, working with AWS Console can be a bit discouraging and a bit scary. I hope this tutorial gives you a bit more confidence and more courage to continue pursuing code and any of your cloud certifications!&lt;/p&gt;

&lt;p&gt;Until next time,&lt;/p&gt;

&lt;p&gt;Stay AWSome!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Samsung Galaxy Watch: Controlling WebXR 3D Objects In Real-Time</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Mon, 21 Jun 2021 02:58:26 +0000</pubDate>
      <link>https://forem.com/josuebustos/samsung-galaxy-watch-controlling-webxr-3d-objects-in-real-time-5dnc</link>
      <guid>https://forem.com/josuebustos/samsung-galaxy-watch-controlling-webxr-3d-objects-in-real-time-5dnc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this conceptual playground, I demonstrate how you can control objects in 3D space using A-Frame WebXR, Node.js. Socket.io, and a Samsung Galaxy Watch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To implement the web techonloiges mentioned you need an intermediate to advance HTML, JavaScript practical knowledge. The list of web technologie are as follows:&lt;/p&gt;

&lt;h3&gt;
  
  
  Software
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AR/VR capable broswer&lt;/li&gt;
&lt;li&gt;&lt;a href="https://socket.io"&gt;Socket.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/en/"&gt;Node.JS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aframe.io/"&gt;A-Frame&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Okay, let's jump in!&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up A-Frame
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FYgH72TX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oup3o9yfm9diant7r4fg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FYgH72TX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oup3o9yfm9diant7r4fg.png" alt="a-frame" width="800" height="327"&gt;&lt;/a&gt;&lt;br&gt;
A-Frame is primarily HTML and JavaScript. So all you need to get started is a basic text editor.&lt;/p&gt;

&lt;p&gt;Open your favorite text editor, create, edit, and then copy-paste the following code into &lt;strong&gt;index.html&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- index.html --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="c"&gt;&amp;lt;!-- A-Frame Script --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://aframe.io/releases/1.2.0/aframe.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;a-scene&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;a-box&lt;/span&gt; &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"-1 0.5 -3"&lt;/span&gt; &lt;span class="na"&gt;rotation=&lt;/span&gt;&lt;span class="s"&gt;"0 45 0"&lt;/span&gt; &lt;span class="na"&gt;color=&lt;/span&gt;&lt;span class="s"&gt;"#4CC3D9"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a-box&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;a-plane&lt;/span&gt; &lt;span class="na"&gt;position=&lt;/span&gt;&lt;span class="s"&gt;"0 0 -4"&lt;/span&gt; &lt;span class="na"&gt;rotation=&lt;/span&gt;&lt;span class="s"&gt;"-90 0 0"&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"4"&lt;/span&gt; &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"4"&lt;/span&gt; &lt;span class="na"&gt;color=&lt;/span&gt;&lt;span class="s"&gt;"#7BC8A4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a-plane&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;a-sky&lt;/span&gt; &lt;span class="na"&gt;color=&lt;/span&gt;&lt;span class="s"&gt;"#ECECEC"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a-sky&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/a-scene&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;

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

&lt;/div&gt;





&lt;blockquote&gt;
&lt;p&gt;You can also visit the &lt;a href="https://aframe.io/"&gt;A-Frame&lt;/a&gt; website and explore other sample projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not sure if your browser is capable of displaying WebXR content? Not to worry, visit this link to the "&lt;a href="https://immersive-web.github.io/webxr-samples"&gt;Does my browser support WebXR&lt;/a&gt;" web page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GkgBmlAg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/moup1wsuhox3u9t1zz4a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GkgBmlAg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/moup1wsuhox3u9t1zz4a.png" alt="webxr" width="683" height="405"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Accesing Wearable Device Sensors
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9r6d9M46--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/apivu4s380rcgbvgu8p2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9r6d9M46--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/apivu4s380rcgbvgu8p2.png" alt="tizen" width="800" height="540"&gt;&lt;/a&gt;&lt;br&gt;
A Samsung Galaxy Watch can be either a wearable Web application, a Native or Hybrid derived application. My example is a Web application, basically a Web site stored on a wearable device.&lt;/p&gt;

&lt;p&gt;To access sensor data, you implement a few lines of code. For example, the following sample JavaScript code below gives us access to Gyroscope sensor data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;gyroscopeRotationVectorSensor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;tizen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sensorservice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getDefaultSensor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GYROSCOPE_ROTATION_VECTOR&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;onGetSuccessCB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sensorData&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Get the gyroscope rotation vector sensor data&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;x: &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;sensorData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;onerrorCB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Error occurred&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;onsuccessCB&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sensor start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;gyroscopeRotationVectorSensor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getGyroscopeRotationVectorSensorData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;onGetSuccessCB&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;onerrorCB&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;gyroscopeRotationVectorSensor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;onsuccessCB&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can view a complete list of available device APIs for the Samsung Galaxy Watch &lt;a href="https://docs.tizen.org/application/web/api/latest/device_api/wearable/index.html"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Moving 3D Objects In Real-Time
&lt;/h2&gt;

&lt;p&gt;And finally, to remotely control objects in 3D space, you need to host and configure your Node.js server to allow socket.io to open a bidirectional real-time connection. You can use the following sample code to get started.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Initiate a Socket,io connection for Node.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;io&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;socket.io&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cfg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./config.json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node-tweet-stream&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="nx"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;tw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;track&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;socket.io&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;tw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;track&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;javascript&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;tw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tweet&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tweet&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tweet&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  Live Demo
&lt;/h2&gt;

&lt;p&gt;You can watch a demo of these technologies working together on &lt;a href="https://youtu.be/5fEjIux1_wg?t=2173"&gt;youtube&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nrZW9w4Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9tqft6gh9wgjyjqymd4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nrZW9w4Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9tqft6gh9wgjyjqymd4s.png" alt="demo" width="800" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you!&lt;/p&gt;

</description>
      <category>mixedreality</category>
      <category>javascript</category>
      <category>html</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Screen Sharing Android Devices on macOS + React Native Demo</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Mon, 14 Jun 2021 23:36:17 +0000</pubDate>
      <link>https://forem.com/josuebustos/screen-sharing-android-devices-on-macos-react-native-demo-3h48</link>
      <guid>https://forem.com/josuebustos/screen-sharing-android-devices-on-macos-react-native-demo-3h48</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We know that iPhones have the advantage of sharing files and their screen to macOS. So what's a good alternative for Android? &lt;/p&gt;

&lt;p&gt;In my opinion, as a developer, the best out-of-the-box choice is the open-source CLI tool called &lt;a href="https://github.com/Genymobile/scrcpy" rel="noopener noreferrer"&gt;SCRPY&lt;/a&gt; — one of the sharpest tools in my shed for mobile app development.&lt;/p&gt;

&lt;p&gt;This tutorial will show you how you can mirror your Android device screen to your macOS laptop. Don't like macOS? Not to worry. The tool supports Linux and Windows too.&lt;/p&gt;

&lt;p&gt;Furthermore, to complement our newly installed handy dandy tool, I will create a React Native "Hello World" app, deploy it to an Android device, and see our new tool work its magic. &lt;/p&gt;

&lt;p&gt;Okay, then. Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;This tutorial assumes you are familiar and comfortable navigating, modifying, using the terminal, and executing CLI commands, and to follow along, please have the following software installed on your host machine before moving forward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Homebrew&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;Android Studio&lt;/li&gt;
&lt;li&gt;Android Device&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Make sure Developer Mode is enabled on your Android device. It will allow you to connect to your laptop and much more. If you haven't prepared this step, visit the Android documentation &lt;a href="https://developer.android.com/studio/debug/dev-options" rel="noopener noreferrer"&gt;here&lt;/a&gt;, then come back when you're ready.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Install scrcpy
&lt;/h2&gt;

&lt;p&gt;First, open your preferred terminal and install the &lt;strong&gt;scrpy&lt;/strong&gt; by typing the following command, like so:&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;scrcpy


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

&lt;/div&gt;

&lt;p&gt;For React Native development, install &lt;strong&gt;Watchman&lt;/strong&gt;. This utility keeps track of any changes you make to your files, builds, compiles your code, and immediately deploys those changes on your device without breaking a sweat!&lt;/p&gt;

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

$ brew install watchman


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

&lt;/div&gt;

&lt;p&gt;As of this writing, this utility does not run in detached mode, which means you have to open a new tab to continue multitasking. &lt;/p&gt;

&lt;p&gt;Go ahead and open a new tab, and now you can launch the screen sharing utility by typing:&lt;/p&gt;

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

$ scrcpy


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

&lt;/div&gt;

&lt;p&gt;Explore more CLI combinations by visiting the scrpy Github main &lt;a href="https://github.com/Genymobile/scrcpy" rel="noopener noreferrer"&gt;page&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you're a pro with React Native then, you can skip the following steps and enjoy the rest of your day. If not, stick around and make some magic! :)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Create a React Native project
&lt;/h2&gt;

&lt;p&gt;Return to your original project terminal window or tab. Next, type the following command to create a React Native app:&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;npx react-native init SampleProject &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;SampleProject/


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Deploy to device
&lt;/h2&gt;

&lt;p&gt;To install and launch your app on the device, type the following command:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ npx react-native run-android


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

&lt;/div&gt;

&lt;p&gt;This command will open an extra tab or window for Metro. More information explaining what it is &lt;a href="https://facebook.github.io/metro/docs/concepts" rel="noopener noreferrer"&gt;here&lt;/a&gt;, but not to worry, let it do its thing and see your newly created app get installed onto your device like magic!&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%2Fyqa2mk4w17m7z9n1cm41.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%2Fyqa2mk4w17m7z9n1cm41.gif" alt="demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AND THAT's ABOUT IT! &lt;/p&gt;

&lt;p&gt;Not too bad for a hard day's work, ey!? Grabs some coffee, some libations, and bask in your success!&lt;/p&gt;

&lt;p&gt;More tutorials on the way. Hang Tight!&lt;/p&gt;

&lt;p&gt;Until next time!&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>android</category>
      <category>tooling</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Working With DynamoDB, AWS NoSQL Workbench, and Node.JS</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Mon, 14 Jun 2021 03:50:18 +0000</pubDate>
      <link>https://forem.com/josuebustos/working-with-dynamodb-aws-nosql-workbench-and-node-js-42eh</link>
      <guid>https://forem.com/josuebustos/working-with-dynamodb-aws-nosql-workbench-and-node-js-42eh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, I will show you how to set up a locally-hosted DynamoDB server, use the AWS NoSQL Workbench to insert data into DynamoDB, and finally, create a simple Node.JS project that will query sample data provided by AWS NoSQL Workbench.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;This tutorial assumes you're comfortable executing terminal commands, navigating, and modifying the macOS and Ubuntu Linux file system. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;My setup is a hybrid environment consisting of a Host, macOS Catalina, and a Guest Ubuntu VM instance. But You can set up everything on one host, macOS, Ubuntu, or Windows.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To follow along, you will need the following already installed:&lt;/p&gt;

&lt;p&gt;On Ubuntu (Guest) or Host:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04" rel="noopener noreferrer"&gt;Docker Compose&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On MacOS (Host):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://www.releases.ubuntu.com/20.04/" rel="noopener noreferrer"&gt;Ubuntu 20.04.2&lt;/a&gt; VM instance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Okay, let's get started! :) &lt;/p&gt;

&lt;h2&gt;
  
  
  Install AWS NoSQL Workbench
&lt;/h2&gt;

&lt;p&gt;Let's get the simple stuff out of the way. Navigate to the &lt;a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workbench.settingup.html" rel="noopener noreferrer"&gt;AWS DynamoDB Developer&lt;/a&gt; page and download the AWS NoSQL Workbench for your Operating System.&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%2Fzx1sfklk3ouyod7h1oij.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%2Fzx1sfklk3ouyod7h1oij.png" alt="download"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After downloading the installation file, follow the onscreen instructions to install NoSQL Workbench.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install DynamoDB
&lt;/h2&gt;

&lt;p&gt;Docker and Docker Compose will create and manage the DynamoDB server container and install all the required software packages and dependencies.&lt;/p&gt;

&lt;p&gt;Open your preferred terminal app and type the following command to create a folder, change directories and create a YAML file in one swoop, like so:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 bash
$ mkdir ~/dynamodblocal &amp;amp;&amp;amp; cd ~/dynamodblocal &amp;amp;&amp;amp; touch docker-compose.yml


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

&lt;/div&gt;

&lt;p&gt;Next, copy-paste the following YAML code into the  docker-compose.yml file.&lt;/p&gt;

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


&lt;span class="c1"&gt;# docker-compose.yml&lt;/span&gt;

&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.8'&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;dynamodb-local&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-jar&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;DynamoDBLocal.jar&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-sharedDb&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-optimizeDbBeforeStartup&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-dbPath&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;./data"&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;amazon/dynamodb-local:latest"&lt;/span&gt;
    &lt;span class="na"&gt;container_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dynamodb-local&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8000:8000"&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./docker/dynamodb:/home/dynamodblocal/data"&lt;/span&gt;
    &lt;span class="na"&gt;working_dir&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/home/dynamodblocal&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Finally, launch the DynamoBD Server by typing the following command in the terminal:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 bash
$ docker-compose up


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

&lt;/div&gt;

&lt;p&gt;The first time you execute this command, it will take a few minutes to get the server up and running. The next time after that, it should be instant. &lt;/p&gt;

&lt;p&gt;Now, if you see an output similar to the one below. That means you have successfully installed and launched a DynamoDB Server!&lt;/p&gt;

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

dynamodb-local    | Initializing DynamoDB Local with the following configuration:
dynamodb-local    | Port:       8000
dynamodb-local    | InMemory:   &lt;span class="nb"&gt;false
&lt;/span&gt;dynamodb-local    | DbPath:     ./data
dynamodb-local    | SharedDb:   &lt;span class="nb"&gt;true
&lt;/span&gt;dynamodb-local    | shouldDelayTransientStatuses:       &lt;span class="nb"&gt;false
&lt;/span&gt;dynamodb-local    | CorsParams: &lt;span class="k"&gt;*&lt;/span&gt;
dynamodb-local    | 


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

&lt;/div&gt;

&lt;p&gt;To quickly shut down or stop the server, press:&lt;/p&gt;

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

Ctrl + C 


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Insert Data Into Your DynamoDB Server
&lt;/h2&gt;

&lt;p&gt;Before we can perform requests to the database from inside Node.js, we need to insert data. To do that, we're going to leverage AWS NoSQL Workbench GUI and connect to our recently launched DynamobDB server.&lt;/p&gt;
&lt;h3&gt;
  
  
  Choose a Model
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;First, open/launch the AWS NoSQL Workbench.&lt;/li&gt;
&lt;li&gt;On the left sidebar, locate and click on &lt;strong&gt;Visualizer&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on the dropdown menu and select &lt;strong&gt;AWS Discussion Forum Data Model&lt;/strong&gt;.&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%2Fqhlqc156v6u654w2h4sc.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%2Fqhlqc156v6u654w2h4sc.png" alt="aws workbench"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This model includes three tables for you to explore: Forum, Reply, and Thread. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next, click on the &lt;strong&gt;Commit to Amazon DynamoDB&lt;/strong&gt; button&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%2Fyznz8sxwt8jcj7b0k82e.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%2Fyznz8sxwt8jcj7b0k82e.png" alt="connect"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When the popup opens, click on the tab furthest to the right that says &lt;strong&gt;Add a new DynamoDB local connection&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then, click on the &lt;strong&gt;Commit to connect to your local database&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can choose whatever name you want for &lt;strong&gt;Connection name&lt;/strong&gt; field.&lt;/p&gt;&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%2Flpg22rhkt9fjyqcah25t.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%2Flpg22rhkt9fjyqcah25t.png" alt="local connection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This step does three things. First, it creates a connection, inserts all three tables into your database, and opens a new window or view, called &lt;strong&gt;Operation builder&lt;/strong&gt;, that displays all your databases. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, Click the &lt;strong&gt;Open&lt;/strong&gt; button and Voilà!&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%2Fx0trynn7xgs1kldivt0y.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%2Fx0trynn7xgs1kldivt0y.png" alt="Open"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we're ready to make requests to the database in Node.js!&lt;/p&gt;
&lt;h2&gt;
  
  
  Query Data With Node.js
&lt;/h2&gt;

&lt;p&gt;To query data from DynamoDB in your Node.js project, you use the AWS JavaScript SDK for Node.js. So, Let's get to it...&lt;/p&gt;

&lt;p&gt;Open your preferred terminal app, create a directory, change directories, and initialize it to install npm packages. We can do this in one swoop like so:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/ &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;my-project &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;my-project &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm init &lt;span class="nt"&gt;-y&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;While we're here, install DynamoDB specific packages by typing the following command:&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;npm i @aws-sdk/client-dynamodb


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

&lt;/div&gt;

&lt;p&gt;Next, create a file called index.js :&lt;/p&gt;

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

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;index.js


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

&lt;/div&gt;

&lt;p&gt;Copy-paste the following code into the index.js file:&lt;/p&gt;

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

&lt;span class="c1"&gt;// index.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;QueryCommand&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@aws-sdk/client-dynamodb&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;REGION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;eu-west-2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;//e.g. "us-east-1"&lt;/span&gt;

&lt;span class="c1"&gt;// Create an Amazon DynamoDB service client object.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ddbClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DynamoDBClient&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;region&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;REGION&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:8000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// Query Parameter to retrieve data from DynamoDB&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;TableName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Forum&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;ScanIndexForward&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;ConsistentRead&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;KeyConditionExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0b290 = :0b290&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;ExpressionAttributeValues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Attribute Name&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;:0b290&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;S&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AWS Data Pipeline&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ExpressionAttributeNames&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Partition key&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0b290&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ForumName&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// a "run" function &lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ddbClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;QueryCommand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
        &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Display data in the console&lt;/span&gt;
            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;            
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;



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

&lt;/div&gt;

&lt;p&gt;Now, let's see if this works. First, open a terminal and type the following command to execute the run() function, like so:&lt;/p&gt;

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

$ node index.js


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

&lt;/div&gt;

&lt;p&gt;Your output should look like this:&lt;/p&gt;

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

&lt;span class="o"&gt;{&lt;/span&gt;
  Threads: &lt;span class="o"&gt;{&lt;/span&gt; N: &lt;span class="s1"&gt;'19'&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;,
  Category: &lt;span class="o"&gt;{&lt;/span&gt; S: &lt;span class="s1"&gt;'Amazon Web Services'&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;,
  Messages: &lt;span class="o"&gt;{&lt;/span&gt; N: &lt;span class="s1"&gt;'9'&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;,
  Views: &lt;span class="o"&gt;{&lt;/span&gt; N: &lt;span class="s1"&gt;'500'&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;,
  ForumName: &lt;span class="o"&gt;{&lt;/span&gt; S: &lt;span class="s1"&gt;'AWS Data Pipeline'&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Phew! If you've gotten this far, you're a champ! AND you're pretty serious about AWS Cloud Engineering and Development. Hats off to you!&lt;/p&gt;

&lt;p&gt;There was a lot to unpack in such a short time. However, you can deep dive into some of these practical solutions by jumping on over to the AWS Developer documentation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStartedDynamoDB.html" rel="noopener noreferrer"&gt;Getting Started with DynamoDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.html" rel="noopener noreferrer"&gt;Getting Started with DynamoDB and AWS SDKs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thank you for sticking around and holding on to the end.&lt;/p&gt;

&lt;p&gt;Until next time!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudnative</category>
      <category>cloudskills</category>
      <category>node</category>
    </item>
    <item>
      <title>HTTPS Localhost For Node.JS</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Sun, 06 Jun 2021 02:14:28 +0000</pubDate>
      <link>https://forem.com/josuebustos/https-localhost-for-node-js-1p1k</link>
      <guid>https://forem.com/josuebustos/https-localhost-for-node-js-1p1k</guid>
      <description>&lt;p&gt;Do you need a secure connection for your local Node.js web server? No problem!  This tutorial will show you how to create a self-assigned certificate on your local machine using a few CLI commands. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: I don't maintain the source code. Specific OS trouble  shooting can be found &lt;a href="https://github.com/FiloSottile/mkcert/blob/master/README.md#supported-root-stores" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;This guide assumes you're comfortable executing terminal commands, navigating, and modifying the file system. &lt;/p&gt;

&lt;p&gt;To follow along, you will need to have the following installed on your host machine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenSSL&lt;/li&gt;
&lt;li&gt;Homebrew&lt;/li&gt;
&lt;li&gt;Terminal&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;macOS&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Not your OS? Not to worry. Linux and Windows MAY require just a tad few more steps. I promise! You can find those steps &lt;a href="https://github.com/FiloSottile/mkcert/blob/master/README.md#supported-root-stores" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's get started, shall we...&lt;/p&gt;

&lt;h2&gt;
  
  
  Create A Node.js Project
&lt;/h2&gt;

&lt;p&gt;Create a folder and change directories. We can do this in one line, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;sample-project &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;sample-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, create a file inside the project root directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;server.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy-paste the sample code below into the &lt;strong&gt;server.js&lt;/strong&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// server.js&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;https&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key.pem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;cert&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cert.pem&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello world&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;https&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you launch the server now, it will output an error. Why? Because we have not generated our two pem files referenced in the &lt;strong&gt;const options&lt;/strong&gt; variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Self-Assigned Certificate
&lt;/h2&gt;

&lt;p&gt;To generate a self-assigned certificate on your host machine, you need to install &lt;strong&gt;mkcert&lt;/strong&gt; using Homebrew like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;mkcert
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Generate a certificate locally
&lt;/h3&gt;

&lt;p&gt;Navigate to your Node.js project root directory, open your preferred terminal app, type the following command, and then press &lt;strong&gt;Return&lt;/strong&gt;(enter). &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's essential that you add a &lt;em&gt;localhost&lt;/em&gt; string at the end to allow HTTPS to secure your localhost URL.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;mkcert &lt;span class="nt"&gt;-key-file&lt;/span&gt; key.pem &lt;span class="nt"&gt;-cert-file&lt;/span&gt; cert.pem example.com &lt;span class="k"&gt;*&lt;/span&gt;.example.com localhost

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

&lt;/div&gt;



&lt;p&gt;This command will generate two &lt;strong&gt;pem&lt;/strong&gt; files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;key.pem&lt;/li&gt;
&lt;li&gt;cert.pem&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you noticed, the names of these two files reflect the two objects in the &lt;strong&gt;const options&lt;/strong&gt; variable. You project setup should now look similar to 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%2Fwcz004zdbi5yedkdf27f.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%2Fwcz004zdbi5yedkdf27f.png" alt="your code" width="800" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Verify HTTPS Connection
&lt;/h3&gt;

&lt;p&gt;To verify that everything is working, launch the Node.js server by typing this command in the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ node server.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, open a browser, preferably a Chromium OS-based browser, and verify the HTTPS connection in the search bar to the far left has a secure HTTPS icon. See example images 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%2Focdcepiutvqmri8gzptb.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%2Focdcepiutvqmri8gzptb.png" alt="hello world" width="588" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another way to verify your new HTTPS connection is using the web console provided by the browser. Simply navigate to the  &lt;strong&gt;Security&lt;/strong&gt; tab.&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%2Fiyogjrrd4dlqfcekvwrd.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%2Fiyogjrrd4dlqfcekvwrd.png" alt="web console" width="800" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will guarantee you that this quick setup will save you hundreds if not thousands of hours googling. I know it did for me!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note, that this is not a replacement for a real-world secure HTTPS connection and you're expected to implement secure endpoints anywhere and everywhere where security is required and or needed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I hope you enjoyed this tutorial. Until next time!&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>security</category>
      <category>tooling</category>
    </item>
    <item>
      <title>AWS CDK Node.JS: Hello World</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Sun, 30 May 2021 23:04:55 +0000</pubDate>
      <link>https://forem.com/josuebustos/aws-cdk-node-js-hello-world-38c5</link>
      <guid>https://forem.com/josuebustos/aws-cdk-node-js-hello-world-38c5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This tutorial will show you how to install the AWS CDK on Ubuntu and deploy your first JavaScript Infrastructure as Code (IAS) to AWS. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Warning: I do not assume any responsibility if you incur any charges. You are responsible for managing your resources in your AWS account. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you find yourself stuck, I recommend reviewing the &lt;a href="https://docs.aws.amazon.com/cdk/index.html"&gt;AWS documentation&lt;/a&gt; to find detailed concepts, definitions, and critical terminology to help you along the way. &lt;/p&gt;

&lt;h2&gt;
  
  
  AWS CDK Intro
&lt;/h2&gt;

&lt;p&gt;"AWS CDK is a software development framework for defining cloud infrastructure in code and provisioning it through AWS CloudFormation.&lt;/p&gt;

&lt;p&gt;You use the CDK to define your cloud resources in a familiar programming language. The CDK supports TypeScript, JavaScript, Python, Java, C#/.Net, and (in developer preview) Go." - AWS Docs.&lt;/p&gt;

&lt;p&gt;Today we're going to leverage JavaScript, which you can port to TypeScript at a later time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;This tutorial assumes you're comfortable, familiar, and have the necessary software installed on your system to follow along.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS IAM Credentials&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;Homebrew&lt;/li&gt;
&lt;li&gt;Node JS 10.13.0 or later&lt;/li&gt;
&lt;li&gt;Ubuntu OS&lt;/li&gt;
&lt;li&gt;macOS&lt;/li&gt;
&lt;li&gt;Terminal&lt;/li&gt;
&lt;li&gt;Command Line Interface&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: I will be installing AWS CDK on Ubuntu. Some OS-specific troubleshooting may be required if you run into issues.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ready!? Let's begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install The AWS CDK
&lt;/h2&gt;

&lt;p&gt;Go ahead and type the following command to begin installing the CDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm install -g aws-cdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify that you have installed the CDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cdk --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create A CDK Project
&lt;/h2&gt;

&lt;p&gt;Create a folder where your CDK project will live:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir MyTestService
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd MyTestService
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In an NPM fashion, you can create a CDK project using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cdk init app --language javascript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on your host system, it will take a moment to create all the resources necessary to prepare your IaC project. So, sit tight and have some delicious warm coffee. &lt;/p&gt;

&lt;p&gt;A successful install will result in the following example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✅ All done!
****************************************************
*** Newer version of CDK is available [1.106.1]  ***
*** Upgrade recommended (npm install -g aws-cdk) ***
****************************************************
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can view a list of your stacks by using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cdk ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;example output:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;But we're not done yet!&lt;/p&gt;

&lt;h1&gt;
  
  
  Add an Amazon S3 Resources
&lt;/h1&gt;

&lt;p&gt;Make sure you're in the root directory of your project. If not, the CDK commands will not function properly.&lt;/p&gt;

&lt;p&gt;For this following command, we will add an AWS resource, or within the context Node JS, a package, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm install @aws-cdk/aws-s3 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, define an Amazon S3 bucket in the stack using the Bucket construct. To do this, locate line 13 or the commented out text and append the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cdk = require('@aws-cdk/core');
const s3 = require('@aws-cdk/aws-s3');

class HelloCdkStack extends cdk.Stack {
  constructor(scope, id, props) {
    super(scope, id, props);

    // The code that defines your stack goes here
    new s3.Bucket(this, 'MyFirstBucket', {
    versioned: true,
    removalPolicy: cdk.RemovalPolicy.DESTROY,
    autoDeleteObjects: true
});
  }
}

module.exports = { HelloCdkStack }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Synthesize an AWS CloudFormation template&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cdk synth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;"synth"&lt;/strong&gt; command generates a CloudFormation file. Also, the actual output will extend for several lines. Makes sure to scroll down and explore the generated CloudFormation file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Resources:
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties: 
    ....
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If you received an error like --app is required..., it's probably because you are running the command from a subdirectory. Navigate to the main app directory and try again.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Deploy Your Stack
&lt;/h2&gt;

&lt;p&gt;First, bootstrap your project before deployment, ensuring that AWS is aware of the permissions between resources.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cdk bootstrap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AND then you should see a similar output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ⏳  Bootstrapping environment aws://965805005461/us-east-2...
CDKToolkit: creating CloudFormation changeset...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, deploy your stack to the AWS Cloud. To do that, type the following command:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;As your code is preparing to deploy, it will prompt you to for a yes or no. Type Yes and then press Enter to continue with the deployment process.&lt;/p&gt;

&lt;p&gt;While that's doing its thing, you can navigate to the &lt;a href="https://console.aws.amazon.com/cloudformation/home"&gt;AWS CloudFormation console&lt;/a&gt; and see the magic in real-time.&lt;/p&gt;

&lt;h1&gt;
  
  
  Delete Your Resources
&lt;/h1&gt;

&lt;p&gt;To delete your resources, you just deployed, type the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cdk destroy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When prompted to delete all the resources you have created,  Type &lt;strong&gt;"Y"&lt;/strong&gt; for yes — otherwise, type &lt;strong&gt;"N"&lt;/strong&gt; for no.&lt;/p&gt;

&lt;p&gt;Example prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Are you sure you want to delete: MyTestServiceStack (y/n)? y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Great Job! You just created your first AWS CDK JS APP!&lt;/p&gt;

&lt;p&gt;These are industry sought after skills, and I hope it helps you upskill and get you where you need to go in your daily hacking or career!&lt;/p&gt;

&lt;p&gt;Until next time!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudskills</category>
      <category>javascript</category>
      <category>devops</category>
    </item>
    <item>
      <title>Visual Studio Code Remote SSH Multipass</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Sun, 30 May 2021 18:31:58 +0000</pubDate>
      <link>https://forem.com/josuebustos/vs-code-remote-ssh-multipass-dn8</link>
      <guid>https://forem.com/josuebustos/vs-code-remote-ssh-multipass-dn8</guid>
      <description>&lt;p&gt;This guide will show you how to remote SSH into a Ubuntu VM instance in Visual Studio 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%2Fi1.wp.com%2Fjonamdall.com%2Fwp-content%2Fuploads%2F2018%2F05%2Fleeloo-dallas-multipass.gif%3Fresize%3D480%252C220%26ssl%3D1" 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%2Fi1.wp.com%2Fjonamdall.com%2Fwp-content%2Fuploads%2F2018%2F05%2Fleeloo-dallas-multipass.gif%3Fresize%3D480%252C220%26ssl%3D1" alt="multipass"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Multipass is a platform developed by &lt;a href="https://canonical.com/" rel="noopener noreferrer"&gt;Canonical&lt;/a&gt; to prototype cloud launches locally for free. Learn more about Multipass and its capabilities by visiting &lt;a href="https://multipass.run/" rel="noopener noreferrer"&gt;multipass.run&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This guide assumes you are comfortable using the terminal and connecting to a remote server environment without a GUI. Review the prerequisites to follow along.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Homebrew for macOS&lt;/li&gt;
&lt;li&gt;Visual Studio Code (VS Code)&lt;/li&gt;
&lt;li&gt;Terminal, iTerm, or VS Code integrated terminal &lt;/li&gt;
&lt;li&gt;Remote SSH extension for VS Code &lt;/li&gt;
&lt;li&gt;SSH key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Multipass on macOS
&lt;/h2&gt;

&lt;p&gt;Open your preferred Terminal app and copy-paste the following command:&lt;/p&gt;

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

$ brew install --cask multipass


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

&lt;/div&gt;

&lt;p&gt;Verify the installation was successful:&lt;/p&gt;

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

$ multipass version


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

&lt;/div&gt;

&lt;p&gt;A sample output should look similar to this: &lt;/p&gt;

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

$  multipass version
multipass  1.6.2+mac
multipassd 1.6.2+mac


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

&lt;/div&gt;

&lt;p&gt;That's it! &lt;/p&gt;

&lt;p&gt;Now you can start launching Ubuntu VM instances on the fly with Multipass.&lt;/p&gt;

&lt;h1&gt;
  
  
  Launch a VM Instance
&lt;/h1&gt;

&lt;p&gt;To quickly launch your first instance, type the following command:&lt;/p&gt;

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

$ multipass launch

// example output
Starting fitting-diplodocus |


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

&lt;/div&gt;

&lt;p&gt;Multipass will randomly create an alias name and provision your instance using the latest LTS Ubuntu image. &lt;/p&gt;

&lt;p&gt;Using this command also provisions your instance with default resources and a network such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storage: 5 GB &lt;/li&gt;
&lt;li&gt;User: Ubuntu&lt;/li&gt;
&lt;li&gt;Password: N/A (can be modified)&lt;/li&gt;
&lt;li&gt;Network: Bridged (w/ Internet access)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or you can type a command to view more information about your instance like so:&lt;/p&gt;

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

multipass exec keen-yak -- lsb_release --description

// example output
Description:  Ubuntu 20.04.2 LTS


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

&lt;/div&gt;

&lt;p&gt;If you want to list stopped or running instances, type :&lt;/p&gt;

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

$ multipass ls

// example output
Name                    State             IPv4             Image
Imag-Name               Running           191.128.04.24    Ubuntu 20.04 LTS


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

&lt;/div&gt;

&lt;p&gt;I personally like the robust horizontal output with more info. Also, make sure to copy the IPv4 Address shown below so you can use it later.&lt;/p&gt;

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

multipass info samcli

// example output
Name:           Image-Name
State:          Running
IPv4:           100.100.04.13
Release:        Ubuntu 20.04.2 LTS
Image hash:     9dd5cb9f73c4 (Ubuntu 20.04 LTS)
Load:           1.01 0.68 0.27
Disk usage:     1.3G out of 4.7G
Memory usage:   138.5M out of 981.3M


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

&lt;/div&gt;

&lt;p&gt;And finally, access the Ubuntu instance you just created by typing:&lt;/p&gt;

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

$ multipass shell Image-Name


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

&lt;/div&gt;
&lt;h3&gt;
  
  
  Deleting your instance
&lt;/h3&gt;

&lt;p&gt;Once you decide you no longer need your VM instance, you can delete it by typing the following command:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ multipass delete Image-Name


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

&lt;/div&gt;

&lt;p&gt;Deleting a VM instance only removes it from queue. Conceptually you can think of deleting a file and sending to the trash bin. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning: You will not be able to recover your instance after executing this command.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To completeley remove an instance from disk use the following command:&lt;/p&gt;

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

multipass purge


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

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Visit the &lt;a href="https://multipass.run/docs#command-line-reference" rel="noopener noreferrer"&gt;Multipass documenation&lt;/a&gt; to get familiar with advanced command combinations to create and manage your Ubuntu VM instances.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now, it's time to SSH into your instance using Visual Studio Code so you can, well, code.&lt;/p&gt;

&lt;h1&gt;
  
  
  VS Code Remote SSH
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;To follow along, make sure you have VS Code and the &lt;a href="https://code.visualstudio.com/docs/remote/ssh-tutorial#_install-the-extension" rel="noopener noreferrer"&gt;remote SSH extension&lt;/a&gt; installed. For detailed instructions and troubleshooting, visit the &lt;a href="https://code.visualstudio.com/docs/remote/ssh-tutorial" rel="noopener noreferrer"&gt;VS Code docs&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's begin...&lt;/p&gt;

&lt;h2&gt;
  
  
  Add SSH Host
&lt;/h2&gt;

&lt;p&gt;Before we can SSH into our Multipass VM instance, you need to add a new Host in the user's SSH config file. You can directly access the file by locating the directory it's in.&lt;/p&gt;

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

// on macOS
/Users/&amp;lt;user-name&amp;gt;/.ssh/config


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

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

// on Linux
/home/ubuntu/.ssh/config


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

&lt;/div&gt;

&lt;p&gt;Edit the file by adding or appending these three lines:&lt;/p&gt;

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

Host Alias-Name
  HostName 100.100.04.13
  User ubuntu


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

&lt;/div&gt;

&lt;p&gt;What's going on here?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Host: A random name you chose.&lt;/li&gt;
&lt;li&gt;HostName: Is the IPv4 address of the VM instance.&lt;/li&gt;
&lt;li&gt;User: The user name of the instance.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Add Authorization Key
&lt;/h2&gt;

&lt;p&gt;Below are two links if you need a quick refresher on how to install and create SSH keys.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Install Remote SSH extension &lt;a href="https://code.visualstudio.com/docs/remote/ssh-tutorial#_install-the-extension" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;How to &lt;a href="https://code.visualstudio.com/docs/remote/ssh-tutorial#_set-up-ssh" rel="noopener noreferrer"&gt;generate SSH keys&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Log into your VM instance using the Multipass shell command and append your host SSH key to the &lt;strong&gt;authorization_keys&lt;/strong&gt; file in the VM guest instance.&lt;/p&gt;

&lt;p&gt;Finally, change to your home directory and create a directory of your choice.&lt;/p&gt;

&lt;p&gt;Phewww! We're almost there...&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect to a VM Instance in VS Code
&lt;/h2&gt;

&lt;p&gt;To SSH into your Multipass VM instance, navigate to the  &lt;strong&gt;"Open a Remote Window"&lt;/strong&gt; button on the bottom left corner in VS Code. &lt;/p&gt;

&lt;p&gt;This will open a dropdown menu. Click on &lt;strong&gt;"Connect Current Window to Host..."&lt;/strong&gt;. Next, select the alias or Host that you created earlier in the guide. VS Code will refresh the current window and establish an SSH connection. &lt;/p&gt;

&lt;p&gt;If it's not already open, expand the file explorer on the left pane and click on the green button called &lt;strong&gt;"Open Folder"&lt;/strong&gt;. Use the command palette to navigate to the directory you created.&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.josuebustos.com%2Fstatic%2Fvscode-ssh%2Fssh_connect.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%2Fcdn.josuebustos.com%2Fstatic%2Fvscode-ssh%2Fssh_connect.gif" alt="shell"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you see this warning &lt;em&gt;"Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)"&lt;/em&gt; It means Ubuntu doesn't have enough memory to watch file changes. You have to increase the limit to its max 524,288. Refer to the VS Code docs to &lt;a href="https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc" rel="noopener noreferrer"&gt;workaround&lt;/a&gt; this issue.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;AND that's it! You've successfully SSH into a Multipass Ubuntu instance using VS Code.&lt;/p&gt;

&lt;p&gt;Enjoy prototyping the cloud!&lt;/p&gt;

&lt;p&gt;Until next time... &lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>ssh</category>
      <category>vscode</category>
      <category>multipass</category>
    </item>
    <item>
      <title>Node JS Tizen CLI</title>
      <dc:creator>Josue Bustos</dc:creator>
      <pubDate>Sun, 30 May 2021 02:53:16 +0000</pubDate>
      <link>https://forem.com/josuebustos/node-js-tizen-cli-na1</link>
      <guid>https://forem.com/josuebustos/node-js-tizen-cli-na1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;If you're looking for the full fledged Tizen CLI visit the Tizen Devleoper website &lt;a href="https://developer.tizen.org/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why a Node JS derived Tizen CLI?
&lt;/h2&gt;

&lt;p&gt;Create an OS-agnostic command-line tool for web developers that can be installed with contemporary IDEs like Visual Studio Code.&lt;/p&gt;

&lt;p&gt;And, of course, get familiar with Node JS, low-level APIs that communicate with the OS. Hence the bash scripting nature of the CLI tool, but instead using JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;p&gt;The Node JS CLI depends on the Tizen SDK and platform tools to compile, sign, package, and install Tizen Web Apps on the Tizen Emulator and Samsung Watch Device. You can learn more about the Tizen OS platform and dev tools &lt;a href="https://docs.tizen.org/platform/what-is-tizen/overview/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At this moment the current version of the CLI supports only macOS. Possibly with a little more time and TLC it can support Linux and Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Node JS CLI Preview
&lt;/h2&gt;

&lt;p&gt;1) Create a New Project&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This commands creates a new Tizen Web App for wearables. Learn more about creating tizen web apps &lt;a href="https://tinyurl.com/2z4xb2mu"&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5N3WeaoF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-create.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5N3WeaoF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-create.gif" alt="Create a new project" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) Create a Certificate&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Allows you to install apps on the Tizen Emulator and on the Samsung Galaxy Watch device.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5tIf1503--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-cert.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5tIf1503--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-cert.gif" alt="Create a certificate" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) Package your web app into a .wgt file&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This is the equivalent to a APK android file that you install on Android devices. You can learn more about the Tizen Web Application architecture &lt;a href="https://docs.tizen.org/application/web/"&gt;here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O29MQ_Xn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-generate.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O29MQ_Xn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-generate.gif" alt="Package your project" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4) Launch the Tizen Emulator&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L3tSYogp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-emulate.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L3tSYogp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-emulate.gif" alt="Launch Tizen Emulator" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5) Debug&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This command launches the Chrome Developer Tool web inspector.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O29MQ_Xn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-generate.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O29MQ_Xn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-generate.gif" alt="Debug your app" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6) Shutdown&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This command terminates both the Chrome Dev Tool and emulator at the same time.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RLiyWRuh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-shutdown.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RLiyWRuh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://cdn.josuebustos.com/static/gif/tizen-shutdown.gif" alt="Shutdown" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, I can install Node JS Tizen CLI with NPM anywhere on my local machine using Terminal or iTerm.  When writing this, the Web debugger continues to only work with Google Chrome 80 and below. Luckily you can find a clean copy on the interwebs.&lt;/p&gt;

&lt;p&gt;Can anyone create a Node JS CLI absolutely? Yes, though, your mileage will vary. Below is a list of domain knowledge I needed on hand to put all the pieces together and some new items I had picked up along the way to get me to the finish line:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tizen CLI instructions&lt;/li&gt;
&lt;li&gt;Node JS CLI&lt;/li&gt;
&lt;li&gt;JavaScript (Pure ES6)&lt;/li&gt;
&lt;li&gt;Shell scripting (Unix/macOS)&lt;/li&gt;
&lt;li&gt;Chrome Dev Tools&lt;/li&gt;
&lt;li&gt;Terminal (macOS)&lt;/li&gt;
&lt;li&gt;File system (map Tizen specific scripts in Node JS)&lt;/li&gt;
&lt;li&gt;Google, StackOverflow, Stack Exchange, etc!&lt;/li&gt;
&lt;li&gt;TCP, UDP (Networking)&lt;/li&gt;
&lt;li&gt;Wireshark&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you enjoyed this short segment, stay tuned for more CLI adventures.&lt;/p&gt;

&lt;p&gt;Until next time. &lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>tizen</category>
      <category>samsung</category>
    </item>
  </channel>
</rss>
