<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: hoan-pham-duy</title>
    <description>The latest articles on DEV Community by hoan-pham-duy (@hoanphamduy).</description>
    <link>https://dev.to/hoanphamduy</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%2F813859%2F5b9ad2c2-86a4-4779-8ed2-5a160981fd34.png</url>
      <title>DEV Community: hoan-pham-duy</title>
      <link>https://dev.to/hoanphamduy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hoanphamduy"/>
    <language>en</language>
    <item>
      <title>Design the producer consumer problem using AWS</title>
      <dc:creator>hoan-pham-duy</dc:creator>
      <pubDate>Tue, 12 Jul 2022 10:52:20 +0000</pubDate>
      <link>https://dev.to/hoanphamduy/design-the-producer-consumer-problem-using-aws-22gn</link>
      <guid>https://dev.to/hoanphamduy/design-the-producer-consumer-problem-using-aws-22gn</guid>
      <description>&lt;p&gt;Hi everyone, today I would like to share how I'm using AWS to solve the producer consumer problem. &lt;br&gt;
I got this case when I have to run a heavy background task that take a lot of time to run.&lt;br&gt;
For example: User will send a request to generate images with filters the user choose and the tasks generate images with filters will take a lot of time to run.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_dnfxcLf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0qqo2zrtcj904cq59ide.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_dnfxcLf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0qqo2zrtcj904cq59ide.png" alt="Image description" width="803" height="441"&gt;&lt;/a&gt;&lt;br&gt;
Here is my explanation about my architecture:&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Firstly,&lt;/em&gt;&lt;/strong&gt; I need to build an API Gateway that can receive the user's request.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Secondly,&lt;/em&gt;&lt;/strong&gt;every request from the user will be forwarded to Lambda Producer and the lambda will response that it received the user requests successfully&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Thirstly,&lt;/em&gt;&lt;/strong&gt; the producer will send message to SQS queue.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Finally,&lt;/em&gt;&lt;/strong&gt; the SQS queue will trigger the Lambda Consumer each time it had new message. The Lambda Consumer will run background task and scale automatically based on number of message in the queue.&lt;/p&gt;

&lt;p&gt;In my case, the Lambda Consumer will generate images with filters then uploads images back to S3 + send an email to user that it's done via AWS SNS.&lt;br&gt;
Hope for your comments to see is there anything that I can do better.&lt;br&gt;
Thank you!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>aws</category>
      <category>programming</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Bitbucket Pipeline build and deploy Lambda Container Image in AWS</title>
      <dc:creator>hoan-pham-duy</dc:creator>
      <pubDate>Tue, 12 Jul 2022 09:10:19 +0000</pubDate>
      <link>https://dev.to/hoanphamduy/bitbucket-pipeline-build-and-deploy-lambda-container-image-in-aws-3pmh</link>
      <guid>https://dev.to/hoanphamduy/bitbucket-pipeline-build-and-deploy-lambda-container-image-in-aws-3pmh</guid>
      <description>&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
In this post, I want to share how I build CI/CD system that Bibucket Pipeline can build and deploy Lambda Container Image in AWS.&lt;br&gt;
The architecture of this post:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VV6P8M2l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ne0z2erlm1ksu7lbb9x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VV6P8M2l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ne0z2erlm1ksu7lbb9x.png" alt="Image description" width="742" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;br&gt;
Step 1: Create a repository at Elastic Container Registry&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J1Th0hLN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjl5neu1gnt2x5nxxg1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J1Th0hLN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jjl5neu1gnt2x5nxxg1z.png" alt="Image description" width="880" height="637"&gt;&lt;/a&gt; &lt;br&gt;
I set it as private repository, Linux Operating systems, Architecture x86&lt;br&gt;
After create the ECR repository, we can see the image URI and the push command to know how we upload our container to ECR.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1f9RlLY1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7poz7zcalg9kun8vriu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1f9RlLY1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m7poz7zcalg9kun8vriu.png" alt="Image description" width="880" height="232"&gt;&lt;/a&gt; &lt;br&gt;
The push commands:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aVXu4q_3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ycsvrk7qfv2cier0dlhu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aVXu4q_3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ycsvrk7qfv2cier0dlhu.png" alt="Image description" width="880" height="811"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2: Push a container from your local machine to ECR.&lt;br&gt;
Currently, I use sample python lambda docker from &lt;a href="https://github.com/lambci/docker-lambda.git"&gt;https://github.com/lambci/docker-lambda.git&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LkIGLgnu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6gc26pissjs5hx3gx6ot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LkIGLgnu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6gc26pissjs5hx3gx6ot.png" alt="Image description" width="880" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 3: Create Lambda Container Image that using the Image URI&lt;br&gt;
Choose the container tab&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--K7KxUM_e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ub8khrjbxe7grasxchpv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--K7KxUM_e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ub8khrjbxe7grasxchpv.png" alt="Image description" width="880" height="439"&gt;&lt;/a&gt; &lt;br&gt;
Choose the repository and the container we've just pushed&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--65pJuDE---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t44jkw1hqx3hvv2mi59u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--65pJuDE---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t44jkw1hqx3hvv2mi59u.png" alt="Image description" width="880" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Create Bitbucket repository&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--d9VUJf6z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/05mb53e45e778p9o97rb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d9VUJf6z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/05mb53e45e778p9o97rb.png" alt="Image description" width="880" height="1080"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 5: Add bitbucket-pipelines.yml file to the projects to run pipeline and push it to Bitbucket Pipeline&lt;br&gt;
We need to fill some information from AWS to bitbucket-pipelines.yml like IMAGE_NAME, FUNCTION_NAME, the link in "docker login"&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DNbIx8B3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wga9er45ljzlhmtosq7a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DNbIx8B3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wga9er45ljzlhmtosq7a.png" alt="Image description" width="880" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 6: Set up your AWS credentials in repository's variable&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9uyVhAjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5pfo2hr0cbf9rvezu6s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9uyVhAjI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5pfo2hr0cbf9rvezu6s.png" alt="Image description" width="880" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 7: Run the pipeline in Bitbucket and wait for the pipeline completes build Lambda container images, push to ECR and Update Lambda Image URI.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZP-7ulMP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ouepohwx7zr4k63m29sd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZP-7ulMP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ouepohwx7zr4k63m29sd.png" alt="Image description" width="880" height="283"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c-3JrMTU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5wartm826f42gjqnxa7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c-3JrMTU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h5wartm826f42gjqnxa7.png" alt="Image description" width="880" height="457"&gt;&lt;/a&gt;&lt;br&gt;
Step 8: Check the image we pushed in ECR from Bitbucket pipeline, check the Lambda's Image URI with the name convention: TAG=$BITBUCKET_BUILD_NUMBER-$BITBUCKET_BRANCH-$BITBUCKET_TAG&lt;br&gt;
In my case, the BITBUCKET_BUILD_NUMBER = 2 and run in master branch with empty BITBUCKET_TAG&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ie4Tra8V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ieiheguhcon7uh4piw0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ie4Tra8V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ieiheguhcon7uh4piw0y.png" alt="Image description" width="880" height="297"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JIsJ0ceq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/er5svxwbigrygqdqfnf5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JIsJ0ceq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/er5svxwbigrygqdqfnf5.png" alt="Image description" width="880" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all of what I want to share in this post.&lt;br&gt;
Please let me know if you have other questions!  &lt;/p&gt;

</description>
      <category>bitbucket</category>
      <category>aws</category>
      <category>devops</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
