Skip to content

aws.lightsail.get_cost_estimate

Example SQL Queries

SELECT * FROM
aws.lightsail.get_cost_estimate
WHERE
"resource_name" = 'VALUE'
AND "start_time" = 'VALUE'
AND "end_time" = 'VALUE';

Description

Retrieves information about the cost estimate for a specified resource. A cost estimate will not generate for a resource that has been deleted.

Table Definition

Column NameColumn Data Type
end_time Required Input Column

The cost estimate end time.

Constraints:

  • Specified in Coordinated Universal Time (UTC).

  • Specified in the Unix time format.

    For example, if you want 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.

TIMESTAMP_S
resource_name Required Input Column

The resource name.

VARCHAR
start_time Required Input Column

The cost estimate start time.

Constraints:

  • Specified in Coordinated Universal Time (UTC).

  • Specified in the Unix time format.

    For example, if you want 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.

TIMESTAMP_S
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
resources_budget_estimate

Returns the estimate's forecasted cost or usage.

STRUCT(
"resource_name" VARCHAR,
"resource_type" VARCHAR,
"cost_estimates" STRUCT(
"usage_type" VARCHAR,
"results_by_time" STRUCT(
"usage_cost" DOUBLE,
"pricing_unit" VARCHAR,
"unit" DOUBLE,
"currency" VARCHAR,
"time_period" STRUCT(
"start" TIMESTAMP_S,
"end" TIMESTAMP_S
)
)[]
)[],
"start_time" TIMESTAMP_S,
"end_time" TIMESTAMP_S
)[]
Show child fields
resources_budget_estimate[]
Show child fields
resources_budget_estimate[].cost_estimates[]
Show child fields
resources_budget_estimate[].cost_estimates[].results_by_time[]
Show child fields
resources_budget_estimate[].cost_estimates[].results_by_time[].currency

The currency of the estimate in USD.

resources_budget_estimate[].cost_estimates[].results_by_time[].pricing_unit

The unit of measurement that's used for the cost estimate.

resources_budget_estimate[].cost_estimates[].results_by_time[].time_period

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.

Show child fields
resources_budget_estimate[].cost_estimates[].results_by_time[].time_period.end

The end of the time period. The end date is exclusive. For example, if end is 2017-05-01, Lightsail for Research retrieves cost and usage data from the start date up to, but not including, 2017-05-01.

resources_budget_estimate[].cost_estimates[].results_by_time[].time_period.start

The beginning of the time period. The start date is inclusive. For example, if start is 2017-01-01, Lightsail for Research retrieves cost and usage data starting at 2017-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.

resources_budget_estimate[].cost_estimates[].results_by_time[].unit

The number of pricing units used to calculate the total number of hours. For example, 1 unit equals 1 hour.

resources_budget_estimate[].cost_estimates[].results_by_time[].usage_cost

The amount of cost or usage that's measured for the cost estimate.

resources_budget_estimate[].cost_estimates[].usage_type

The types of usage that are included in the estimate, such as costs, usage, or data transfer.

resources_budget_estimate[].end_time

The estimate end time.

resources_budget_estimate[].resource_name

The resource name.

resources_budget_estimate[].resource_type

The type of resource the budget will track.

resources_budget_estimate[].start_time

The estimate start time.