Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I request pricing for GovCloud? #43

Open
ikotlova opened this issue May 24, 2019 · 4 comments
Open

Can I request pricing for GovCloud? #43

ikotlova opened this issue May 24, 2019 · 4 comments

Comments

@ikotlova
Copy link

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
Copy link
Author

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
Copy link
Author

ikotlova commented Jun 3, 2019

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
Copy link
Author

ikotlova commented Jun 4, 2019

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'.

@garrettheel
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants