Tuesday, August 31, 2021

AWS CLI some important command to pull details.


Get the list of Classic EC2 with instance DI, AZ, Tag with name customer.

 

for region in $(aws ec2 describe-regions --profile Give_profile_Name --output text | cut -f 4) ; do aws ec2 describe-instances --query 'Reservations[*].Instances[?VpcId==`null`].{ID:InstanceId,Name:Tags[?Key==`Name`]|[0].Value,customer:Tags[?Key==`customer`]|[0].Value,AZ:Placement.AvailabilityZone}' --region $region --profile Give_profile_name  --output text;done



Get a list of EC2 machine, filtered by Name, using AWS Cli. 

#!/bin/bash # VARS # # User input accounts=hos echo -e "\[2;33m Enter EC2 Exact Name or add (*) if you don't remember Exact name: Example Zoetis\e[0m" read EC2_Name for account in {pu-hos,pu-dxm}; do #replace your profile name here echo "| $account |" echo " -----" for region in `aws --profile $account ec2 describe-regions --query 'Regions[*].{Region:RegionName}' --output text`; do aws ec2 describe-instances --filter 'Name=tag:Name,Values=*'$EC2_Name'*' --query 'Reservations[*].Instances[*].{Account:`'$account'`,Region:`'$region'`,Instance:InstanceId,PubIP:PublicIpAddress,PrivateIp:PrivateIpAddress,Name:Tags[?Key==`Name`]|[0].Value,Customer:Tags[?Key==`customer`]|[0].Value,Status:State.Name,OS:PlatformDetails,InstanceType:InstanceType}' --output text --profile $account --region $region done done # END OF FUNCTION exit 1;






29 comments:


  1. I am regularly reading your content, glad that I came across such an informative post. I really like your information. If you want to grow your online business then you must choose Hitsbuddy

    ReplyDelete
  2. Very fascinating and spellbinding blog. A single attentive reading is enough to understand the points and the information mentioned Linux, cloud. If you are looking for fastest and cheapest USA Dedicated Server you can ask us for more details and services.

    ReplyDelete
  3. Simple but very accurate information… Thanks for sharing this one. A must-read post! I share such information, especially about USA VPS Hosting if anyone wants to take knowledge regarding USA Dedicated, then I would love to help you.

    ReplyDelete
  4. Hii...This blog is impressive and attractive.You mention many great information in this blog.If you want to know about Dedicated Server Hosting USA Dedicated Hosting which come with unique features.

    ReplyDelete
  5. Thanks for ones this excellent posting, I actually enjoyed
    reading it, you are a great author. Here I also want to share some information on the best USA Dedicated Server Hosting services for your business website at a very affordable price.

    ReplyDelete
  6. wow very engaging and fascinating blog. A single conservative reading is sufficiently to comprehend the points and the details mentioned Linux, cloud. USA Dedicated ServerIf you are looking for fastest and cheapest USA Dedicated Server you can ask us for more details and services.

    ReplyDelete
  7. The information provided is excellent. I am grateful for the information you provide on your blog. Hosting for Turkey Dedicated Server is something we provide.

    ReplyDelete
  8. This Blog was very informative. Thank you for making it. Are you want to know that what is USA Dedicated Server? if not, then I can help you and I will give you the best info.

    ReplyDelete
  9. Great! It's an amazing blog posting by you, thank you very much. If you are searching for the fastest and cheapest USA Dedicated Server hosting, you can ask us for more details and services.

    ReplyDelete
  10. Your blog posts are more interesting and impressive. I think there are many people like and visit it regularly, including me. I appreciate your own position and I will be sure to come back here. USA Dedicated Server

    ReplyDelete

  11. A Blog very useful and helpful you are proving good quality information from this article. Keep sharing kindling this type details for everyone. If you want some important thoughts. Here are mention some most important guidelines. USA Dedicated Hosting > which is unique to other hosting provider customers where get brilliant server plans for all Customer.

    ReplyDelete
  12. literally Wow!! this information is very informative for me. Good explanation in (Linux, Cloud & Windows tutorials for beginners) your article is explaining a point to point this is good for every who visit on this article get the full information. Also buy now Norway Dedicated Server Hosting. you can ask us for more details and services.

    ReplyDelete
  13. Fantastic post; I appreciate you sharing your wonderful experience on your site. USA Dedicated Hosting where get brilliant server plans for all Customer.

    ReplyDelete
  14. Great, you explained everything in your blog. Thanks for the info; this is nice and helpful. My friends will definitely benefit from this article.
    France VPS Server Hosting.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Great, you explained everything in your blog. Thanks for the info; this is nice and helpful. If you are searching for the fastest and cheapest USA Dedicated Server, you can ask us for more details and services...USA Dedicated Server

    ReplyDelete
  17. This blog is very good. We got a lot of information from this. Blog is helpful to all of us If you are searching for fastest and cheapest USA dedicated server, you can ask us for more details and services...USA Dedicated Server

    ReplyDelete
  18. Your article is very creative. You post all the valuable things. If you are interested to know server hosting, then choose thank you for giving this information__If you want to visit our site, then click on this link... USA Dedicated Server

    ReplyDelete
  19. Your blog is excellent, keep posting blogs like this; thanks for this blog. If you are searching for the fastest and cheapest USA VPS Server, you can ask us for more details and services..USA VPS Server

    ReplyDelete
  20. Hello guys,
    I read your blog and I found it very good. There is a lot of good information on this blog, I'd like to share and I think people will get a lot of support from this blog. Thanks for sharing this informative blog, please keep up and share some unique posts with us in the future. Visit USA Dedicated ServerUSA Dedicated Server

    ReplyDelete
  21. Great blog on such a great topic keep posting it Mattress Cleaning at Home

    ReplyDelete

  22. This blog gives a lot of information; thank you for this blog. If you are searching for the fastest and cheap Ukraine VPS Server, you can ask us for more details and services.. Ukraine VPS Server

    ReplyDelete
  23. Your blog is quite helpful and you are demonstrating high-quality information in this article. Continue spreading information of this nature to everyone. if you want any crucial ideas.....France Dedicated Server....... France Dedicated Server

    ReplyDelete
  24. Thank you for sharing this informative blog post about AWS CLI and important commands for pulling data. It's always helpful to learn new tips and tricks for managing cloud resources. By the way, if you're looking for a reliable hosting solution to support your cloud infrastructure, I highly recommend considering Sweden VPS Hosting.

    ReplyDelete
  25. Get the Best Real Estate Developers in Bangalore, Investment Plots in Bangalore, and Luxury Apartments near Manyata Tech Park by Preetidevelopers. For more information in detail visit our website.
    Best Real Estate Developers in Bangalore

    ReplyDelete
  26. Awesome blog. Visit Kalakutir Pvt Ltd for Industrial Floor Marking, Industrial Painting, Truck Advertisement, and Fast Food Branding. Visit our website for more information in details.
    Fast Food Branding

    ReplyDelete