AWS EC2 Asset Discovery
In this guide we will showcase how to connect and retrieve EC2 instances from a given AWS account, then use Asset Update to store them within the Asset A-Ops application
Download template
Requirements
- Asset Integration
- AWS EC2 Integration
- AWS Boto3 Integration
Steps
- Add Trigger object to the flow
- Edit the trigger, name it and press save
- Add and configure an AWS boto3 Connect object to the flow, with an Access Key and Secret Access Key and Client Name Ec2. The region depends on the environment the information resides in.
- Add and configure an AWS EC2 Connect object to the flow, with an Access Key and Secret Access Key. The region depends on the environment the information resides in.
- Add an AWS EC2 List Instances to retrieve all available instances based on the permissions provided to the IAM AWS account
- Add and configure a ForEach action to loop over all retrieved EC2 Instances.
- Add and configure an action to store information from the EC2 Instances into variables.
- Add an AWS boto3 Client Function with a function describe_instance_types and the following arguments to retrieve the instance type of the currently looped EC2 instance:
{
"InstanceTypes": [
"%%data[var][instance_type]%%"
]
}
- Next Step is to add another forEach to loop through the list of Tags of each EC2Instance.
- An Asset Update would be connected to EC2 related Assets.
All above steps can be viewed below.