boto / boto3

AWS SDK for Python
https://aws.amazon.com/sdk-for-python/
Apache License 2.0
8.99k stars 1.86k forks source link

AWS CostExplorer not being recognized / UnknownServiceError #1362

Closed fantest5566 closed 6 years ago

fantest5566 commented 6 years ago

Hi , I am trying to use AWS CostExplorer from boto3 but it is not being recognized. I have upgraded to the newest version of boto3.

boto3.version '1.4.7'

aws --version aws-cli/1.11.162 Python/3.6.3 Darwin/16.7.0 botocore/1.7.48

import boto3
client = boto3.client('ce')

Error message:

  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/botocore/loaders.py", line 378, in load_service_model
    known_service_names=', '.join(sorted(known_services)))
botocore.exceptions.UnknownServiceError: Unknown service: 'ce'. Valid service names are: acm, apigateway, application-autoscaling, appstream, athena, autoscaling, batch, budgets, clouddirectory, cloudformation, cloudfront, cloudhsm, cloudhsmv2, cloudsearch, cloudsearchdomain, cloudtrail, cloudwatch, codebuild, codecommit, codedeploy, codepipeline, codestar, cognito-identity, cognito-idp, cognito-sync, config, cur, datapipeline, dax, devicefarm, directconnect, discovery, dms, ds, dynamodb, dynamodbstreams, ec2, ecr, ecs, efs, elasticache, elasticbeanstalk, elastictranscoder, elb, elbv2, emr, es, events, firehose, gamelift, glacier, glue, greengrass, health, iam, importexport, inspector, iot, iot-data, kinesis, kinesisanalytics, kms, lambda, lex-models, lex-runtime, lightsail, logs, machinelearning, marketplace-entitlement, marketplacecommerceanalytics, meteringmarketplace, mgh, mobile, mturk, opsworks, opsworkscm, organizations, pinpoint, polly, rds, redshift, rekognition, resourcegroupstaggingapi, route53, route53domains, s3, sdb, servicecatalog, ses, shield, sms, snowball, sns, sqs, ssm, stepfunctions, storagegateway, sts, support, swf, waf, waf-regional, workdocs, workspaces, xray
joguSD commented 6 years ago

I'm going to assume that you have a mismatched version of what the CLI is using vs what is available to your Python. It looks like you're using system Python which has an older version of botocore. How did you install the CLI? Have you tried updating botocore directly through pip?

fantest5566 commented 6 years ago

Hi, It works after I reinstall botocore directly . thank you.

  python3 -m pip uninstall botocore
  python3 -m pip install botocore