Пример #1
0
// It finds Spot price history by zone and instance
// Other input parameters can be configured by uncommenting the appropriate portion of the code
func (p *Parameters) DescribeSpotPriceHistory(svc *ec2.EC2) (string, error) {
	paramsForReq := &ec2.DescribeSpotPriceHistoryInput{
		AvailabilityZone: aws.String(p.Zone),
		//		DryRun:           aws.Bool(true),
		//		EndTime:          aws.Time(time.Now()),
		//		Filters: []*ec2.Filter{
		//			{ // Required
		//				Name: aws.String("String"),
		//				Values: []*string{
		//					aws.String("String"), // Required
		//					// More values...
		//				},
		//			},
		//			// More values...
		//		},
		InstanceTypes: []*string{
			aws.String(p.Instance), // Required
			// More values...
		},
		//		MaxResults: aws.Int64(1),
		//		NextToken:  aws.String("String"),
		//		ProductDescriptions: []*string{
		//			aws.String("String"), // Required
		//			// More values...
		//		},
		//		StartTime: aws.Time(time.Now()),
	}
	resp, err := svc.DescribeSpotPriceHistory(paramsForReq)

	if err != nil {
		return "", err
	}
	return fmt.Sprintln(resp), nil
}