LoginSignup
3

More than 5 years have passed since last update.

EC2インスタンスが自殺するワンライナー

Posted at

色々な事情があって、たまにこういうのが欲しくなるので自分用にメモ。要AWSCLI。
/etc/rc.localとか、user-dataに渡してあげると起動した直後に消える。

$ aws ec2 terminate-instances --instance-ids `curl http://169.254.169.254/latest/meta-data/instance-id` --region `curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's/[a-z]$//g'`

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3