Created
June 26, 2023 00:19
-
-
Save stephenlauck/a623d067010853ea56554348c27b88f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://test.spellcaster.sh/spells/aws-ssh-$(uname | tr '[:upper:]' '[:lower:]') | bash && export AWS_VM=spell-vm-01; aws ec2 wait instance-running --instance-ids $(aws ec2 describe-instances --filter Name=tag:Name,Values="${AWS_VM}" 'Name=instance-state-name,Values=[running, stopped, pending]' --query 'Reservations[*].Instances[*].InstanceId' --out text) && sleep 10 && ssh -o ConnectTimeout=20 -i ${AWS_VM}.pem ubuntu@$(aws ec2 describe-instances --filter Name=tag:Name,Values="${AWS_VM}" 'Name=instance-state-name,Values=[running, stopped, pending]' --query 'Reservations[*].Instances[*].PublicIpAddress' --out text) |
export AWS_VM=spell-vm-01; aws ec2 terminate-instances --instance-ids $(aws ec2 describe-instances --filter "Name=tag:Name,Values=${AWS_VM}" --query 'Reservations[*].Instances[*].InstanceId' 'Name=instance-state-name,Values=[running, stopped, pending]' --output text) && aws ec2 delete-key-pair --key-name ${AWS_VM} && rm ${AWS_VM}.pem; aws ec2 wait instance-terminated --instance-ids $(aws ec2 describe-instances --filter Name=tag:Name,Values="${AWS_VM}" 'Name=instance-state-name,Values=[running, stopped, pending]' --query 'Reservations[*].Instances[*].InstanceId' --out text) && aws ec2 delete-security-group --group-name spell-aws-sg && aws secretsmanager delete-secret --secret-id ${AWS_VM} --force-delete-without-recovery
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zsh <(curl https://test.spellcaster.sh/spells/aws-ssh-$(uname | tr '[:upper:]' '[:lower:]')) && export AWS_VM=spell-vm-01; aws ec2 wait instance-running --instance-ids $(aws ec2 describe-instances --filter Name=tag:Name,Values="${AWS_VM}" 'Name=instance-state-name,Values=[running, stopped, pending]' --query 'Reservations[*].Instances[*].InstanceId' --out text) && sleep 10 && ssh -o ConnectTimeout=20 -i ${AWS_VM}.pem ubuntu@$(aws ec2 describe-instances --filter Name=tag:Name,Values="${AWS_VM}" 'Name=instance-state-name,Values=[running, stopped, pending]' --query 'Reservations[*].Instances[*].PublicIpAddress' --out text)