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

Principal Security Engineer

@ Elsevier | Home based-Georgia

Infrastructure Compliance Engineer

@ NVIDIA | US, CA, Santa Clara

Information Systems Security Engineer (ISSE) / Cybersecurity SME

@ Green Cell Consulting | Twentynine Palms, CA, United States

Sales Security Analyst

@ Everbridge | Bengaluru

Alternance – Analyste Threat Intelligence – Cybersécurité - Île-de-France

@ Sopra Steria | Courbevoie, France

Third Party Cyber Risk Analyst

@ Chubb | Philippines