Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I add an IP address in a AWS CLI with out exporting

I am running below command to ingress in was-cli, it is working fine if I provide IP address, but I want it to know IP and pass it.
I was trying something like below but it is not helping

aws ec2 authorize-security-group-ingress --group-id sg-123456778 --protocol tcp --port 22 --cidr echo "$(curl https://checkip.amazonaws.com)/32" --profile xyzzy

If I am doing below then it work but I want it to be done by above way.

IP=`echo "$(curl https://checkip.amazonaws.com)/32"`
aws ec2 authorize-security-group-ingress --group-id sg-123456778 --protocol tcp --port 22 --cidr $IP --profile xyzzy

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use -s with curl.

Try this:

aws ec2 authorize-security-group-ingress --group-id sg-123456778 --protocol tcp --port 22 --cidr $(echo "$(curl -s https://checkip.amazonaws.com)/32") --profile xyzzy
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading