Sometimes, we may need an ec2 for a quick thing or may just want to create an ec2 with some desired setting over and over again. This is one of many ways you can do that. Our goal is to be quick in creating an EC2 that works. Feel free to edit and even submit pull request with improved code.
-
I'm assuming that your default Security Group had ssh access. If not, you may have to add a SG with SSH after you provision the ec2. Or just make some changes in the code to make it work.
-
Clone this repo.
-
Make this script executable
chmod +x run-ec2
- Add the folder with this script to your PATH. You can do this by modifying the ~/.bash_profile file( permanent fix) or entering the command below in the terminal. This is a temporary way to add the executable to the PATH.
export PATH= $PATH:/path-to-this-script
-
Open the file and replace the key-name on line 4 . Make some more changes if you want.
-
Save the changes
-
type this command on your terminal
run-ec2
You should get an output like this:
Use this to login: ssh -i mykey.pem [email protected]
Thanks for doing this Lab! checkout my github and youtube channel for more.