Aug. 11, 2023, 3:55 p.m. | Fabricio

System Weakness - Medium systemweakness.com

In this article we’ll explore how to get an EC2 instance metadata and send it to an S3 bucket in json format. To do this we’ll use a python code inside a Lambda function with the permissions needed to upload the data into the S3 and to read the metadata instance.

Python code:

To run properly the python code we need some libraries, and environment variables for the bucket and the instance ID.

import boto3
import json
import os
from …

article automation aws code data ec2 function instance json lambda metadata permissions python run s3 bucket send terraform upload

CyberSOC Technical Lead

@ Integrity360 | Sandyford, Dublin, Ireland

Cyber Security Strategy Consultant

@ Capco | New York City

Cyber Security Senior Consultant

@ Capco | Chicago, IL

Sr. Product Manager

@ MixMode | Remote, US

Corporate Intern - Information Security (Year Round)

@ Associated Bank | US WI Remote

Senior Offensive Security Engineer

@ CoStar Group | US-DC Washington, DC