awspricing icon indicating copy to clipboard operation
awspricing copied to clipboard

new attribute capacitystatus causes collisions.

Open andrewmcgilvray opened this issue 7 years ago • 0 comments

Since the release of : https://aws.amazon.com/about-aws/whats-new/2018/10/Amazon-EC2-now-offers-On-Demand-Capacity-Reservations/

For the ec2 products there is now a capacitystatus attribute that can be either UnusedCapacityReservation, AllocatedCapacityReservation or Used.

This is causing collisions and any products are being excluded from the pricing results. Here is an example of the three products that would collide on the hash "t2.medium|Linux|Shared|No License required|NA|US West (Oregon)"

{u'attributes': {u'capacitystatus': u'UnusedCapacityReservation',
                 u'clockSpeed': u'Up to 3.3 GHz',
                 u'currentGeneration': u'Yes',
                 u'ecu': u'Variable',
                 u'instanceFamily': u'General purpose',
                 u'instanceType': u't2.medium',
                 u'instancesku': u'2ES9C4RF3WGQZAQN',
                 u'licenseModel': u'No License required',
                 u'location': u'US West (Oregon)',
                 u'locationType': u'AWS Region',
                 u'memory': u'4 GiB',
                 u'networkPerformance': u'Low to Moderate',
                 u'normalizationSizeFactor': u'2',
                 u'operatingSystem': u'Linux',
                 u'operation': u'RunInstances',
                 u'physicalProcessor': u'Intel Xeon Family',
                 u'preInstalledSw': u'NA',
                 u'processorArchitecture': u'32-bit or 64-bit',
                 u'processorFeatures': u'Intel AVX; Intel Turbo',
                 u'servicecode': u'AmazonEC2',
                 u'servicename': u'Amazon Elastic Compute Cloud',
                 u'storage': u'EBS only',
                 u'tenancy': u'Shared',
                 u'usagetype': u'USW2-UnusedBox:t2.medium',
                 u'vcpu': u'2'},
 u'productFamily': u'Compute Instance',
 u'sku': u'EUSSFEHB68A6B6DM'}
{u'attributes': {u'capacitystatus': u'Used',
                 u'clockSpeed': u'Up to 3.3 GHz',
                 u'currentGeneration': u'Yes',
                 u'ecu': u'Variable',
                 u'instanceFamily': u'General purpose',
                 u'instanceType': u't2.medium',
                 u'licenseModel': u'No License required',
                 u'location': u'US West (Oregon)',
                 u'locationType': u'AWS Region',
                 u'memory': u'4 GiB',
                 u'networkPerformance': u'Low to Moderate',
                 u'normalizationSizeFactor': u'2',
                 u'operatingSystem': u'Linux',
                 u'operation': u'RunInstances',
                 u'physicalProcessor': u'Intel Xeon Family',
                 u'preInstalledSw': u'NA',
                 u'processorArchitecture': u'32-bit or 64-bit',
                 u'processorFeatures': u'Intel AVX; Intel Turbo',
                 u'servicecode': u'AmazonEC2',
                 u'servicename': u'Amazon Elastic Compute Cloud',
                 u'storage': u'EBS only',
                 u'tenancy': u'Shared',
                 u'usagetype': u'USW2-BoxUsage:t2.medium',
                 u'vcpu': u'2'},
 u'productFamily': u'Compute Instance',
 u'sku': u'2ES9C4RF3WGQZAQN'}
{u'attributes': {u'capacitystatus': u'AllocatedCapacityReservation',
                 u'clockSpeed': u'Up to 3.3 GHz',
                 u'currentGeneration': u'Yes',
                 u'ecu': u'Variable',
                 u'instanceFamily': u'General purpose',
                 u'instanceType': u't2.medium',
                 u'instancesku': u'2ES9C4RF3WGQZAQN',
                 u'licenseModel': u'No License required',
                 u'location': u'US West (Oregon)',
                 u'locationType': u'AWS Region',
                 u'memory': u'4 GiB',
                 u'networkPerformance': u'Low to Moderate',
                 u'normalizationSizeFactor': u'2',
                 u'operatingSystem': u'Linux',
                 u'operation': u'RunInstances',
                 u'physicalProcessor': u'Intel Xeon Family',
                 u'preInstalledSw': u'NA',
                 u'processorArchitecture': u'32-bit or 64-bit',
                 u'processorFeatures': u'Intel AVX; Intel Turbo',
                 u'servicecode': u'AmazonEC2',
                 u'servicename': u'Amazon Elastic Compute Cloud',
                 u'storage': u'EBS only',
                 u'tenancy': u'Shared',
                 u'usagetype': u'USW2-Reservation:t2.medium',
                 u'vcpu': u'2'},
 u'productFamily': u'Compute Instance',
 u'sku': u'J4QDBG6HHGV8ND4P'}

For the moment I am adding an additional filter to "def _generate_reverse_sku_mapping":

                if product['attributes']['capacitystatus'] != 'Used':
                    continue

to get around the problem.

andrewmcgilvray avatar Nov 05 '18 04:11 andrewmcgilvray