A simple interactive Bash CLI tool to manage AWS EC2 instances using the AWS CLI.
It provides a convenient menu-driven interface to list, start, stop, reboot, view details, terminate instances, and check their health status.
- List all EC2 instances in a given AWS region (with names and states)
- Start instances
- Stop instances
- Reboot an instance
- View detailed instance information in a table format
- Terminate an instance
- Check instance health status (system, instance, and reachability)
- AWS CLI installed and configured with appropriate credentials and permissions.
- Bash shell environment.
- IAM permissions required for the actions used by the script (see below).
Ensure your IAM user or role has the following permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeInstanceStatus",
"ec2:DescribeTags"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ec2:StartInstances",
"ec2:StopInstances",
"ec2:RebootInstances",
"ec2:TerminateInstances"
],
"Resource": "*"
}
]
}-
Clone or download this repository.
-
Ensure the script is executable:
chmod +x ec2-portal.sh
-
Run the script:
./ec2-portal.sh
-
Follow the interactive menu to manage your EC2 instances.
- The script defaults to the AWS region
us-east-1. To change it, modify theREGIONvariable near the top of the script.
Main menu:
Option 1:
Option 3:
Option 6:
Option 7:
Option 5:
- Terminating an instance is permanent and cannot be undone.
- The script requires AWS CLI configured with credentials that have the necessary permissions.
Developed by Mohamed Boussas
GitHub: @boussas
If you have questions or feature requests, please open an issue or contact me.