2 Risposte
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
0
As mentioned in the answer by @Peter_G, you can use the Pricing API which is also available in the .NET SDK.
Make sure you configure the client to use a correct endpoint for calling the service.
As mentioned in the documentation:
The AWS Price List Query API provides the following two endpoints:
So you have to ensure your client is configured for either us-east-1 or ap-south-1 as region. Here is an example:
using Amazon.Pricing; using Amazon.Pricing.Model; using Amazon.Runtime.CredentialManagement; var credChain = new CredentialProfileStoreChain(); credChain.TryGetAWSCredentials("your_profile_name", out var awsCredentials); var client = new AmazonPricingClient(awsCredentials, Amazon.RegionEndpoint.USEast1); var response = await client.GetProductsAsync(new GetProductsRequest { ServiceCode = "AmazonEC2" }); response.PriceList.ForEach(s => Console.WriteLine(s));
con risposta 2 anni fa
Contenuto pertinente
- AWS UFFICIALEAggiornata 3 anni fa
Thank you for the response Peter. I tried looking into it with the following code, but I am getting a timeout when calling the GetProducts method. Added filters to make the request smaller as I thought the retrieval of information was too large and might be causing it to time out, but didn't seem to help.
What is the cause of this?
Not exactly sure whats wrong with code (I am not .NET dev). Using AWS cli I got a response in < 2 secs using the same filters as you used
Could you please send me the cli command you used?