I am trying to export EC2SecurityGroups via AWSCLI PowerShell.
Get-EC2SecurityGroup -Credential $Creds -Region us-east-1 > C:\us-east-1.txt
Exports ok, but format not showing everything in detail. When I run:
aws ec2 describe-security-groups --region us-east-1 > C:\us-east-1.txt
that shows detailed all rules.
Anyway to export same format using PowerShell?
Thanks!
This data is all there in AWS Tools for PowerShell as well, but PowerShell itself does not expand nested object output like you're expecting it to.
To expand all nested objects with JSON output:
Get-EC2SecurityGroup -Credential $Creds -Region us-east-1 | ConvertTo-JSON -Depth 5 | Out-File C:\us-east-1.txt
To expand all nested objects with classnames:
Get-EC2SecurityGroup -Credential $Creds -Region us-east-1 | Format-Custom -Depth 5 -Expand Both