View on GitHub

Get_All_Ec2_Instances_Across_All_Regions

Get All Ec2 Instances Across All Regions through Lambda Functions

Get_All_Ec2_Instances_Across_All_Regions

!Updated code coming soon!
An AWS Lambda function is needed to run.

The Script runs across all AWS regions and makes API Call DescribeInstances(), to get the instances.


getInstances function:


Steps:

Optional
a) Automating Script through Cloudwatch
b) Creating API through API-Gateway

Required IAM Roles for Lambda Function:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "MyStatementId",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeInstances",                
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}