LoginSignup
1
1

More than 5 years have passed since last update.

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

Last updated at Posted at 2015-08-03

前提条件

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": []
      }

完了

1
1
0

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
1
1