I need to automate aws configure, connect to ec2 and runs commands inside EC2 instance using shell scripting.
echo "Do you need to configre AWS configure [y/n]?"
read -r aws_configure
if [ y = $aws_configure ]; then
echo "######################################"
echo " AWS Configure "
echo "######################################"
aws configure
else
echo "Skipped AWS Configuration !"
echo "---------------------------"
fi
echo "######################################"
echo " Connecting to EC2 Instance "
echo "######################################"
echo "Which swarm that you need to create [private(a) or public(b)]?"
read -r swarm
ssh -i ~/Documents/AWS/eu_instance_key.pem ec2-user@<EC2 Instance IP address>
**docker image ls ==> I need to run this command on EC2 instance**
I can connect to EC2 instance by sending ssh request to the instance. But I can't switch EC2 instance to my other commands.
I want to run some commands on EC2 server after connected to the instance using bash script.
I could not find a way to do that and I'm new the shell scripting.
Any help would be appreciated! Thank you.