mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-10 15:28:35 +00:00
27 lines
727 B
Bash
Executable File
27 lines
727 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Quick script to boot an instance from generated AMI. Intended to be invoked
|
|
# from "alpine" directory.
|
|
|
|
set -e
|
|
|
|
INSTANCE_ID=$(cat ./aws/instance_id.out)
|
|
aws ec2 terminate-instances --instance-id ${INSTANCE_ID} || true
|
|
|
|
if [[ ! -f ./aws/ami_id.out ]]; then
|
|
echo "AMI ID to launch instance from not found"
|
|
exit 1
|
|
fi
|
|
|
|
AMI_ID=$(cat ./aws/ami_id.out)
|
|
|
|
echo "Running instance from ${AMI_ID}"
|
|
|
|
INSTANCE_ID=$(aws ec2 run-instances --image-id ${AMI_ID} --instance-type t2.nano | jq -r .Instances[0].InstanceId)
|
|
|
|
aws ec2 create-tags --resources ${INSTANCE_ID} --tags Key=Name,Value=moby-boot-from-ami
|
|
|
|
echo ${INSTANCE_ID} >./aws/instance_id.out
|
|
|
|
watch -n5 aws ec2 describe-instances --instance-ids ${INSTANCE_ID}
|