LoginSignup
0
0

More than 5 years have passed since last update.

[JAWS-UG CLI] CodePineline #2 パイプラインの削除

Posted at

AWS CLIを利用して、CodePipeline上にパイプラインを作成してみます。

前提条件

CodePipelineへの権限

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

AWS CLIのバージョン

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

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

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

コマンド
sudo -H pip install -U awscli

0. 準備

0.1. リージョンの決定

構築するリージョンを決めます。 (カレントユーザが利用するカレントリージョンも切り変わります。)

コマンド(バージニアリージョンの場合)
export AWS_DEFAULT_REGION='us-east-1'

注釈: 2016-10-10時点でCodePipelineはus-east-1/us-west-2/eu-west-1で提供されています。

0.2. 変数の確認

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

コマンド
aws configure list
結果(例)
            Name                    Value             Type    Location
            ----                    -----             ----    --------
         profile         codepipelineFull-prjz-mbp13        env    AWS_DEFAULT_PROFILE
      access_key     ****************XXXX shared-credentials-file
      secret_key     ****************XXXX shared-credentials-file
          region                         us-east-1  env    AWS_DEFAULT_REGION

AssumeRoleを利用している場合はprofileが ''と表示されます。 それ以外のときにprofileが '' と表示される場合は、以下を実行してください。

変数の設定
         export AWS_DEFAULT_PROFILE=<IAMユーザ名>

1. 事前作業

1.1. パイプライン名の指定

変数の設定
CODEP_PIPELINE_NAME='handson-20161010'

1.2. パイプラインの確認

コマンド
aws codepipeline get-pipeline \
        --name ${CODEP_PIPELINE_NAME}
結果
      {
        "pipeline": {
          "roleArn": "arn:aws:iam::XXXXXXXXXXXX:role/oneClick_AWS-CodePipeline-Service",
          "stages": [
              {
                  "name": "Source",
                  "actions": [
                      {
                          "inputArtifacts": [],
                          "name": "Source",
                          "actionTypeId": {
                              "category": "Source",
                              "owner": "AWS",
                              "version": "1",
                              "provider": "CodeCommit"
                          },
                          "outputArtifacts": [
                              {
                                  "name": "MyApp"
                              }
                          ],
                          "configuration": {
                              "BranchName": "master",
                              "RepositoryName": "handson-20161010"
                          },
                          "runOrder": 1
                      }
                  ]
              },
              {
                  "name": "Beta",
                  "actions": [
                      {
                          "inputArtifacts": [
                              {
                                  "name": "MyApp"
                              }
                          ],
                          "name": "handson-app-20161010-deployment-group",
                          "actionTypeId": {
                              "category": "Deploy",
                              "owner": "AWS",
                              "version": "1",
                              "provider": "CodeDeploy"
                          },
                          "outputArtifacts": [],
                          "configuration": {
                              "ApplicationName": "handson-app-20161010",
                              "DeploymentGroupName": "handson-app-20161010-deployment-group"
                          },
                          "runOrder": 1
                      }
                  ]
              }
          ],
          "artifactStore": {
              "type": "S3",
              "location": "codepipeline-us-east-1-123456789012"
          },
          "name": "handson-20161010",
          "version": 1
        }
      }

2. パイプラインの削除

変数の確認
cat << ETX

        CODEP_PIPELINE_NAME: ${CODEP_PIPELINE_NAME}

ETX
コマンド
aws codepipeline delete-pipeline \
        --name ${CODEP_PIPELINE_NAME}
結果(例)
      (戻り値なし)

3. 事後作業

パイプラインが存在しないことを確認します。

コマンド
aws codepipeline get-pipeline \
        --name ${CODEP_PIPELINE_NAME}
結果(例)
      An error occurred (PipelineNotFoundException) when calling the GetPipeline operation: Account 'XXXXXXXXXXXX' does not have a pipeline with name 'handson-20161010'

完了

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