<?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: Ujjwal B Soni</title>
    <description>The latest articles on Forem by Ujjwal B Soni (@ujjwalbsoni).</description>
    <link>https://forem.com/ujjwalbsoni</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%2F828009%2F5541530a-3747-4d9c-983f-d259c044352e.jpg</url>
      <title>Forem: Ujjwal B Soni</title>
      <link>https://forem.com/ujjwalbsoni</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ujjwalbsoni"/>
    <language>en</language>
    <item>
      <title>Building Earth Defense: My Journey Creating a Space Shooter Game with Amazon Q Developer</title>
      <dc:creator>Ujjwal B Soni</dc:creator>
      <pubDate>Sun, 25 May 2025 23:32:30 +0000</pubDate>
      <link>https://forem.com/ujjwalbsoni/building-earth-defense-my-journey-creating-a-space-shooter-game-with-amazon-q-developer-5cpf</link>
      <guid>https://forem.com/ujjwalbsoni/building-earth-defense-my-journey-creating-a-space-shooter-game-with-amazon-q-developer-5cpf</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.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%2Fh4zq2ib9oqb3zmkjuqg0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fh4zq2ib9oqb3zmkjuqg0.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a developer exploring the potential of AI-assisted coding, I recently embarked on an exciting project to create a space shooter game using Amazon Q Developer. The result is Earth Defense, a Pygame-based asteroid shooter that challenges players to protect Earth from incoming cosmic threats. In this post, I'll share my development journey, the role AI played in the process, and the lessons learned along the way.&lt;/p&gt;

&lt;p&gt;The intersection of artificial intelligence and game development has reached an exciting new milestone with Amazon Q Developer CLI, a revolutionary tool that transforms game creation from complex coding endeavors into conversational experiences. Amazon Q represents a paradigm shift in how developers approach game development, offering unprecedented accessibility while maintaining the sophistication needed for engaging gameplay. This comprehensive guide explores every aspect of creating unique games using Amazon Q, from initial setup to advanced development techniques, providing developers at all skill levels with the knowledge needed to bring their gaming visions to life through AI-powered assistance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Earth Defense?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Earth Defense is a classic space shooter game where players control a space shuttle tasked with defending Earth from an endless barrage of asteroids. The game combines nostalgic arcade-style gameplay with modern features like progressive difficulty, power-ups, and a comprehensive scoring system. Players use arrow keys to move their spaceship and the spacebar to shoot missiles, while strategically collecting power-ups to enhance their defensive capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up Our Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install PyGame - Follow instructions as per below website&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.pygame.org/wiki/GettingStarted" rel="noopener noreferrer"&gt;https://www.pygame.org/wiki/GettingStarted&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🚀 Getting Started with Amazon Q in Visual Studio Code 🧠💻&lt;/p&gt;

&lt;p&gt;🔧 Step-by-Step Installation Guide&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open Visual Studio Code&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Go to Extensions&lt;/strong&gt;&lt;br&gt;
Click on the Extensions icon in the sidebar or press Ctrl+Shift+X.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Search for "Amazon Q"&lt;/strong&gt;&lt;br&gt;
Look for the official Amazon Q extension (by AWS).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Click “Install”&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sign in with your AWS Builder ID&lt;/strong&gt;&lt;br&gt;
Once installed, you’ll be prompted to sign in. Use your AWS Builder ID (or create one if you don't have it).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;You're all set!&lt;/strong&gt;&lt;br&gt;
Start chatting with Amazon Q for code suggestions, explanations, documentation, and even architectural guidance.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Key Prompting Strategy: Use Simple, Baby-Friendly Language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Prompt 1 - This prompt will generate initial structure of the project.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Create a game with an idea of saving the earth from Astroids, player should have a space shuttle that will fire missiles on an asteroid. Create this using Pygame. I will explain you all the mechanics step by step and we will add elements as we progress through it&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Prompt 2 - Adding the features&lt;/p&gt;

&lt;p&gt;&lt;code&gt;i want to add below features. Make this game visually appealing and apply enhancements so that it is smooth and bug free&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Score tracking&lt;br&gt;
Lives system&lt;br&gt;
Different types of asteroids&lt;br&gt;
Power-ups&lt;br&gt;
Sound effects and background music&lt;br&gt;
Better graphics&lt;br&gt;
Game levels with increasing difficulty&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After few iterations, the game was successfully developed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/cloudperceptor/earthdefense" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/YjN7Bcr5zmE"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unlock Free Machine Learning with Amazon SageMaker Studio Lab: No AWS Account Needed!</title>
      <dc:creator>Ujjwal B Soni</dc:creator>
      <pubDate>Fri, 20 Sep 2024 04:14:13 +0000</pubDate>
      <link>https://forem.com/ujjwalbsoni/unlock-free-machine-learning-with-amazon-sagemaker-studio-lab-no-aws-account-needed-44o3</link>
      <guid>https://forem.com/ujjwalbsoni/unlock-free-machine-learning-with-amazon-sagemaker-studio-lab-no-aws-account-needed-44o3</guid>
      <description>&lt;p&gt;Are you looking for a &lt;strong&gt;FREE machine learning environment&lt;/strong&gt; to get hands-on experience? Check out &lt;strong&gt;Amazon SageMaker Studio Lab&lt;/strong&gt;! No AWS account or credit card is required—simply sign up with your email and enjoy free access to either a CPU or GPU environment. &lt;/p&gt;

&lt;p&gt;It took me just 5 minutes to create an account and start working in the JupyterLab environment.&lt;/p&gt;

&lt;p&gt;This differs from &lt;strong&gt;Amazon SageMaker Studio&lt;/strong&gt;, which does require an AWS account and credit card. However, the great thing is that if you begin working in SageMaker Studio Lab and want to scale up to a more powerful environment, you can easily migrate your work to SageMaker Studio to unlock the full capabilities of Amazon SageMaker.&lt;/p&gt;

&lt;p&gt;Here’s a quick overview and a link to claim your free environment:&lt;/p&gt;

&lt;p&gt;🤑 &lt;strong&gt;Free Access&lt;/strong&gt;: No AWS account or credit card needed. Just sign up with your email and start experimenting!&lt;br&gt;
🥼 &lt;strong&gt;JupyterLab Environment&lt;/strong&gt;: Utilize Jupyter notebooks with AWS computing power.&lt;br&gt;
💻 &lt;strong&gt;CPU &amp;amp; GPU Options&lt;/strong&gt;: Select the right computing resources for your needs, whether you’re a beginner or more advanced.&lt;br&gt;
💾 &lt;strong&gt;Persistent Storage&lt;/strong&gt;: Get 15 GB of storage to keep your projects safe.&lt;/p&gt;

&lt;p&gt;🔗&lt;a href="https://studiolab.sagemaker.aws/" rel="noopener noreferrer"&gt;https://studiolab.sagemaker.aws/&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  MachineLearning #AWS #SageMakerStudioLab #DataScience #AWSPartners #GenerativeAI
&lt;/h1&gt;

</description>
      <category>machinelearning</category>
      <category>aws</category>
      <category>gpt3</category>
      <category>genai</category>
    </item>
    <item>
      <title>Exploring Dedicated Virtualization Types in AWS</title>
      <dc:creator>Ujjwal B Soni</dc:creator>
      <pubDate>Mon, 03 Jul 2023 17:20:57 +0000</pubDate>
      <link>https://forem.com/ujjwalbsoni/exploring-dedicated-virtualization-types-in-aws-50k5</link>
      <guid>https://forem.com/ujjwalbsoni/exploring-dedicated-virtualization-types-in-aws-50k5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Exploring Dedicated Virtualization Types in AWS&lt;/strong&gt;&lt;br&gt;
AWS offers two distinct types of dedicated virtualization to cater to different needs: at the host level and at the instance level. This post aims to outline the disparities between these two offerings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q4aV3mAl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rpe1ea2nvhimv1ycndh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q4aV3mAl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rpe1ea2nvhimv1ycndh.jpg" alt="Image description" width="800" height="571"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dedicated Host:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Dedicated Host consists of dedicated physical hardware exclusively allocated to a single AWS account. It enables the execution of instances of various sizes within a specific instance type. The number of instances is constrained by the available cores on the host.&lt;/p&gt;

&lt;p&gt;A Dedicated Host can be shared among multiple organizations or accounts, providing flexibility and resource optimization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bring Your Own License (BYOL):&lt;/strong&gt;&lt;br&gt;
Software licenses often correlate with the number of CPUs, cores, and sockets utilized. With a Dedicated Host, visibility into the core usage of each deployed instance is provided. This enables accurate tracking and validation of license compliance, making it a significant advantage of opting for a Dedicated Host.&lt;/p&gt;

&lt;p&gt;Simplified license management can be achieved by utilizing AWS License Manager, which automatically monitors licenses when launching AMIs belonging to a license group.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Host Affinity:&lt;/strong&gt;&lt;br&gt;
When launching an instance, it is possible to target a specific Dedicated Host by specifying its host ID. This ensures that the instance maintains host affinity upon restarts, maintaining consistent performance and configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Restrictions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AMIs:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Certain operating systems (OSes) and SQL Server instances require the usage of custom AMIs, as AWS's AMIs are incompatible with Dedicated Hosts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Host Limit:&lt;/strong&gt;&lt;br&gt;
While there is a soft limit of 2 Dedicated Hosts per family per region, it can be increased to accommodate higher requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RDS:&lt;/strong&gt;&lt;br&gt;
AWS Relational Database Service (RDS) instances cannot be launched on Dedicated Hosts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ASG:&lt;/strong&gt;&lt;br&gt;
Instances within an Auto Scaling Group (ASG) that target a Dedicated Host must be launched via a Launch Template.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dedicated Instance:&lt;/strong&gt;&lt;br&gt;
A Dedicated Instance guarantees that it will be launched on hardware dedicated solely to the corresponding AWS account, without any instances from other accounts. However, it does not provide visibility into the underlying core utilization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Host Affinity:&lt;/strong&gt;&lt;br&gt;
Upon restart, a Dedicated Instance may or may not be instantiated on the same physical hardware. Nevertheless, it ensures that the underlying hardware exclusively hosts instances belonging to the same AWS account.&lt;/p&gt;

</description>
      <category>dedicatedhost</category>
      <category>dedicatedinstance</category>
      <category>dedicatedvirtualization</category>
      <category>aws</category>
    </item>
    <item>
      <title>AWS Interface Endpoint vs Gateway Endpoint</title>
      <dc:creator>Ujjwal B Soni</dc:creator>
      <pubDate>Mon, 27 Feb 2023 17:30:17 +0000</pubDate>
      <link>https://forem.com/ujjwalbsoni/aws-interface-endpoint-vs-gateway-endpoint-4aak</link>
      <guid>https://forem.com/ujjwalbsoni/aws-interface-endpoint-vs-gateway-endpoint-4aak</guid>
      <description>&lt;p&gt;The connections between your apps and AWS services may need to remain within the AWS network due to security or regulatory reasons, ensuring that no malicious party can tamper with your important data. In this situation, VPC Endpoint can be used. However, there are two different VPC Endpoint kinds from which to select. How do you make the best decision? Does that need you to read through the extensive Amazon documentation of those services?&lt;/p&gt;

&lt;p&gt;Fortunately, the decision is easy to make:&lt;/p&gt;

&lt;p&gt;1) If the AWS service is either DynamoDB or S3, use Gateway Endpoint.&lt;/p&gt;

&lt;p&gt;2) Use the Interface Endpoint for all other purposes.&lt;/p&gt;

&lt;p&gt;As most AWS services may be connected privately through this type of endpoint, let's start with Interface VPC Endpoint.&lt;/p&gt;

&lt;p&gt;In the diagram below, I have used the private network to link the EC2 instance to the SQS. I created an endpoint network interface in the same subnet as the EC2 instance and attach a security group with the appropriate access permissions to this endpoint networking interface to establish an interface endpoint. The service provider must approve the interface endpoint after it is created. In general, all endpoint requests will be immediately accepted by AWS services and this happens automatically.&lt;/p&gt;

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

&lt;p&gt;Gateway endpoint is a little bit different. In the figure below, the gateway endpoint is created at the VPC level. I need to attach an endpoint policy  to the gateway endpoint that allow access to the S3 service and also specify a route in the route table in subnet 10.18.0.0 so the EC2 instance can find a path to the S3 bucket.&lt;/p&gt;

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

&lt;p&gt;In both scenarios, the communications between the service consumer and the service provider never get out of the AWS network hence your data remains secured.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Delete Old Backup/Logfiles/Temp files from EFS using Lambda, PowerShell &amp; Event Bridge</title>
      <dc:creator>Ujjwal B Soni</dc:creator>
      <pubDate>Sat, 09 Jul 2022 07:04:47 +0000</pubDate>
      <link>https://forem.com/ujjwalbsoni/delete-old-backuplogfilestemp-files-from-efs-using-lambda-powershell-event-bridge-igi</link>
      <guid>https://forem.com/ujjwalbsoni/delete-old-backuplogfilestemp-files-from-efs-using-lambda-powershell-event-bridge-igi</guid>
      <description>&lt;p&gt;Recently i was working on a requirement where a legacy application was migrated to AWS using Lift and Shift strategy.  This application used to generate lot of log data and Temporary files.&lt;/p&gt;

&lt;p&gt;The log, temp and backup folder size used to reach around 20GB in 2 days, we were using EFS and there were multiple EC2 instances that were connected to EFS.&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%2Fdmbtbsv6ukr2obn0om9r.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%2Fdmbtbsv6ukr2obn0om9r.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After analyzing each file we decided that temporary files were just used for pre-processing and they were only required one time so we decided to delete those along with older log files (except access logs) &amp;amp; Old backup files.&lt;/p&gt;

&lt;p&gt;I decided to use Powershell Lambda and integrate EFS with Lambda, this function will delete all un-necessary data from EFS. This function will execute periodically using Event Bridge &amp;amp; delete un-necessary files.&lt;/p&gt;

&lt;p&gt;We will create Lambda function first using Visual Studio Code&lt;/p&gt;

&lt;p&gt;Step 1 : Download Visual Studio Code&lt;br&gt;
Step 2 : Execute below commands in powershell&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$region_code = 'ap-south-1'&lt;br&gt;
$secretKey='your secret key'&lt;br&gt;
$accessKey='your access key'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#Install-Module AWSPowerShell -Scope CurrentUser&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#Install-Module AWSLambdaPSCore -Scope CurrentUser&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import-Module AWSPowerShell -Force&lt;br&gt;
Import-Module AWSLambdaPSCore -Force&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#configure script credentials&lt;br&gt;
Initialize-AWSDefaultConfiguration -AccessKey $accessKey -SecretKey $secretKey -Region ap-south-1&lt;br&gt;
Set-AWSCredential -AccessKey $accessKey -SecretKey $secretKey -StoreAs default&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#shows existing function list from AWS&lt;br&gt;
Get-LMFunctionList&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Get-AWSPowerShellLambdaTemplate&lt;/code&gt;&lt;br&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%2Fgqyfo2iuhufssvg1g22x.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%2Fgqyfo2iuhufssvg1g22x.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We'll be using Basic Barebone Script and adding our script commands to it&lt;/p&gt;
&lt;h1&gt;
  
  
  Create a Starter Lambda function
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;New-AWSPowerShellLambda -ScriptName DeleteUnusedFiles -Template Basic&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;You will get this project folder in explorer pane in your Visual Studio Code or else you can import the folder, this project gets created in the same &lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Step 3 : Add below command to your Powershell script, this is to ensure that our Lambda function is successfully able to get &lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd /mnt/efs&lt;br&gt;
Remove-Item * -Include *.tmp &lt;br&gt;
ls /mnt/efs&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 4 : upload Lambda function to AWS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$publishPSLambdaParams = @{                                                                       
     name = "DeleteUnusedFiles "
     ScriptPath = ".\DeleteUnusedFiles\DeleteUnusedFiles.ps1"
     Region = "ap-south-1"
     IAMRoleArn = "delete_backup_rp_role"
     }

Publish-AWSPowerShellLambda @publishPSLambdaParams
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fbsobadpimcqkga0srr39.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%2Fbsobadpimcqkga0srr39.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have created an EFS file system and Access points as below (You can refer below video for more information on setting up EFS and Mount Targets) :  &lt;iframe width="710" height="399" src="https://www.youtube.com/embed/jhU7tX3D4ZE?start=1513"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Below are the details for my Accesspoint:&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%2Fpqof49cb0worilqhph7e.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%2Fpqof49cb0worilqhph7e.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once EFS is created and  Access points are ready, you need to login to your EC2 instance and mount EFS&lt;/p&gt;

&lt;p&gt;1) install EFS Mount Helper&lt;/p&gt;

&lt;p&gt;sudo yum install -y amazon-efs-utils&lt;/p&gt;

&lt;p&gt;2) create folder as efs&lt;/p&gt;

&lt;p&gt;mkdir /efs&lt;/p&gt;

&lt;p&gt;3) Mount EFS&lt;/p&gt;

&lt;p&gt;sudo mount -t efs -o tls,accesspoint=fsap-9999999999999999 fs-8888888888888888:/ efs&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Important Step&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Remember to configure security group in EFS as 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%2F0wn6w90hiworbdfv2u49.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%2F0wn6w90hiworbdfv2u49.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk2w16frv5xgyh00hfcbp.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%2Fk2w16frv5xgyh00hfcbp.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once above steps are completed, we will integrate EFS with Lambda as below:&lt;/p&gt;

&lt;p&gt;**** Important, you must associate Lambda to a VPC first, without doing this step, you wont be able to attach EFS&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%2Fpx3by2j0tn7qgf2v9def.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%2Fpx3by2j0tn7qgf2v9def.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1) Create Role with below permissions and associate it with Lambda function&lt;br&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%2Fotqf625uahk2o0l6mskq.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%2Fotqf625uahk2o0l6mskq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) Open your Lambda Function (In this example i am using PowerShell lambda function)&lt;br&gt;
3) Navigate to Configuration tab &lt;br&gt;
4) Open File-System Subtab&lt;/p&gt;

&lt;p&gt;Select EFS File System, Access point and Local Mount Point as per below screenshot and Hit save/create 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%2Fusjjnx4o6hukshd6ki6d.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%2Fusjjnx4o6hukshd6ki6d.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once successfully published you can test your function by opening your Lambda function and clicking on Test, after creating Test event.&lt;/p&gt;

&lt;p&gt;As you can see in below screenshot we can see the result of ls command which shows files that are there in the EFS share and hence this shows that we can access the EFS from Lambda.&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%2F9z1u7c6po4n5cjkvr1xw.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%2F9z1u7c6po4n5cjkvr1xw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once this is successfully created you can schedule your Lambda function using Event Bridge to execute periodically.&lt;/p&gt;

&lt;p&gt;Troubleshooting:&lt;/p&gt;

&lt;p&gt;If you get an error stating "Cannot configure .NET CLI", open below file from Path in Notepad++&lt;/p&gt;

&lt;p&gt;C:\Program Files\WindowsPowerShell\Modules\AWSLambdaPSCore\3.0.1.0\Private_DeploymentFunctions.ps1&lt;/p&gt;

&lt;p&gt;Find for keyword $LASTEXITCODE&lt;br&gt;
Comment all occurrence and conditions that are using this variable and run below commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import-Module AWSPowerShell -Force
Import-Module AWSLambdaPSCore -Force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try to upload Lambda function again using Powershell, it should work now.&lt;/p&gt;

&lt;p&gt;If you have any other comment, suggestion for this post then do let me know.&lt;/p&gt;

&lt;p&gt;Please do subscribe my YouTube channel &lt;a href="https://www.youtube.com/c/Cloudperceptor/videos" rel="noopener noreferrer"&gt;https://www.youtube.com/c/Cloudperceptor/videos&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;
Ujjwalkumar Soni&lt;/p&gt;

</description>
      <category>lambda</category>
      <category>serverless</category>
      <category>efs</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
