Lightsail / Client / get_cost_estimate
get_cost_estimate#
- Lightsail.Client.get_cost_estimate(**kwargs)#
Retrieves information about the cost estimate for a specified resource. A cost estimate will not generate for a resource that has been deleted.
See also: AWS API Documentation
Request Syntax
response = client.get_cost_estimate( resourceName='string', startTime=datetime(2015, 1, 1), endTime=datetime(2015, 1, 1) )
- Parameters:
resourceName (string) –
[REQUIRED]
The resource name.
startTime (datetime) –
[REQUIRED]
The cost estimate start time.
Constraints:
Specified in Coordinated Universal Time (UTC).
Specified in the Unix time format. For example, if you wish to use a start time of October 1, 2018, at 8 PM UTC, specify
1538424000
as the start time.
You can convert a human-friendly time to Unix time format using a converter like Epoch converter.
endTime (datetime) –
[REQUIRED]
The cost estimate end time.
Constraints:
Specified in Coordinated Universal Time (UTC).
Specified in the Unix time format. For example, if you wish to use an end time of October 1, 2018, at 9 PM UTC, specify
1538427600
as the end time.
You can convert a human-friendly time to Unix time format using a converter like Epoch converter.
- Return type:
dict
- Returns:
Response Syntax
{ 'resourcesBudgetEstimate': [ { 'resourceName': 'string', 'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket', 'costEstimates': [ { 'usageType': 'string', 'resultsByTime': [ { 'usageCost': 123.0, 'pricingUnit': 'GB'|'Hrs'|'GB-Mo'|'Bundles'|'Queries', 'unit': 123.0, 'currency': 'USD', 'timePeriod': { 'start': datetime(2015, 1, 1), 'end': datetime(2015, 1, 1) } }, ] }, ], 'startTime': datetime(2015, 1, 1), 'endTime': datetime(2015, 1, 1) }, ] }
Response Structure
(dict) –
resourcesBudgetEstimate (list) –
Returns the estimate’s forecasted cost or usage.
(dict) –
Describes the estimated cost or usage that a budget tracks.
resourceName (string) –
The resource name.
resourceType (string) –
The type of resource the budget will track.
costEstimates (list) –
The cost estimate for the specified budget.
(dict) –
Describes the estimated cost for resources in your Lightsail for Research account.
usageType (string) –
The types of usage that are included in the estimate, such as costs, usage, or data transfer.
resultsByTime (list) –
The cost estimate result that’s associated with a time period.
(dict) –
An estimate that’s associated with a time period.
usageCost (float) –
The amount of cost or usage that’s measured for the cost estimate.
pricingUnit (string) –
The unit of measurement that’s used for the cost estimate.
unit (float) –
The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1 hour.
currency (string) –
The currency of the estimate in USD.
timePeriod (dict) –
The period of time, in days, that an estimate covers. The period has a start date and an end date. The start date must come before the end date.
start (datetime) –
The beginning of the time period. The start date is inclusive. For example, if
start
is2017-01-01
, Lightsail for Research retrieves cost and usage data starting at2017-01-01
up to the end date. The start date must be equal to or no later than the current date to avoid a validation error.end (datetime) –
The end of the time period. The end date is exclusive. For example, if
end
is2017-05-01
, Lightsail for Research retrieves cost and usage data from the start date up to, but not including,2017-05-01
.
startTime (datetime) –
The estimate start time.
endTime (datetime) –
The estimate end time.
Exceptions
Lightsail.Client.exceptions.AccessDeniedException
Lightsail.Client.exceptions.InvalidInputException
Lightsail.Client.exceptions.NotFoundException
Lightsail.Client.exceptions.ServiceException
Lightsail.Client.exceptions.UnauthenticatedException