1

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!

Anthony Neace
  • 25,013
  • 7
  • 114
  • 129
user3421708
  • 55
  • 1
  • 2
  • 6

1 Answers1

3

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
Anthony Neace
  • 25,013
  • 7
  • 114
  • 129