public InstanceSpecification(string instanceAmi, InstanceSize instanceSize, string availabilityZone = null, double? spotBidPrice = null)
 {
     this.Ami = instanceAmi;
     this.Size = instanceSize;
     this.AvailabilityZone = availabilityZone;
     this.SpotBidPrice = spotBidPrice;
 }
Exemplo n.º 2
0
        public Ec2Instance CreateInstance(string name, string instanceAmi, InstanceSize instanceSize, string availabilityZone = null, double?spotBidPrice = null)
        {
            var instance = new Ec2Instance(this.client, this.config, name, new InstanceSpecification(instanceAmi, instanceSize, availabilityZone, spotBidPrice));

            instance.Logger = this.Logger;
            return(instance);
        }
 public InstanceSpecification(string instanceAmi, InstanceSize instanceSize, string availabilityZone = null, double?spotBidPrice = null)
 {
     this.Ami              = instanceAmi;
     this.Size             = instanceSize;
     this.AvailabilityZone = availabilityZone;
     this.SpotBidPrice     = spotBidPrice;
 }
Exemplo n.º 4
0
        //public Ec2Instance ReconnectInstance(string instanceId)
        //{
        //    var instance = new Ec2Instance(this.client, instanceId);
        //    instance.Logger = this.Logger;
        //    return instance;
        //}

        public async Task <double> GetCurrentSpotPriceAsync(InstanceSize instanceSize)
        {
            var result = await this.client.DescribeSpotPriceHistoryAsync(new DescribeSpotPriceHistoryRequest()
            {
                InstanceTypes = new List <string>()
                {
                    instanceSize.Key
                },
                ProductDescriptions = new List <string>()
                {
                    "Linux/UNIX"
                },
                MaxResults = 1,
            });

            return(double.Parse(result.SpotPriceHistory[0].Price));
        }
Exemplo n.º 5
0
 public Ec2Instance CreateInstance(string name, string instanceAmi, InstanceSize instanceSize, string availabilityZone = null, double? spotBidPrice = null)
 {
     var instance = new Ec2Instance(this.client, this.config, name, new InstanceSpecification(instanceAmi, instanceSize, availabilityZone, spotBidPrice));
     instance.Logger = this.Logger;
     return instance;
 }
Exemplo n.º 6
0
        //public Ec2Instance ReconnectInstance(string instanceId)
        //{
        //    var instance = new Ec2Instance(this.client, instanceId);
        //    instance.Logger = this.Logger;
        //    return instance;
        //}

        public async Task<double> GetCurrentSpotPriceAsync(InstanceSize instanceSize)
        {
            var result = await this.client.DescribeSpotPriceHistoryAsync(new DescribeSpotPriceHistoryRequest()
            {
                InstanceTypes = new List<string>() { instanceSize.Key },
                ProductDescriptions = new List<string>() { "Linux/UNIX" },
                MaxResults = 1,
            });

            return double.Parse(result.SpotPriceHistory[0].Price);
        }