Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md

README.md

🙌 AWS CLI Useful Commands

Some useful AWS CLI commands to increase your productivity:

🔥Get private ip address of instance by providing public ip address:

Note: Replace $region with your region and $publicIp with your public ip.

aws ec2 describe-instances --region $region --filters "Name=ip-address,Values=$publicIp" --query Reservations[*].Instances[*].PrivateIpAddress --output table  

🔥Get public ip address of instance by providing private ip address:

Note: Replace $region with your region and $private_ip with your privateIp.

aws ec2 describe-instances --region $region --filters "Name=private-ip-address,Values=$privateIp" --query Reservations[*].Instances[*].PublicIpAddress --output table

🔥 Get InstanceId, Public Ip Address,Private Ip Address,Vpc Id based on Tag:

Note: Replace $tag with your required tag name and $tag_content with your tag content.

aws ec2 describe-instances --region $region --filters "Name=tag:$tag,Values=$tag_content" --query 'Reservations[*].Instances[*].[Tags[?Key==`Name`].Value,InstanceId,PublicIpAddress,PrivateIpAddress,VpcId]' --output text

⭐️ Get VPC details:

Note: Replace $vpcId with your vpc id and $region with your region.

aws ec2 describe-vpcs --vpc-ids $vpcId --region $region   

⭐️ Get VPC name by giving vpc id:

Note: Replace $vpcid with your vpc id and $region with your region.

aws ec2 describe-vpcs --vpc-ids $vpcid --region $region --query Vpcs[*].Tags[*].Value

🔓 List AWS Secret Manager Secrets:

Note: Replace $region with your region

aws secretsmanager list-secrets --region $region --query SecretList[*].Name --output table

🔓 Decrypt and get specific secret:

Note: Replace $secretId with your secret.

aws secretsmanager get-secret-value --secret-id $secretId --region $region --query SecretString --output text

License

Licensed Under GPL 2.0.

You can’t perform that action at this time.