Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 是否有一种自动化的方法来查看AWS帐户是否有特优支持订阅_Amazon Web Services_Aws Sdk_Boto3_Aws Cli - Fatal编程技术网

Amazon web services 是否有一种自动化的方法来查看AWS帐户是否有特优支持订阅

Amazon web services 是否有一种自动化的方法来查看AWS帐户是否有特优支持订阅,amazon-web-services,aws-sdk,boto3,aws-cli,Amazon Web Services,Aws Sdk,Boto3,Aws Cli,我有多个AWS帐户,需要一种自动方式(CLI或SDK)来确定该帐户是否具有高级支持订阅 本质上,我想知道是否可以使用Trusted Advisor中的cloudwatch事件在特定帐户上触发Lambda函数 在cli上,我可以运行: aws support <command> aws支持 如果未启用高级支持,则会出现错误,但是否有更好的方法来解决此问题?我没有尝试过此方法,但您可以使用Boto3SDK(Python)。发件人: 以下是可用的方法: 描述案例() 描述_通信()

我有多个AWS帐户,需要一种自动方式(CLI或SDK)来确定该帐户是否具有高级支持订阅

本质上,我想知道是否可以使用Trusted Advisor中的cloudwatch事件在特定帐户上触发Lambda函数

在cli上,我可以运行:

aws support <command>
aws支持

如果未启用高级支持,则会出现错误,但是否有更好的方法来解决此问题?

我没有尝试过此方法,但您可以使用
Boto3
SDK(Python)。发件人:

以下是可用的方法:

  • 描述案例()
  • 描述_通信()
  • 描述_服务()
  • 描述_严重性_级别()
  • 描述受信任的顾问检查刷新状态()
  • 描述受信任的顾问检查结果()
  • 描述受信任的顾问检查总结()
  • 描述受信任的顾问检查()
  • 刷新\u受信任的\u顾问\u检查()
  • 解决案例()
我只是尝试了一些API。由于缺乏高级支持,所有这些都失败了。所以,你运气不好

>>> client.describe_services()
botocore.exceptions.ClientError: An error occurred (SubscriptionRequiredException) when calling the DescribeServices operation: AWS Premium Support Subscription is required to use this service.

>>> client.describe_trusted_advisor_checks(language='en')
botocore.exceptions.ClientError: An error occurred (SubscriptionRequiredException) when calling the DescribeTrustedAdvisorChecks operation: AWS Premium Support Subscription is required to use this service.

我可以以与cli相同的方式使用它,但是当针对没有高级支持的帐户运行时,它将引发botocore异常。我可以处理代码中的异常,它会告诉我是否启用了它,但我想知道是否有更好的方法来确定是否需要高级支持enabled@tkwargs我刚刚更新了我的答案。看来没有更好的方法来检查了。
>>> client.describe_services()
botocore.exceptions.ClientError: An error occurred (SubscriptionRequiredException) when calling the DescribeServices operation: AWS Premium Support Subscription is required to use this service.

>>> client.describe_trusted_advisor_checks(language='en')
botocore.exceptions.ClientError: An error occurred (SubscriptionRequiredException) when calling the DescribeTrustedAdvisorChecks operation: AWS Premium Support Subscription is required to use this service.