Help us understand the problem. What is going on with this article?

[JAWS-UG CLI] AutoScaling:#8 起動設定の削除

More than 3 years have passed since last update.

前提条件

AutoScalingへの権限

  • AutoScalingに対してフル権限があること。

EC2への権限

  • EC2に対してフル権限があること。

AWS CLIのバージョン

  • 以下のバージョンで動作確認済

    • AWS CLI 1.7.42
コマンド
aws --version
結果(例)
      aws-cli/1.7.42 Python/2.7.5 Darwin/13.4.0

0. 準備

0.1. リージョンの決定

変数の設定
AWS_DEFAULT_REGION='ap-northeast-1'

0.2. 変数の確認

変数の確認
aws configure list
結果(例)
            Name                    Value             Type    Location
            ----                    -----             ----    --------
         profile    ec2as_full-prjZ-mbp13              env    AWS_DEFAULT_PROFILE
      access_key     ****************LOAQ shared-credentials-file
      secret_key     ****************I1O1 shared-credentials-file
          region           ap-northeast-1              env    AWS_DEFAULT_REGION

0.3. 稼動インスタンスを確認

同一リージョンでインスタンスが起動していることを確認します。

コマンド
aws ec2 describe-instances \
        --filters Name=instance-state-name,Values=running
結果
      {
          "Reservations": []
      }

0.4. 起動設定名の指定

変数の設定
AS_GROUP_NAME=''

1. 事前作業

設定内容を確認します。

コマンド
aws autoscaling describe-launch-configurations \
        --launch-configuration-names ${AS_LAUNCH_CONFIG_NAME} 
結果(例)
      {
        "LaunchConfigurations": [
          {
              "UserData": "",
              "EbsOptimized": false,
              "LaunchConfigurationARN": "arn:aws:autoscaling:us-west-2:XXXXXXXXXXXX:launchConfiguration:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:launchConfigurationName/my-first-lc",
              "InstanceMonitoring": {
                  "Enabled": true
              },
              "ClassicLinkVPCSecurityGroups": [],
              "CreatedTime": "2015-08-01T01:23:45.678Z",
              "BlockDeviceMappings": [],
              "KeyName": "prjx-us-west-2-ec2",
              "SecurityGroups": [
                  "sg-xxxxxxxx"
              ],
              "LaunchConfigurationName": "my-first-lc",
              "KernelId": "",
              "RamdiskId": "",
              "ImageId": "ami-xxxxxxxx",
              "InstanceType": "t2.micro",
              "AssociatePublicIpAddress": true
          }
        ]
      }

2. 起動設定の削除

2.1. 起動設定の削除

変数の確認
cat << ETX

        AS_LAUNCH_CONFIG_NAME: ${AS_LAUNCH_CONFIG_NAME}

ETX
コマンド
aws autoscaling delete-launch-configuration \
        --launch-configuration-name ${AS_LAUNCH_CONFIG_NAME}
結果
      (戻り値なし)

2.2. 起動設定の確認

コマンド
aws autoscaling describe-launch-configurations \
        --launch-configuration-names ${AS_LAUNCH_CONFIG_NAME} 
結果
      {
          "LaunchConfigurations": []
      }

完了

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away