awspricing icon indicating copy to clipboard operation
awspricing copied to clipboard

Can I request pricing for GovCloud?

Open ikotlova opened this issue 6 years ago • 4 comments

Hello,

Thank you for very helpful module.

Is it possible to query GovCloud for pricing? I have not been able to succeed so far. The code below: client = boto3.client('ec2', aws_access_key_id, aws_secret_access_key, region_name='us-gov-west-1') ec2info = defaultdict() ec2_offer = awspricing.offer('AmazonEC2') gives this error: botocore.exceptions.NoCredentialsError: Unable to locate credentials

Thanks, Irina

ikotlova avatar May 24 '19 19:05 ikotlova

I still have a problem in GovCloud. My code works in regular AWS but not in AWS GOV. ec2_offer = awspricing.offer('AmazonEC2') fails with the error: botocore.exceptions.ClientError: An error occurred (UnrecognizedClientException) when calling the DescribeServices operation: The security token included in the request is invalid.

AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY are set in the environment; AWS user has admin permission.

Any suggestion?

Thanks, Irina

ikotlova avatar May 30 '19 22:05 ikotlova

I found out that earlier version of awspricing - 1.1.5 does work without throwing the exception. However it does not return pricing either as the EC2 is not in the books. Thus, the result is about the same - i.e. no result. Still throwing an exception seems to be a regression in version 2.0.0 as compared to 1.1.5.

ikotlova avatar Jun 03 '19 17:06 ikotlova

So, awspricing version 1.1.5 + botocore 1.12.107 + boto3 1.9.107 works well. Another caveat for GovCloud is that ec2_offer.ondemand_hourly() call should set region to 'us-west-1' instead of 'us-gov-west-1'.

ikotlova avatar Jun 04 '19 22:06 ikotlova

The earlier version probably works because it doesn't utilize the AWS API itself, but publicly available data files. This isn't a regression as such, since it was an intentional decision to move to the API.

The security token included in the request is invalid. indicates that there is some issue with the credentials. Are you able to make other AWS API calls?

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html would be a good way to debug and the other env variables might provide some hints

garrettheel avatar Aug 20 '19 15:08 garrettheel