LoginSignup
0
0

More than 5 years have passed since last update.

[JAWS-UG CLI] CodeCommit #1 リポジトリの削除

Posted at

AWS CLIを利用して、CodeCommit上のリポジトリを削除してみます。

前提条件

CodeCommitへの権限

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

AWS CLIのバージョン

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

  • AWS CLI 1.9.20
コマンド
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-01-17時点でCodeCommitはus-east-1のみ提供されています。

0.2. 変数の確認

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

コマンド
aws configure list
結果(例)
            Name                    Value             Type    Location
            ----                    -----             ----    --------
         profile         administrator-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. 事前作業

コマンド
aws codecommit get-repository \
        --repository-name ${CODEC_REPOSITORY_NAME}
結果(例)
      {
        "repositoryMetadata": {
          "repositoryName": "handson-20161010",
          "cloneUrlSsh": "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/handson-20161010",
          "lastModifiedDate": 1234567890.123,
          "repositoryDescription": "hands on repository on 20161010",
          "cloneUrlHttp": "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/handson-20161010",
          "creationDate": 1234567890.123,
          "repositoryId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "Arn": "arn:aws:codecommit:us-east-1:XXXXXXXXXXXX:handson-20161010",
          "accountId": "XXXXXXXXXXXX"
        }
      }

2. リポジトリの削除

変数の確認
cat << ETX

        CODEC_REPOSITORY_NAME: ${CODEC_REPOSITORY_NAME}

ETX
コマンド
aws codecommit delete-repository \
        --repository-name ${CODEC_REPOSITORY_NAME}
結果(例)
      {
        "repositoryId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      }

3. 事後作業

コマンド
aws codecommit get-repository \
        --repository-name ${CODEC_REPOSITORY_NAME}
結果(例)
      An error occurred (RepositoryDoesNotExistException) when calling the GetRepository operation: handson-20161010does not exist

完了

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