User Tools

Site Tools


aws:ebsvolumes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
aws:ebsvolumes [03/01/2025 16:28] – [Show encryption status of EBS] andrewaws:ebsvolumes [03/01/2025 16:29] (current) andrew
Line 9: Line 9:
 Best practice is for EBS volumes to be encrypted. This script will show the volume status for each volume in the account and what it is attached to (if any). It is possible to have a volume attached to multiple ec2 instances but EBS does not handle file locking etc, so this is unusual. Best practice is for EBS volumes to be encrypted. This script will show the volume status for each volume in the account and what it is attached to (if any). It is possible to have a volume attached to multiple ec2 instances but EBS does not handle file locking etc, so this is unusual.
  
-<script python>+<code python>
 #!/usr/bin/python3 #!/usr/bin/python3
  
 import boto3 import boto3
 ec2_client = boto3.client('ec2') ec2_client = boto3.client('ec2')
- 
  
 response = ec2_client.describe_volumes() response = ec2_client.describe_volumes()
  
 for vol in range(len(response['Volumes'])): for vol in range(len(response['Volumes'])):
- 
     if len(response['Volumes'][vol]['Attachments']) == 0:     if len(response['Volumes'][vol]['Attachments']) == 0:
         # print("Zero length list"         # print("Zero length list"
Line 31: Line 29:
         response['Volumes'][vol]['Attachments'][0]['InstanceId'], \         response['Volumes'][vol]['Attachments'][0]['InstanceId'], \
         "Encryption Status is", response['Volumes'][vol]['Encrypted'])         "Encryption Status is", response['Volumes'][vol]['Encrypted'])
-</script>+</code>
  
  
aws/ebsvolumes.1735921689.txt.gz · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki