-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme
35 lines (20 loc) · 932 Bytes
/
readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Explanation
AWS Account Details:
Added a variable aws_accounts to store the details of AWS accounts (account ID, role name, and region).
Assume Role in Accounts:
The playbook assumes a role in each AWS account to gain access using sts_assume_role.
List EC2 Instances:
Retrieves the list of EC2 instances from each account using the credentials from the assumed roles.
Disk Utilization Fetching:
Uses the shell module to fetch disk utilization on each instance and aggregates the data.
Data Aggregation and Storage:
Aggregates the data into a JSON file and uploads it to an S3 bucket. Also stores the data in an RDS database.
CloudWatch Alarm Creation:
Creates a CloudWatch alarm to monitor disk usage and sends notifications via SNS.
Running the Playbook
Install Required Collections and Plugins:
sh
ansible-galaxy collection install amazon.aws
Execute the Playbook:
sh
ansible-playbook -i aws_ec2.yaml playbook.yml