Welcome to the new Linux Foundation Forum!

POC on connecting to aws iam using awscreds using bash script

Sri81Sri81 Posts: 1
edited March 2018 in New to Linux

All - 

Im good at linux but not at expect/send :

below is the function i have written for trying to connect to respective iam role.

 



function passingvalues {

expect << EOF

spawn $AWS_USERNAME -c "exit"

expect "password:"

send "$AWS_PASSWORD\r"

expect "role:"

puts "$expect_out(buffer)"

foreach line [split $expect_out(buffer) "\n"] {  

     if {[regexp -nocase "arn:aws:iam::54250:role/OM-NonProd_RedshiftServices-DevUsers-Team-Support" $line]} {

          puts $line

               }

        }

expect eof

EOF

                       } 

error : it is unable to iterate through the list of roles displayed and unable to connect.

Can you please help me understand how to grep on a specific value using expect/send.

 

Sign In or Register to comment.