<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lino Espinoza on Medium]]></title>
        <description><![CDATA[Stories by Lino Espinoza on Medium]]></description>
        <link>https://medium.com/@lino.espinoza?source=rss-c0669b69815c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VlOpdziM1UJgltJoR958Og.jpeg</url>
            <title>Stories by Lino Espinoza on Medium</title>
            <link>https://medium.com/@lino.espinoza?source=rss-c0669b69815c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 23:11:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lino.espinoza/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to deploy your AWS Lambda based in containers with ECR]]></title>
            <link>https://blog.cloudstudio.pe/how-to-deploy-your-aws-lambda-based-in-containers-with-ecr-7cc9fddd36b9?source=rss-c0669b69815c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cc9fddd36b9</guid>
            <category><![CDATA[ecr]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[lambda]]></category>
            <dc:creator><![CDATA[Lino Espinoza]]></dc:creator>
            <pubDate>Wed, 21 Feb 2024 15:16:25 GMT</pubDate>
            <atom:updated>2024-02-21T16:56:14.128Z</atom:updated>
            <content:encoded><![CDATA[<p>In previous working experiences, I was used to building and deploying AWS Lambda functions with zip files stored in AWS S3. I hadn&#39;t had the opportunity to use containers instead, but there is a chance to try new ways of building solutions if you work in cloud development.</p><figure><img alt="AWS Lambda deployed with containers" src="https://cdn-images-1.medium.com/max/1024/0*McxGUjXM8Eb8E97b" /><figcaption>Photo by <a href="https://unsplash.com/@fejuz?utm_source=medium&amp;utm_medium=referral">Fejuz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So, this post is about deploying an AWS Lambda function using container images stored in the AWS Elastic Container Registry. Let&#39;s jump on it.</p><h3>Prerequisites</h3><ul><li>AWS Command Line Interface, aka AWS CLI.</li><li>Docker</li><li>Node.js</li></ul><p>💡 To set up your AWS CLI, you can use Granted, as I explain in this blog <a href="https://medium.com/cloudstudio-pe/how-to-manage-multiple-aws-account-profiles-with-granted-e5c090947a7b">post</a>. 🙂</p><h3>Creating a AWS Lambda Function</h3><p>Create a directory called <em>aws-lambda-nodejs-container.</em> Bear with me; I like to have a well-structured name on my folders, even if this is just an example. 😉</p><pre>mkdir aws-lambda-nodejs-container</pre><p>Inside that folder, let&#39;s create a simple Node.js project with npm. You can accept the default options for this example.</p><pre>cd aws-lambda-nodejs-container &amp;&amp; npm init</pre><p>Create a new lambda function in a new file index.mjs</p><pre>export const lambdaHandler = async (event, context) =&gt; { <br>  const response = { <br>    statusCode: 200, <br>    body: JSON.stringify({ message: &#39;This is a successful response from AWS Lambda&#39;, }) <br>  };<br>  return response; <br>};</pre><p>Now, we need to create a simple Dockerfile with the configuration to create an image from the AWS EC Registry, COPY our lambda function code, RUN an install command, and finally, set the handler.</p><pre>FROM public.ecr.aws/lambda/nodejs:20-arm64<br>COPY index.mjs ${LAMBDA_TASK_ROOT}<br>CMD [&quot;index.lambdaHandler&quot;]</pre><p>Let&#39;s build our image; we are using an arm64 image. You can find a specific picture in the Amazon ECR Public Gallery → <a href="https://gallery.ecr.aws/lambda/nodejs">https://gallery.ecr.aws/lambda/nodejs</a></p><pre>docker build --platform linux/arm64 -t docker-image:test .</pre><p>If you want to test the image locally, docker is here to help you. Run your image like this:</p><pre>docker run --platform linux/arm64 -p 9000:8080 docker-image:test</pre><p>Then, invoke your lambda function:</p><pre>curl &quot;&lt;http://localhost:9000/2015-03-31/functions/function/invocations&gt;&quot; -d &#39;{}&#39;</pre><p>You will get something like this:</p><h3>Deploying the image to AWS ECR and your lambda function to AWS</h3><p>To accomplish this, we need to create an AWS ECR Repository; we can do this through the AWS Console, AWS CLI, or the AWS CDK. Now, I&#39;m going to use the AWS CLI; you must have experience using the CLI for your AWS tasks.</p><p>First, we must authenticate the Docker CLI to your Amazon ECR Registry.</p><p>In this example, I&#39;m setting the us-east-1 as the AWS Region where I want to create the Amazon ECR repository.<br>Replace the <strong>&lt;aws-account-id&gt;</strong> string ****with your AWS Account ID.</p><pre>aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin &lt;aws-account-id&gt;.dkr.ecr.us-east-1.amazonaws.com</pre><p>Now it is time to create your AWS ECR Repository</p><pre>aws ecr create-repository --repository-name dev-repository --region us-east-1</pre><p>Grab the value from the repositoryUri attribute for the next step.</p><pre>{<br>    &quot;repository&quot;: {<br>        &quot;repositoryArn&quot;: &quot;arn:aws:ecr:us-east-1:123456789012:repository/dev-repository&quot;,<br>        &quot;registryId&quot;: &quot;705941374709&quot;,<br>        &quot;repositoryName&quot;: &quot;dev-repository&quot;,<br>        &quot;repositoryUri&quot;: &quot;123456789012.dkr.ecr.us-east-1.amazonaws.com/dev-repository&quot;,<br>        &quot;createdAt&quot;: &quot;2024-02-17T16:02:31.898000-05:00&quot;,<br>        &quot;imageTagMutability&quot;: &quot;MUTABLE&quot;,<br>        &quot;imageScanningConfiguration&quot;: {<br>            &quot;scanOnPush&quot;: false<br>        },<br>        &quot;encryptionConfiguration&quot;: {<br>            &quot;encryptionType&quot;: &quot;AES256&quot;<br>        }<br>    }<br>}</pre><p>We need to tag our local image. Also, you need to replace the &lt;ECRrepositoryUri&gt; with the value of the previous step.</p><pre>docker tag docker-image:test &lt;ECRrepositoryUri&gt;:latest</pre><p>Then, we push our image to the AWS ECR repository.</p><pre>docker push &lt;ECRrepositoryUri&gt;:latest</pre><p>Create an execution role for the AWS Lambda function: <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-awscli.html#with-userapp-walkthrough-custom-events-create-iam-role">https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-awscli.html#with-userapp-walkthrough-custom-events-create-iam-role</a></p><p>Let&#39;s create an AWS Lambda function.</p><pre>aws lambda create-function \\ <br>--function-name nodejs-hello-world \\ <br>--package-type Image \\ <br>--code ImageUri=123456789012.dkr.ecr.us-east-1.amazonaws.com/dev-repository:latest \\ <br>--role arn:aws:iam::123456789012:role/service-role/myNewFunction-role-67bgsgdp</pre><p>You will get something like this.</p><pre>{<br>    &quot;FunctionName&quot;: &quot;nodejs-hello-world&quot;,<br>    &quot;FunctionArn&quot;: &quot;arn:aws:lambda:us-east-1:705941374709:function:nodejs-hello-world&quot;,<br>    &quot;Role&quot;: &quot;arn:aws:iam::705941374709:role/service-role/myNewFunction-role-67bgsgdp&quot;,<br>    &quot;CodeSize&quot;: 0,<br>    &quot;Description&quot;: &quot;&quot;,<br>    &quot;Timeout&quot;: 3,<br>    &quot;MemorySize&quot;: 128,<br>    &quot;LastModified&quot;: &quot;2024-02-18T01:51:12.111+0000&quot;,<br>    &quot;CodeSha256&quot;: &quot;69b8fae1b0affd9d67c93341d0d3c07fbd85b702cf8cb97afaa1c32ffea4e331&quot;,<br>    &quot;Version&quot;: &quot;$LATEST&quot;,<br>    &quot;TracingConfig&quot;: {<br>        &quot;Mode&quot;: &quot;PassThrough&quot;<br>    },<br>    &quot;RevisionId&quot;: &quot;60613992-6bb8-4258-9e60-5ed3efefec6f&quot;,<br>    &quot;State&quot;: &quot;Pending&quot;,<br>    &quot;StateReason&quot;: &quot;The function is being created.&quot;,<br>    &quot;StateReasonCode&quot;: &quot;Creating&quot;,<br>    &quot;PackageType&quot;: &quot;Image&quot;,<br>    &quot;Architectures&quot;: [<br>        &quot;x86_64&quot;<br>    ],<br>    &quot;EphemeralStorage&quot;: {<br>        &quot;Size&quot;: 512<br>    },<br>    &quot;SnapStart&quot;: {<br>        &quot;ApplyOn&quot;: &quot;None&quot;,<br>        &quot;OptimizationStatus&quot;: &quot;Off&quot;<br>    }<br>}</pre><p>You can invoke the function,</p><pre>aws lambda invoke --function-name nodejs-hello-world response.json</pre><p>And get a response like this:</p><pre>{<br>    &quot;StatusCode&quot;: 200,<br>    &quot;FunctionError&quot;: &quot;Unhandled&quot;,<br>    &quot;ExecutedVersion&quot;: &quot;$LATEST&quot;<br>}</pre><p>Remember, if you want to update the function code, you need to build the image again, upload it to the Amazon ECR Repository, and then use the <a href="https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/update-function-code.html">update-function-code</a> command to deploy the image to the Lambda function</p><p>That&#39;s it. I hope that you find this helpful.</p><p>See you in the next blog post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cc9fddd36b9" width="1" height="1" alt=""><hr><p><a href="https://blog.cloudstudio.pe/how-to-deploy-your-aws-lambda-based-in-containers-with-ecr-7cc9fddd36b9">How to deploy your AWS Lambda based in containers with ECR</a> was originally published in <a href="https://blog.cloudstudio.pe/">Cloud Studio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to manage multiple AWS Account Profiles with Granted]]></title>
            <link>https://blog.cloudstudio.pe/how-to-manage-multiple-aws-account-profiles-with-granted-e5c090947a7b?source=rss-c0669b69815c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5c090947a7b</guid>
            <category><![CDATA[iam-roles]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-cli]]></category>
            <category><![CDATA[granted]]></category>
            <dc:creator><![CDATA[Lino Espinoza]]></dc:creator>
            <pubDate>Wed, 21 Feb 2024 12:53:28 GMT</pubDate>
            <atom:updated>2024-02-21T12:53:28.720Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Granted?</h3><p><a href="https://www.granted.dev/">Granted</a>, it is an excellent tool for managing multiple AWS account profiles efficiently. It provides a streamlined and user-friendly interface that simplifies switching between different accounts and performing tasks across them.</p><p>One of the key benefits of using Granted is its ability to securely store and manage AWS access keys and secret access keys. This eliminates the need to manually manage and update these credentials, reducing the risk of accidental exposure or unauthorized access.</p><p>Additionally, Granted offers seamless integration with AWS Identity and Access Management (IAM), allowing users to easily configure and manage permissions for each account profile. This ensures that users can safely access resources within each account, enhancing security and governance.</p><h3>Getting Started</h3><p>This a guide to installing Granted on macOS; for Linux and Windows users, you can check the official <a href="https://docs.commonfate.io/granted/getting-started/">documentation</a>.</p><h3>Install AWS CLI</h3><p>It is recommended that you install AWS CLI first before installing Granted. <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.htm">https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.htm</a></p><h3>Set up AWS Profile</h3><p>You must edit your ~/.aws/config file and configure your AWS profiles. I advise using AWS SSO to begin this process; it is more handy. You can check the official <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html">documentation</a> on configuring the AWS CLI to use the AWS IAM Identity Center.</p><p>Here is an example for this file; you can grab it and start here. 🙂</p><pre>[default]<br>sso_session = &lt;https://defaultssodomain.awsapps.com/start&gt;<br>sso_account_id = [paste a default AWS Account ID here]<br>sso_role_name = [default role]<br>region = us-east-1<br>output = json</pre><pre>[profile production]<br>granted_sso_start_url      = &lt;https://abc.awsapps.com/start&gt;<br>granted_sso_region         = us-east-1<br>granted_sso_account_id     = [paste your AWS Account ID here]<br>granted_sso_role_name      = AdministratorAccess<br>common_fate_generated_from = aws-sso<br>credential_process         = granted credential-process --profile production</pre><pre>[profile uat]<br>granted_sso_start_url      = &lt;https://abc.awsapps.com/start&gt;<br>granted_sso_region         = us-east-1<br>granted_sso_account_id     = [paste your AWS Account ID here]<br>granted_sso_role_name      = AdministratorAccess<br>common_fate_generated_from = aws-sso<br>credential_process         = granted credential-process --profile uat</pre><h3>Install the Granted CLI</h3><pre>brew tap common-fate/granted<br>brew install granted</pre><h3>Verify your installation</h3><pre>granted -v</pre><h3>Assuming roles</h3><p>Run the assume command to assume a role (profile) previously defined in your ~/.aws/config file.</p><pre>➜ assume<br>[i] Thanks for using Granted!<br>[i] By default, Granted will open the AWS console with this browser: Chrome<br>[!] Granted works best with Firefox but also supports Chrome, Brave, and Edge (&lt;https://docs.commonfate.io/granted/introduction#supported-browsers&gt;). You can change this setting later by running &#39;granted browser set&#39;</pre><pre>? Use Firefox as default Granted browser? (y/N)</pre><p>There is a Granted Firefox <a href="https://addons.mozilla.org/en-GB/firefox/addon/granted/">addon</a> that you need to install so you can have several AWS account sessions in separate tabs.</p><p>Look at these images as an example of how it looks for production and uat profiles.</p><p>These are the basics to get started with Granted. I will dive deep into more advanced configurations and tips in the following articles.</p><h3>Conclusion</h3><p>if you manage multiple AWS account profiles, like me, Granted is a powerful tool that simplifies the process and enhances security. Its user-friendly interface, secure credential management, IAM integration, and centralized dashboard make it a valuable asset for efficient AWS account management.</p><p>I hope you find this helpful.</p><p>See you in the next blog post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5c090947a7b" width="1" height="1" alt=""><hr><p><a href="https://blog.cloudstudio.pe/how-to-manage-multiple-aws-account-profiles-with-granted-e5c090947a7b">How to manage multiple AWS Account Profiles with Granted</a> was originally published in <a href="https://blog.cloudstudio.pe/">Cloud Studio</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>