File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -17,26 +17,28 @@ aws_ec2_reboot() {
1717 aws ec2 reboot-instances --instance-ids $instance_id
1818}
1919
20-
20+ # Ec2 image
2121aws_ec2_list_images () {
2222 aws ec2 describe-images --owners self
2323}
2424aws_ec2_create_image () {
2525 instance_id=$1
26+ echo To create a image from the ec2 instance ${instance_id:? " The instace_id is unset or empty" }
2627 aws_ec2_instance_name=$( aws ec2 describe-instances \
2728 --instance-ids $instance_id \
2829 --query ' Reservations[*].Instances[*].{Tags:Tags[?Key == `Name`] | [0].Value}' \
2930 --output text)
3031
3132 aws ec2 create-image \
32- --no-reboot \
33- --instance-id $instance_id \
34- --name ${aws_ec2_instance_name} -` date ' +%Y-%m-%d-%H-%M-%S' ` \
35- --description ${aws_ec2_instance_name} -` date ' +%Y-%m-%d-%H-%M-%S' ` \
36- --query " ImageId" --output text
33+ --no-reboot \
34+ --instance-id $instance_id \
35+ --name ${aws_ec2_instance_name} -$( date ' +%Y-%m-%d-%H-%M-%S' ) \
36+ --description ${aws_ec2_instance_name} -$( date ' +%Y-%m-%d-%H-%M-%S' ) \
37+ --query " ImageId" --output text
3738}
3839
3940aws_ec2_get_image () {
4041 image_id=$1
42+ echo Get detail of the image ${image_id:? " The image_id is unset or empty" }
4143 aws ec2 describe-images --image-ids $image_id
4244}
You can’t perform that action at this time.
0 commit comments