avatarTeri Radichel

Summarize

Lambda Functions as Batch Jobs

ACM.268 Lambda functions for short-lived batch operations

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

⚙️ Part of my series on Automating Cybersecurity Metrics. The Code.

🔒 Related Stories: Git Security | Application Security | Secure Code | AWS Security | Network Security | Lambda Security

💻 Free Content on Jobs in Cybersecurity | ✉️ Sign up for the Email List

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the last post I was pondering networking issues if we try to use a Lambda function to access GitHub. I’m still hoping I can come up with something better but with the options we have right now, I’m limited on how I can leverage networking to block rogue repositories on GitHub.

Why am I even talking about Lambda in this scenario? Because I’m considering if I can create a batch job for my deployment process and leverage Lambda.

AWS Lambda as Batch Jobs

I wrote about batch jobs in other posts and specifically AWS Batch — a service dedicated to running batch jobs.

Although AWS Batch is a purpose-built option for running Batch Jobs, you can actually use a Lambda function to run a batch job as well. What is a batch job? As you’ll recall is a non-interactive data to run some code. It’s often used for daily data processing in banks and other companies where they need to process certain data sets once per day. They can be run on a schedule or on-demand.

In my case, I want to use a batch job to sync AWS CodeCommit with my GitHub repository for a static web site. This is a job that needs to process some data — or more specifically code. It pulls down the code from GitHub and checks it into AWS CodeCommit.

I thought about using AWS Batch for this purpose, but the code I need to copy around is quite small. It seems that AWS Batch may be overkill for this minimal action. When would I use AWS Batch instead?

Well, if I end up running a lot of jobs and I want scalable infrastructure and long-running jobs I might choose AWS Batch. I could use AWS Batch to run things in the background that I’m not in a hurry to process and use spot instances to save money, as I wrote about in prior posts.

But in this case, what I need to run will likely need to trigger and complete as quickly as possible. It’s a short-lived process. I’m guessing a Lambda function will complete the job quite nicely and it’s less complicated for me to set up.

One thing I am going to do is leverage a container for my batch job in an ECR repository. That way, if I ever decide I want to move this to AWS Batch instead, my code is transportable to the other service if we build a container that works in either environment.

Follow for updates.

Teri Radichel | © 2nd Sight Lab 2023

About Teri Radichel:
~~~~~~~~~~~~~~~~~~~~
⭐️ Author: Cybersecurity Books
⭐️ Presentations: Presentations by Teri Radichel
⭐️ Recognition: SANS Award, AWS Security Hero, IANS Faculty
⭐️ Certifications: SANS ~ GSE 240
⭐️ Education: BA Business, Master of Software Engineering, Master of Infosec
⭐️ Company: Penetration Tests, Assessments, Phone Consulting ~ 2nd Sight Lab
Need Help With Cybersecurity, Cloud, or Application Security?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🔒 Request a penetration test or security assessment
🔒 Schedule a consulting call
🔒 Cybersecurity Speaker for Presentation
Follow for more stories like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
❤️ Sign Up my Medium Email List
❤️ Twitter: @teriradichel
❤️ LinkedIn: https://www.linkedin.com/in/teriradichel
❤️ Mastodon: @teriradichel@infosec.exchange
❤️ Facebook: 2nd Sight Lab
❤️ YouTube: @2ndsightlab
Lambda
Batch
Job
AWS
Security
Recommended from ReadMedium