<?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: Edisson Ballesteros Aguilar</title>
    <description>The latest articles on Forem by Edisson Ballesteros Aguilar (@edissonaguilar).</description>
    <link>https://forem.com/edissonaguilar</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%2F178597%2F23e52e31-7d06-4f6f-865a-92856c1246ea.jpg</url>
      <title>Forem: Edisson Ballesteros Aguilar</title>
      <link>https://forem.com/edissonaguilar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/edissonaguilar"/>
    <language>en</language>
    <item>
      <title>Setup Multiple SSH Key's</title>
      <dc:creator>Edisson Ballesteros Aguilar</dc:creator>
      <pubDate>Wed, 15 Jun 2022 02:22:51 +0000</pubDate>
      <link>https://forem.com/edissonaguilar/setup-ssh-keys-jap</link>
      <guid>https://forem.com/edissonaguilar/setup-ssh-keys-jap</guid>
      <description>&lt;p&gt;Sometimes you will need to deal with multiple projects at the same time, some client with AWS, Gitlab, Github etc.&lt;br&gt;
Here are some steps that could be helpful ;)&lt;/p&gt;
&lt;h4&gt;
  
  
  1. Create a new SSH Key
&lt;/h4&gt;

&lt;p&gt;ED25519&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t ed25519 -C "&amp;lt;comment&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Add SSH Key
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eval $(ssh-agent -s)
ssh-add &amp;lt;directory to private SSH key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Setup config
&lt;/h4&gt;

&lt;p&gt;Touch or update the &lt;code&gt;config&lt;/code&gt; file in &lt;code&gt;~/.ssh/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Host gitlab-scope
  HostName gitlab.com
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/gitlab_com_rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AWS Codecommit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Host aws-codecommit
  HostName git-codecommit.{region}.amazonaws.com
  User APKARF3PHVLQ1EXAMPLE
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/private_key
  PubkeyAcceptedAlgorithms +ssh-rsa
  HostkeyAlgorithms +ssh-rsa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Hostnames
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Gitlab: &lt;code&gt;gitlab.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Github: &lt;code&gt;github.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;AWS Codecommit: &lt;code&gt;git-codecommit.{region}.amazonaws.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  4. Setup public key
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat private_key.pub
&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;ssh-ed25519 ABBBC3NzaC1lZDI1NTE5AAAAIBSFa3klpakF4ZkNPO7JWMsQDqy3Wd6ZvyPslt &amp;lt;comment&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the key to your repository preferences and create the SSH key &lt;/p&gt;

&lt;h4&gt;
  
  
  5. Verify the connection
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -T git@gitlab-scope
&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;The authenticity of host 'gitlab.com (172.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:hfksfbdfoerHKSDKFDFDFDF.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.com,172.0.0.1' (ECDSA) to the list of known hosts.
Welcome to GitLab, @user!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  6. Clone the repository
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone git@gitlab-scope:project/repository-name.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AWS Codecommit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone ssh://aws-codecommit/v1/repos/repository-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ssh</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Get Paginated Data DynamoDB</title>
      <dc:creator>Edisson Ballesteros Aguilar</dc:creator>
      <pubDate>Thu, 18 Feb 2021 15:37:00 +0000</pubDate>
      <link>https://forem.com/edissonaguilar/get-paginated-data-dynamo-3b1d</link>
      <guid>https://forem.com/edissonaguilar/get-paginated-data-dynamo-3b1d</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getLogsNovedades() {

  const getAllData = async (params) =&amp;gt; {
    const _getAllData = async (params, startKey) =&amp;gt; {
      if (startKey) {
        params.ExclusiveStartKey = startKey
      }
      return dynamodb.query(params).promise();
    }
    let lastEvaluatedKey = null
    let rows = []
    do {
      const result = await _getAllData(params, lastEvaluatedKey)
      rows = rows.concat(result.Items)
      lastEvaluatedKey = result.LastEvaluatedKey
    } while (lastEvaluatedKey)
    return rows
  }

  var params = {
    TableName: tableName,
    ProjectionExpression: "Id, #Type, #Data, IDPV, #Name, #Timestamp",
    IndexName: 'Type-index',
    KeyConditionExpression: '#Type = :tp',
    ExpressionAttributeNames: {
      '#Type': 'Type',
      '#Data': 'Data',
      '#Name': 'Name',
      '#Timestamp': 'Timestamp'
    },
    ExpressionAttributeValues: {
      ':tp': 'NOVEDAD',
    },
    Limit: 100
  };

  return new Promise(async (resolve, reject) =&amp;gt; {
    try {
      let Items = await getAllData(params);
      resolve(Items);
    } catch (err) {
      reject(err);
    }
  });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
