0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[JAWS-UG CLI] ELB:#5 ロードバランサの削除

Last updated at Posted at 2015-08-17

前提条件

ELBへの権限

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

EC2への権限

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

AWS CLIのバージョン

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

  • AWS CLI 1.10.58
コマンド
aws --version
結果(例)
      aws-cli/1.10.63 Python/2.7.11 Darwin/15.6.0 botocore/1.4.53

バージョンが古い場合は最新版に更新しましょう。

コマンド
sudo -H pip install -U awscli
  1. 準備
    =======

0.1. リージョンの決定

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

0.2. 変数の確認:

プロファイルが想定のものになっていることを確認します。

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

0.3. ロードバランサ名の指定

変数の設定
ELB_LB_NAME='lb-handson-20160912'
  1. 事前作業
    ===========

1.1. 削除対象のロードバランサの確認

コマンド
aws elb describe-load-balancers \
        --load-balancer-names ${ELB_LB_NAME}
結果(例)
      {
        "LoadBalancerDescriptions": [
          {
              "Subnets": [
                  "subnet-xxxxxxxx",
                  "subnet-xxxxxxxx"
              ],
              "CanonicalHostedZoneNameID": "xxxxxxxxxxxx",
              "CanonicalHostedZoneName": "lb-handson-20160912-xxxxxxxx.ap-northeast-1.elb.amazonaws.com",
              "ListenerDescriptions": [
                  {
                      "Listener": {
                          "InstancePort": 80,
                          "LoadBalancerPort": 80,
                          "Protocol": "HTTP",
                          "InstanceProtocol": "HTTP"
                      },
                      "PolicyNames": []
                  }
              ],
              "HealthCheck": {
                  "HealthyThreshold": 10,
                  "Interval": 30,
                  "Target": "TCP:80",
                  "Timeout": 5,
                  "UnhealthyThreshold": 2
              },
              "VPCId": "vpc-xxxxxxxx",
              "BackendServerDescriptions": [],
              "Instances": [],
              "DNSName": "lb-handson-20160912-xxxxxxxx.ap-northeast-1.elb.amazonaws.com",
              "SecurityGroups": [
                  "sg-xxxxxxxx"
              ],
              "Policies": {
                  "LBCookieStickinessPolicies": [],
                  "AppCookieStickinessPolicies": [],
                  "OtherPolicies": []
              },
              "LoadBalancerName": "lb-handson-20160912",
              "CreatedTime": "2016-09-12T01:23:45.678Z",
              "AvailabilityZones": [
                  "ap-northeast-1a",
                  "ap-northeast-1c"
              ],
              "Scheme": "internet-facing",
              "SourceSecurityGroup": {
                  "OwnerAlias": "XXXXXXXXXXXX",
                  "GroupName": "ec2-http-https-global-inbound"
              }
          }
        ]
      }
  1. ロードバランサの削除
    =======================
変数の確認
cat << ETX

        ELB_LB_NAME: ${ELB_LB_NAME}

ETX
コマンド
aws elb delete-load-balancer \
        --load-balancer-name ${ELB_LB_NAME}
結果
      (戻り値なし)
  1. 事後作業
    ===========

同名のロードバランサが存在しないことを確認します。

コマンド
aws elb describe-load-balancers \
        --load-balancer-names ${ELB_LB_NAME}
結果
      A client error (LoadBalancerNotFound) occurred when calling the DescribeLoadBalancers operation: Cannot find Load Balancer lb-handson-20160912

完了

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?