Skip to content

Commit 13d4bbc

Browse files
committed
[update] - add function +aws_ec2_stop and +aws_ec2_start ec2
1 parent e854252 commit 13d4bbc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

services/ec2.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ aws_ec2_reboot() {
3636
aws_run_commandline "aws ec2 reboot-instances --instance-ids $instance_id"
3737
}
3838

39+
aws_ec2_stop() {
40+
instance_id=$1
41+
echo Stop the ec2 instance ${instance_id:?"The instace_id is unset or empty"}
42+
aws_run_commandline "aws ec2 stop-instances --instance-ids $instance_id"
43+
}
44+
45+
aws_ec2_start() {
46+
instance_id=$1
47+
echo start the ec2 instance ${instance_id:?"The instace_id is unset or empty"}
48+
aws_run_commandline "aws ec2 start-instances --instance-ids $instance_id"
49+
}
50+
51+
3952
# Ec2 image
4053
aws_ec2_list_images() {
4154
aws_run_commandline "aws ec2 describe-images --owners self"

0 commit comments

Comments
 (0)