Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get ip address only in ecs-cli ps #583

Open
ghost opened this issue Aug 15, 2018 · 1 comment
Open

how to get ip address only in ecs-cli ps #583

ghost opened this issue Aug 15, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Aug 15, 2018

ecs-cli up --keypair mykeyname --capability-iam --size 1 --instance-type t2.small --region us-east-2 --force

i am using this command to create cluster and its working perfectly fine, but now i wanted to ssh into that server and add some configuration file so that i can send logs to other server, i tried ecs-cli ps but it gives me port, state etc. but i need ip address only, i did not found any way to get ip only

@JorgeJFCovello
Copy link

I encounter a similar problem but I used a bash script to get the ips that I needed

LINES=$(ecs-cli ps --cluster test | grep -i -o "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*") #get each line with ecs-cli ps
IPS=$(echo $LINES | tr " " "\n") #split each line by spaces and \n
for ip in $IPS
do 
   echo $ip #add ip logic here
done

I hope you find it useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants