https://infracost.io logo
#contributors
Title
# contributors
r

ripe-answer-8822

08/25/2023, 1:27 PM
Hi Everyone, I am very new to contributing on this codebase, and I have run into an issue I hope I can get some help with? I am working on adding costs for
aws_kinesis_streams
https://github.com/infracost/infracost/issues/2510 I have read and followed the guide on how to add a cost component and that bit works fine until I try to add 2 resources, 1 of
Provisioned
and 1 of
On_Demand
. Given the pricing API results look like this, I am really struggling to work out how to structure my cost component to accept both stream types. In the example it seemed quite trivial since the transfer family resource shared the same naming scheme (on
operation
)
Copy code
service    |  productFamily  | data |            operation             |             usagetype              
---------------+-----------------+------+----------------------------------+------------------------------------
 AmazonKinesis | Kinesis Streams |      | ConsumerHour                     | EnhancedFanoutHour
 AmazonKinesis | Kinesis Streams |      | EnhancedFanoutDataRetrieval      | ReadBytes
 AmazonKinesis | Kinesis Streams |      | LongTermRetentionByteHrs         | LongTermRetention-ByteHrs
 AmazonKinesis | Kinesis Streams |      | LongTermRetentionDataRetrieval   | LongTermRetention-ReadBytes
 AmazonKinesis | Kinesis Streams |      | OnDemandDataIngested             | OnDemand-BilledIncomingBytes
 AmazonKinesis | Kinesis Streams |      | OnDemandDataRetrieval            | OnDemand-BilledOutgoingBytes
 AmazonKinesis | Kinesis Streams |      | OnDemandEFODataRetrieval         | OnDemand-BilledOutgoingEFOBytes
 AmazonKinesis | Kinesis Streams |      | OnDemandExtendedRetentionByteHrs | OnDemand-ExtendedRetention-ByteHrs
 AmazonKinesis | Kinesis Streams |      | OnDemandLongTermRetentionByteHrs | OnDemand-LongTermRetention-ByteHrs
 AmazonKinesis | Kinesis Streams |      | OnDemandStreamHr                 | OnDemand-StreamHour
 AmazonKinesis | Kinesis Streams |      | PutRequest                       | PutRequestPayloadUnits
 AmazonKinesis | Kinesis Streams |      | shardHourStorage                 | Extended-ShardHour
 AmazonKinesis | Kinesis Streams |      | shardHourStorage                 | Storage-ShardHour
Do I just make separate components in this case, or is there a fancy way to get both stream types working in the same one, if so is there any examples in the code where this has been done before? Apologies if its common knowledge to create 2 components for this situation, Problems with this being my first 1!
l

little-author-61621

08/25/2023, 9:37 PM
Hi @ripe-answer-8822. From what I can tell looking at the pricing, I think it makes sense to create separate cost components for each
operation
in the table. Then only add the relevant ones to the resource depending if it’s On-Demand or Provisioned.
From what I can tell here’s the cost component names we can have how I think they map to operations and usagetypes in the table you provided: if
stream_mode == On-Demand
add the following cost components: • On-demand stream -
OnDemandStreamHr
• Data ingested -
OnDemandDataIngested
• Data retrievals -
OnDemandDataRetrieval
• Enhanced fan-out data retrievals -
OnDemandEFODataRetrieval
• Data stored (after 24 hours)
OnDemandExtendedRetentionByteHrs
• Data stored (after 7 days) -
OnDemandLongTermRetentionByteHrs
if
stream_mode == Provisioned
add the following cost components: • Shared hour -
shardHourStorage
,
Storage-ShardHour
• PUT payload units -
PutRequest
• Extended data retention -
shardHourStorage
,
Extended-ShardHour
- I’m not sure about this one? • Long-term data retention -
LongTermRetentionByteHrs
• Long-term data retrieval -
LongTermRetentionDataRetrieval
• Enhanced fan-out data retrievals -
EnhancedFanoutDataRetrieval
• Enhanced fan-out -
ConsumerHour
,
EnhancedFanoutHour
6 Views