NathanFriend.co.uk

Developers notebook

Month: February 2016

Amazon ec2 CLI – Return instance public DNS by tag

aws ec2 describe-instances –output=json –filter Name=tag:{TAG NAME},Values=”{TAG VALUE}” –query “Reservations[].Instances[].PublicDnsName”

For example if you have some ec2 instances with a tag key “Name” and the value “Webserver Auto Scaling Group”

aws ec2 describe-instances –output=json –filter Name=tag:Name,Values=”Webserver Auto Scaling Group” –query “Reservations[].Instances[].PublicDnsName”

Find and replace a line with sed

sed -i “/;Thing to find/c\Thing to replace it with” /path/to/file

sed -i “/;date.timezone =/c\date.timezone = Europe/London” /etc/php.ini

© 2017 NathanFriend.co.uk

Theme by Anders NorenUp ↑