


client ( service_name = 'ec2', region_name = region ) endpoint_file = resource_filename ( 'botocore', 'data/endpoints.json' ) with open ( endpoint_file, 'r' ) as f : endpoint_data = json. To stay within the Free Tier, use only EC2 Micro instances. This includes 750 hours of Linux and Windows t2.micro instances (t3.micro for the regions in which t2.micro is unavailable), each month for one year. byol: Determines whether the target EC2 Instance price is for Bring your own license (default: False)ĭef current_price ( instance_type, region = 'eu-west-1', os = 'Linux', preinstalled_software = 'NA', tenancy = 'Shared', byol = False ): ec2_client = boto3. Free tier As part of the AWS Free Tier, you can get started with Amazon EC2 for free.tenancy: For specifying the tenancy of the target EC2 Instance: Shared (default, Shared Hardware), Dedicated (Dedicated Instance or single-tenant hardware) or Host (an isolated server with configurations under your control).preinstalled_software: Only for preinstalled SQL Server: NA (default, without preinstalled software), SQL Ent, SQL Std or SQL Web.os: Operating System of the target Instance: Linux (default), Windows, Red Hat Enterprise Linux with HA, RHEL or SUSE*.region: AWS region to use (default: eu-west-1).instance_type: Instance type that we want to get it's pricing.The following function accepts the following arguments: The following python code has the us-east-1 endpoint hardcoded on it. This API, at the time of this writing, it only provides the following endpoints To do so we are going to use the Amazon Web Services Price List Service API. We can use python with Boto3 to retrieve the current On Demand price for a given instance type.
#On demand ec2 pricing how to
AWS: How to get the On Demand price of a EC2 instance using Python and Boto3
