AWS CLIには意外と非推奨コマンドが残っているはなし

AWS CLIには意外と非推奨コマンドが残っているはなし

2025.10.01

しばたです。

私は約6年前からAWS CLIのコマンドとPowerShellコマンドレットを比較表示するサイトを作って運用し続けています。

https://dev.classmethod.jp/articles/i-create-the-site-aws-cli-eq-pwsh/

AWS CLIのコマンド一覧を取得する方法

この様なサイトを運営している都合AWS CLIのすべてのコマンドを取得する必要があり、つい先日まではAWS CLIのエラーメッセージに含まれるコマンド一覧を取得する方法を取っていました。

Bash
# 存在しないコマンドを実行してわざとエラーを発生させる
~ $ aws ec2 dummy_error_command

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument operation: Invalid choice, valid choices are:

# ↓ この部分をパースしてコマンド一覧を取得
accept-address-transfer                  | accept-capacity-reservation-billing-ownership
accept-reserved-instances-exchange-quote | accept-transit-gateway-multicast-domain-associations
accept-transit-gateway-peering-attachment | accept-transit-gateway-vpc-attachment   
accept-vpc-endpoint-connections          | accept-vpc-peering-connection
# ・・・後略・・・

実際のコマンドはこんな感じです。

Bash
# 直近の取得方法はこんな感じ (helpとwaitコマンドは除外)
~ $ aws ec2 dummy_error_command 2>&1 | tail -n +10 | awk -F'|' '{printf "%s\n%s\n",$1,$2}' | tr -d ' ' | sed -e /wait/d -e /help/d -e /^$/d | sort
accept-address-transfer
accept-capacity-reservation-billing-ownership
accept-reserved-instances-exchange-quote
accept-transit-gateway-multicast-domain-associations
accept-transit-gateway-peering-attachment
accept-transit-gateway-vpc-attachment
accept-vpc-endpoint-connections
accept-vpc-peering-connection
# ・・・後略・・・

AWS CLIの仕様が変わってしまった

本記事を書くきっかけでもあるのですが、AWS CLIの最新となるVer.2.31.0からアクセシビリティ向上を目的としたメッセージ表示全般の改善が行われ前述の手段が使えなくなってしまいました。

https://github.com/aws/aws-cli/pull/9741

直接的な影響を受けたプルリクエストはこちら。

https://github.com/aws/aws-cli/pull/9457

現在はエラーメッセージからコマンド一覧が除外されています。

Bash
# Ver.2.31.0からエラーメッセージからコマンド一覧が除外されてしまった...
~ $ aws ec2 dummy_error_command

aws: [ERROR]: argument operation: Found invalid choice 'dummy_error_command'

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

このためサイト公開最初に検討した「helpコマンドから取得できるコマンド一覧」を取る方式に切り替えることにしました。

Bash
# helpから取得できるコマンド一覧を解析する方式に変更
~ $ aws ec2 help
EC2()                                                                    EC2()

NAME
       ec2 -

DESCRIPTION
       You  can  access  the  features of Amazon Elastic Compute Cloud (Amazon
       EC2) programmatically. For more information, see the Amazon EC2  Devel-
       oper Guide .

# ↓ ここで取得できるコマンド一覧を使う
AVAILABLE COMMANDS
       o accept-address-transfer

       o accept-capacity-reservation-billing-ownership

       o accept-reserved-instances-exchange-quote

       o accept-transit-gateway-multicast-domain-associations

       o accept-transit-gateway-peering-attachment

       o accept-transit-gateway-vpc-attachment

       o accept-vpc-endpoint-connections
# ・・・後略・・・

AWS CLIには意外と非推奨コマンドが残っている

サイト公開当時helpコマンドを使う方式を採用しなかったのは

各サブコマンドで利用できるオペレーションの一覧もaws [サブコマンド] helpから取得できるのですが、調べた限りだとヘルプドキュメントの更新が追い付いていない様で実際のコマンドより少ない数のコマンドしか取得できないケースが多く出ました。

という理由からだったのですが、改めて全コマンドの差分を取得し調査したところ、

  • ヘルプドキュメントはコマンドの内部情報から自動生成しており「更新が追い付かない」というのは誤りであった
  • 取得できなかったコマンドはほぼ全てが非推奨になったものであった
    • 理由を判定できなかったのはごくわずか
  • 非推奨でもコマンドそのものは残り続けている
    • 残ったコマンドが実行可能か否かはケースバイケース

という状況であることが分かりました。

非推奨コマンド例

具体的にどの様なコマンドが非推奨になっているのか例示していきます。

1. AWS AppConfig

GetConfigurationAPIの非推奨化によりaws appconfig get-configurationコマンドも非推奨に。

(Deprecated) Retrieves the latest deployed configuration.

2. Amazon Chime SDK (Voice)

Alexa Skillサポート終了の影響を受け以下のコマンドが非推奨化。

  • aws chime-sdk-voice get-sip-media-application-alexa-skill-configuration
  • aws chime-sdk-voice put-sip-media-application-alexa-skill-configuration

3. AWS CloudHSM (Classic)

新バージョンであるaws cloudhsmv2コマンドの登場によりaws cloudhsmコマンド全体が非推奨扱いに。

4. Amazon Comprehend Medical

DetectEntitiesAPIの非推奨化によりaws comprehendmedical detect-entitiesコマンドも非推奨に。

5. AWS Data Pipeline

AWS Data Pipelineは既に新規利用停止状態ですが、そのうちaws datapipeline create-default-rolesコマンドが非推奨となっています。

NOTE: Support for this command has been deprecated and may fail to create these roles if they do not already exist. For more information on managing these policies manually see the following documentation:

6. AWS CodeDeploy

各種APIの非推奨化を受け以下のコマンドが非推奨扱いに。

  • aws deploy batch-get-deployment-instances
  • aws deploy get-deployment-instance
  • aws deploy list-deployment-instances

これらのコマンドは動作するものの、次のコマンドの利用が推奨されています。

  • aws deploy batch-get-deployment-targets
  • aws deploy get-deployment-target
  • aws deploy list-deployment-targets

7. AWS Direct Connect

各種APIの非推奨化を受け以下のコマンドが非推奨扱いに。

  • aws directconnect allocate-connection-on-interconnect
  • aws directconnect describe-connection-loa
  • aws directconnect describe-connections-on-interconnect
  • aws directconnect describe-interconnect-loa

8. AWS Application Discovery Service

各種APIの非推奨化を受け以下のコマンドが非推奨扱いに。

  • aws discovery describe-export-configurations
  • aws discovery export-configurations

9. AWS Elastic Disaster Recovery

RetryDataReplicationAPIの非推奨化によりaws drs retry-data-replicationコマンドも非推奨に。

WARNING: RetryDataReplication is deprecated.

10. Amazon EFS

各種APIの非推奨化を受け以下のコマンドが非推奨扱いに。

  • aws efs create-tags
  • aws efs delete-tags
  • aws efs describe-tags

タグ操作にはそれぞれ次のコマンドを使います。

  • aws efs tag-resource
  • aws efs untag-resource
  • aws efs list-tags-for-resource

11. Amazon Elastic Transcoder

aws elastictranscoder test-roleコマンドが非推奨扱いになっていますが理由は分かりませんでした...

なおAmazon Elastic Transcoderは2025年11月でサービス終了予定です。

12. Amazon FinSpace

Amazon FinSpace Dataset Browserのサービス終了を受け以下のコマンドが非推奨扱いに。

  • aws finspace create-environment
  • aws finspace delete-environment
  • aws finspace get-environment
  • aws finspace list-environments
  • aws finspace update-environment
  • aws finspace-dataコマンド全般

13. Amazon GuardDuty

各種APIの非推奨化(というか改名)を受け以下のコマンドが非推奨扱いに。

  • aws guardduty accept-invitation
  • aws guardduty disassociate-from-master-account
  • aws guardduty get-master-account

それぞれ次のコマンドに切り替わっています。

  • aws guardduty accept-administrator-invitation
  • aws guardduty disassociate-from-administrator-account
  • aws guardduty get-administrator-account

14. AWS IoT

各種APIの非推奨化を受け以下のコマンドが非推奨扱いに。

  • aws iot attach-principal-policy
  • aws iot detach-principal-policy
  • aws iot list-policy-principals
  • aws iot list-principal-policies

15. AWS IoT Things Graph

サービス終了によりaws iotthingsgraphコマンド全体が非推奨扱いに。

16. AWS IoT Wireless

各種APIの非推奨化を受け以下のコマンドが非推奨扱いに。

  • aws iotwireless get-position
  • aws iotwireless get-position-configuration
  • aws iotwireless list-position-configurations
  • aws iotwireless put-position-configuration
  • aws iotwireless update-position

17. AWS Lambda

InvokeAsyncAPIの非推奨化によりaws lambda invoke-asyncコマンドも非推奨に。

This action has been deprecated.

18. CloudWatch Logs

各種APIの非推奨化を受け以下のコマンドが非推奨扱いに。

  • aws logs list-tags-log-group
  • aws logs tag-log-group
  • aws logs untag-log-group

タグ操作にはそれぞれ次のコマンドを使います。

  • aws logs list-tags-for-resource
  • aws logs tag-resource
  • aws logs untag-resource

19. AWS Marketplace Commerce Analytics

APIの非推奨化によりaws marketplacecommerceanalytics start-support-data-exportコマンドも非推奨に。

This target has been deprecated.

20. AWS Elemental MediaConvert

以下のコマンドが非推奨となっていますが理由はわかりませんでした...

  • aws mediaconvert describe-endpoints

追記 : botocoreのAPI定義を確認したところ

DescribeEndpoints and account specific endpoints are no longer required. We recommend that you send your requests directly to the regional endpoint instead.

とのことでアカウント固有のエンドポイントを使用しなくなったことが理由でした。

ちなみにコマンド自体は今も使えました。

Bash
~ $ aws mediaconvert describe-endpoints
{
    "Endpoints": [
        {
            "Url": "https://mediaconvert.ap-northeast-1.amazonaws.com"
        }
    ]
}

21. AWS Elemental MediaPackage

APIの非推奨化によりaws mediapackage rotate-channel-credentialsコマンドも非推奨に。

WARNING - This API is deprecated.

22. Amazon MWAA

APIの非推奨化によりaws mwaa publish-metricsコマンドも非推奨に。
ただ、このコマンド自体元々内部用だった模様です。

Internal only . Publishes environment health metrics to Amazon CloudWatch.

23. Amazon Q in Connect

各種APIの廃止により以下のコマンドが非推奨扱いに。

  • aws qconnect get-recommendations
  • aws qconnect query-assistant

24. Amazon RDS (Data API)

ExecuteSqlAPIのサポート対象が古く既に非推奨になっているためaws rds-data execute-sqlコマンドも非推奨扱いになっています。

This operation isn't supported for Aurora Serverless v2 and provisioned DB clusters. For Aurora Serverless v1 DB clusters, the operation is deprecated. Use the BatchExecuteStatement or ExecuteStatement operation.

aws rds-data execute-statementおよびaws rds-data batch-execute-statementコマンドが代替となります。

25. AWS RoboMaker

新規利用停止を受けてなのかデプロイ系コマンド全般が非推奨扱いになっていました。
なお、2025年9月10日でサービス終了済みなので今後はaws robomakerコマンド全体が非推奨扱いになると思われます。

26. Amazon S3 (API)

APIの刷新により以下のコマンドが非推奨扱いになっています。

  • aws s3api get-bucket-lifecycle
  • aws s3api get-bucket-notification
  • aws s3api put-bucket-lifecycle
  • aws s3api put-bucket-notification

現在は以下のコマンドを使います。

  • aws s3api get-bucket-lifecycle-configuration
  • aws s3api get-bucket-notification-configuration
  • aws s3api put-bucket-lifecycle-configuration
  • aws s3api put-bucket-notification-configuration

27. AWS Security Hub

各種APIの非推奨化(というか改名)を受け以下のコマンドが非推奨扱いに。

  • aws securityhub accept-invitation
  • aws securityhub disassociate-from-master-account
  • aws securityhub get-master-account

それぞれ次のコマンドに切り替わっています。

  • aws securityhub accept-administrator-invitation
  • aws securityhub disassociate-from-administrator-account
  • aws securityhub get-administrator-account

28. AWS Shield

DeleteSubscriptionAPIの非推奨化によりaws shield delete-subscriptionコマンドも非推奨に。

This action has been deprecated.

29. Amazon Connect Wisdom

以下のコマンドが非推奨扱いになっています。

  • aws wisdom get-recommendations
  • aws wisdom query-assistant

Connect Wisdomのドキュメントが消失済みのため理由は不明です。
追記 : botocoreのAPI定義を確認したところAPIの提供終了が原因だった模様。

GetRecommendations API will be discontinued starting June 1, 2024. To receive generative responses after March 1, 2024 you will need to create a new Assistant in the Connect console and integrate the Amazon Q in Connect JavaScript library (amazon-q-connectjs) into your applications.

および

QueryAssistant API will be discontinued starting June 1, 2024. To receive generative responses after March 1, 2024 you will need to create a new Assistant in the Connect console and integrate the Amazon Q in Connect JavaScript library (amazon-q-connectjs) into your applications.

最後に

以上となります。

予想以上に非推奨扱いになっているコマンドが多かったため記事にしてみました。
「だからどうした?」という内容ではありますが、もし非推奨のコマンドを使い続けている場合は適宜新しいコマンドに切り替えていくと良いでしょう。

この記事をシェアする

facebookのロゴhatenaのロゴtwitterのロゴ

© Classmethod, Inc. All rights reserved.