Skip to content

Instantly share code, notes, and snippets.

@criscunhasantos
Last active December 3, 2024 20:26
Show Gist options
  • Save criscunhasantos/da9d3a6f19fd237ec87a5a6f1b3ce9e6 to your computer and use it in GitHub Desktop.
Save criscunhasantos/da9d3a6f19fd237ec87a5a6f1b3ce9e6 to your computer and use it in GitHub Desktop.
AWS Cheat Sheet
aws ec2 describe-vpn-connections --query 'VpnConnections[*].{Nome:Tags[?Key==`Name`]|[0].Value,Rotas:Routes[*].DestinationCidrBlock}' --output yaml
aws ec2 describe-volumes --query "Volumes[*].{VolumeID:Attachments[0].VolumeId,InstanceID:Attachments[0].InstanceId,State:Attachments[0].State,Encrypted:Encrypted}"
ssh-keygen -f ./livecloud -t rsa -m PEM
aws ec2 revoke-security-group-ingress --group-id $groupId `
--ip-permissions `
"$(aws ec2 describe-security-groups --output json --group-ids $groupId --query "SecurityGroups[0].IpPermissions")"
aws ec2 describe-instances --query "Reservations[*].Instances[*].{PublicIP:PublicIpAddress,PrivateIP:PrivateIpAddress,Name:Tags[?Key=='Name'].Value|[0],Status:State.Name,VpcId:VpcId,InstanceID:InstanceId,Groups:join(',',NetworkInterfaces[].Groups[].GroupId),IamInstanceProfile:IamInstanceProfile.Arn}" --filters "Name=instance-state-name,Values=running" --output json
aws ec2 describe-instances --query "Reservations[*].Instances[*].{PrivateIP:PrivateIpAddress,Name:Tags[?Key=='Name'].Value|[0],Status:State.Name,IamInstanceProfile:IamInstanceProfile.Arn}" --filters "Name=instance-state-name,Values=running" --output table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment