[英]How to get quotas of AWS via boto3?
我正在研究 boto3 - 適用於 AWS 的 SDK python。
我從 ec2 的簡單服務配額開始,但總是以以下錯誤結束,
import boto3
quota_client = boto3.client('service-quotas')
response = quota_client.get_service_quota(
ServiceCode='ec2'
)
錯誤:
botocore.exceptions.UnknownServiceError: Unknown service: 'service-
quotas'. Valid service names are: acm, acm-pca, alexaforbusiness,
amplify, apigateway, apigatewaymanagementapi, apigatewayv2,
application-autoscaling, appmesh, appstream, appsync, athena,
autoscaling, autoscaling-plans, backup, batch, budgets, ce, chime,
cloud9, clouddirectory, cloudformation, cloudfront, cloudhsm,
cloudhsmv2, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch,
codebuild, codecommit, codedeploy, codepipeline, codestar, cognito-
identity, cognito-idp, cognito-sync, comprehend, comprehendmedical,
config, connect, cur, datapipeline, datasync, dax, devicefarm,
directconnect, discovery, dlm, dms, docdb, ds, dynamodb,
dynamodbstreams, ec2, ecr, ecs, efs, eks, elasticache,
elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events,
firehose, fms, fsx, gamelift, glacier, globalaccelerator, glue,
greengrass, groundstation, guardduty, health, iam, importexport,
inspector, iot, iot-data, iot-jobs-data, iot1click-devices, iot1click-
projects, iotanalytics, iotevents, iotevents-data, iotthingsgraph,
kafka, kinesis, kinesis-video-archived-media, kinesis-video-media,
kinesisanalytics, kinesisanalyticsv2, kinesisvideo, kms, lambda, lex-
models, lex-runtime, license-manager, lightsail, logs,
machinelearning, macie, managedblockchain, marketplace-entitlement,
marketplacecommerceanalytics, mediaconnect, mediaconvert, medialive,
mediapackage, mediapackage-vod, mediastore, mediastore-data,
mediatailor, meteringmarketplace, mgh, mobile, mq, mturk, neptune,
opsworks, opsworkscm, organizations, personalize, personalize-events,
personalize-runtime, pi, pinpoint, pinpoint-email, pinpoint-sms-voice, polly, pricing,
quicksight, ram, rds, rds-data, redshift, rekognition, resource-groups,
resourcegroupstaggingapi, robomaker, route53, route53domains,
route53resolver, s3, s3control, sagemaker, sagemaker-runtime, sdb,
secretsmanager, securityhub, serverlessrepo, servicecatalog,
servicediscovery, ses, shield, signer, sms, sms-voice, snowball, sns, sqs,
ssm, stepfunctions, storagegateway, sts, support, swf, textract,
transcribe, transfer, translate, waf, waf-regional, workdocs, worklink,
workmail, workspaces, xray
文檔頁面顯示 boto3 支持服務配額,但看起來不是,或者我在這里做錯了什么?
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/service-quotas.html
我可以用我當前的boto3-1.9.174 botocore-1.12.174
安裝重現這個問題。
然后我做了:
pip install boto3 --upgrade
它將我移至boto3-1.9.208 botocore-1.12.208
版本,並且工作正常。
我嘗試使用 Python 虛擬環境來隔離庫以便於更新。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.