autoscaling

package
v1.55.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 1,765

Documentation

Overview

Package autoscaling provides the client and types for making API requests to Auto Scaling.

Amazon EC2 Auto Scaling is designed to automatically launch and terminate EC2 instances based on user-defined scaling policies, scheduled actions, and health checks.

For more information, see the Amazon EC2 Auto Scaling User Guide (https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html) and the Amazon EC2 Auto Scaling API Reference (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/Welcome.html).

See https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01 for more information on this service.

See autoscaling package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/autoscaling/

Using the Client

To contact Auto Scaling with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.

See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/

See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the Auto Scaling client AutoScaling for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/autoscaling/#New

Index

Examples

Constants

View Source
const (
	// AcceleratorManufacturerNvidia is a AcceleratorManufacturer enum value
	AcceleratorManufacturerNvidia = "nvidia"

	// AcceleratorManufacturerAmd is a AcceleratorManufacturer enum value
	AcceleratorManufacturerAmd = "amd"

	// AcceleratorManufacturerAmazonWebServices is a AcceleratorManufacturer enum value
	AcceleratorManufacturerAmazonWebServices = "amazon-web-services"

	// AcceleratorManufacturerXilinx is a AcceleratorManufacturer enum value
	AcceleratorManufacturerXilinx = "xilinx"
)
View Source
const (
	// AcceleratorNameA100 is a AcceleratorName enum value
	AcceleratorNameA100 = "a100"

	// AcceleratorNameV100 is a AcceleratorName enum value
	AcceleratorNameV100 = "v100"

	// AcceleratorNameK80 is a AcceleratorName enum value
	AcceleratorNameK80 = "k80"

	// AcceleratorNameT4 is a AcceleratorName enum value
	AcceleratorNameT4 = "t4"

	// AcceleratorNameM60 is a AcceleratorName enum value
	AcceleratorNameM60 = "m60"

	// AcceleratorNameRadeonProV520 is a AcceleratorName enum value
	AcceleratorNameRadeonProV520 = "radeon-pro-v520"

	// AcceleratorNameVu9p is a AcceleratorName enum value
	AcceleratorNameVu9p = "vu9p"
)
View Source
const (
	// AcceleratorTypeGpu is a AcceleratorType enum value
	AcceleratorTypeGpu = "gpu"

	// AcceleratorTypeFpga is a AcceleratorType enum value
	AcceleratorTypeFpga = "fpga"

	// AcceleratorTypeInference is a AcceleratorType enum value
	AcceleratorTypeInference = "inference"
)
View Source
const (
	// BareMetalIncluded is a BareMetal enum value
	BareMetalIncluded = "included"

	// BareMetalExcluded is a BareMetal enum value
	BareMetalExcluded = "excluded"

	// BareMetalRequired is a BareMetal enum value
	BareMetalRequired = "required"
)
View Source
const (
	// BurstablePerformanceIncluded is a BurstablePerformance enum value
	BurstablePerformanceIncluded = "included"

	// BurstablePerformanceExcluded is a BurstablePerformance enum value
	BurstablePerformanceExcluded = "excluded"

	// BurstablePerformanceRequired is a BurstablePerformance enum value
	BurstablePerformanceRequired = "required"
)
View Source
const (
	// CpuManufacturerIntel is a CpuManufacturer enum value
	CpuManufacturerIntel = "intel"

	// CpuManufacturerAmd is a CpuManufacturer enum value
	CpuManufacturerAmd = "amd"

	// CpuManufacturerAmazonWebServices is a CpuManufacturer enum value
	CpuManufacturerAmazonWebServices = "amazon-web-services"
)
View Source
const (
	// InstanceGenerationCurrent is a InstanceGeneration enum value
	InstanceGenerationCurrent = "current"

	// InstanceGenerationPrevious is a InstanceGeneration enum value
	InstanceGenerationPrevious = "previous"
)
View Source
const (
	// InstanceMetadataEndpointStateDisabled is a InstanceMetadataEndpointState enum value
	InstanceMetadataEndpointStateDisabled = "disabled"

	// InstanceMetadataEndpointStateEnabled is a InstanceMetadataEndpointState enum value
	InstanceMetadataEndpointStateEnabled = "enabled"
)
View Source
const (
	// InstanceMetadataHttpTokensStateOptional is a InstanceMetadataHttpTokensState enum value
	InstanceMetadataHttpTokensStateOptional = "optional"

	// InstanceMetadataHttpTokensStateRequired is a InstanceMetadataHttpTokensState enum value
	InstanceMetadataHttpTokensStateRequired = "required"
)
View Source
const (
	// InstanceRefreshStatusPending is a InstanceRefreshStatus enum value
	InstanceRefreshStatusPending = "Pending"

	// InstanceRefreshStatusInProgress is a InstanceRefreshStatus enum value
	InstanceRefreshStatusInProgress = "InProgress"

	// InstanceRefreshStatusSuccessful is a InstanceRefreshStatus enum value
	InstanceRefreshStatusSuccessful = "Successful"

	// InstanceRefreshStatusFailed is a InstanceRefreshStatus enum value
	InstanceRefreshStatusFailed = "Failed"

	// InstanceRefreshStatusCancelling is a InstanceRefreshStatus enum value
	InstanceRefreshStatusCancelling = "Cancelling"

	// InstanceRefreshStatusCancelled is a InstanceRefreshStatus enum value
	InstanceRefreshStatusCancelled = "Cancelled"

	// InstanceRefreshStatusRollbackInProgress is a InstanceRefreshStatus enum value
	InstanceRefreshStatusRollbackInProgress = "RollbackInProgress"

	// InstanceRefreshStatusRollbackFailed is a InstanceRefreshStatus enum value
	InstanceRefreshStatusRollbackFailed = "RollbackFailed"

	// InstanceRefreshStatusRollbackSuccessful is a InstanceRefreshStatus enum value
	InstanceRefreshStatusRollbackSuccessful = "RollbackSuccessful"
)
View Source
const (
	// LifecycleStatePending is a LifecycleState enum value
	LifecycleStatePending = "Pending"

	// LifecycleStatePendingWait is a LifecycleState enum value
	LifecycleStatePendingWait = "Pending:Wait"

	// LifecycleStatePendingProceed is a LifecycleState enum value
	LifecycleStatePendingProceed = "Pending:Proceed"

	// LifecycleStateQuarantined is a LifecycleState enum value
	LifecycleStateQuarantined = "Quarantined"

	// LifecycleStateInService is a LifecycleState enum value
	LifecycleStateInService = "InService"

	// LifecycleStateTerminating is a LifecycleState enum value
	LifecycleStateTerminating = "Terminating"

	// LifecycleStateTerminatingWait is a LifecycleState enum value
	LifecycleStateTerminatingWait = "Terminating:Wait"

	// LifecycleStateTerminatingProceed is a LifecycleState enum value
	LifecycleStateTerminatingProceed = "Terminating:Proceed"

	// LifecycleStateTerminated is a LifecycleState enum value
	LifecycleStateTerminated = "Terminated"

	// LifecycleStateDetaching is a LifecycleState enum value
	LifecycleStateDetaching = "Detaching"

	// LifecycleStateDetached is a LifecycleState enum value
	LifecycleStateDetached = "Detached"

	// LifecycleStateEnteringStandby is a LifecycleState enum value
	LifecycleStateEnteringStandby = "EnteringStandby"

	// LifecycleStateStandby is a LifecycleState enum value
	LifecycleStateStandby = "Standby"

	// LifecycleStateWarmedPending is a LifecycleState enum value
	LifecycleStateWarmedPending = "Warmed:Pending"

	// LifecycleStateWarmedPendingWait is a LifecycleState enum value
	LifecycleStateWarmedPendingWait = "Warmed:Pending:Wait"

	// LifecycleStateWarmedPendingProceed is a LifecycleState enum value
	LifecycleStateWarmedPendingProceed = "Warmed:Pending:Proceed"

	// LifecycleStateWarmedTerminating is a LifecycleState enum value
	LifecycleStateWarmedTerminating = "Warmed:Terminating"

	// LifecycleStateWarmedTerminatingWait is a LifecycleState enum value
	LifecycleStateWarmedTerminatingWait = "Warmed:Terminating:Wait"

	// LifecycleStateWarmedTerminatingProceed is a LifecycleState enum value
	LifecycleStateWarmedTerminatingProceed = "Warmed:Terminating:Proceed"

	// LifecycleStateWarmedTerminated is a LifecycleState enum value
	LifecycleStateWarmedTerminated = "Warmed:Terminated"

	// LifecycleStateWarmedStopped is a LifecycleState enum value
	LifecycleStateWarmedStopped = "Warmed:Stopped"

	// LifecycleStateWarmedRunning is a LifecycleState enum value
	LifecycleStateWarmedRunning = "Warmed:Running"

	// LifecycleStateWarmedHibernated is a LifecycleState enum value
	LifecycleStateWarmedHibernated = "Warmed:Hibernated"
)
View Source
const (
	// LocalStorageIncluded is a LocalStorage enum value
	LocalStorageIncluded = "included"

	// LocalStorageExcluded is a LocalStorage enum value
	LocalStorageExcluded = "excluded"

	// LocalStorageRequired is a LocalStorage enum value
	LocalStorageRequired = "required"
)
View Source
const (
	// LocalStorageTypeHdd is a LocalStorageType enum value
	LocalStorageTypeHdd = "hdd"

	// LocalStorageTypeSsd is a LocalStorageType enum value
	LocalStorageTypeSsd = "ssd"
)
View Source
const (
	// MetricStatisticAverage is a MetricStatistic enum value
	MetricStatisticAverage = "Average"

	// MetricStatisticMinimum is a MetricStatistic enum value
	MetricStatisticMinimum = "Minimum"

	// MetricStatisticMaximum is a MetricStatistic enum value
	MetricStatisticMaximum = "Maximum"

	// MetricStatisticSampleCount is a MetricStatistic enum value
	MetricStatisticSampleCount = "SampleCount"

	// MetricStatisticSum is a MetricStatistic enum value
	MetricStatisticSum = "Sum"
)
View Source
const (
	// MetricTypeAsgaverageCpuutilization is a MetricType enum value
	MetricTypeAsgaverageCpuutilization = "ASGAverageCPUUtilization"

	// MetricTypeAsgaverageNetworkIn is a MetricType enum value
	MetricTypeAsgaverageNetworkIn = "ASGAverageNetworkIn"

	// MetricTypeAsgaverageNetworkOut is a MetricType enum value
	MetricTypeAsgaverageNetworkOut = "ASGAverageNetworkOut"

	// MetricTypeAlbrequestCountPerTarget is a MetricType enum value
	MetricTypeAlbrequestCountPerTarget = "ALBRequestCountPerTarget"
)
View Source
const (
	// PredefinedLoadMetricTypeAsgtotalCpuutilization is a PredefinedLoadMetricType enum value
	PredefinedLoadMetricTypeAsgtotalCpuutilization = "ASGTotalCPUUtilization"

	// PredefinedLoadMetricTypeAsgtotalNetworkIn is a PredefinedLoadMetricType enum value
	PredefinedLoadMetricTypeAsgtotalNetworkIn = "ASGTotalNetworkIn"

	// PredefinedLoadMetricTypeAsgtotalNetworkOut is a PredefinedLoadMetricType enum value
	PredefinedLoadMetricTypeAsgtotalNetworkOut = "ASGTotalNetworkOut"

	// PredefinedLoadMetricTypeAlbtargetGroupRequestCount is a PredefinedLoadMetricType enum value
	PredefinedLoadMetricTypeAlbtargetGroupRequestCount = "ALBTargetGroupRequestCount"
)
View Source
const (
	// PredefinedMetricPairTypeAsgcpuutilization is a PredefinedMetricPairType enum value
	PredefinedMetricPairTypeAsgcpuutilization = "ASGCPUUtilization"

	// PredefinedMetricPairTypeAsgnetworkIn is a PredefinedMetricPairType enum value
	PredefinedMetricPairTypeAsgnetworkIn = "ASGNetworkIn"

	// PredefinedMetricPairTypeAsgnetworkOut is a PredefinedMetricPairType enum value
	PredefinedMetricPairTypeAsgnetworkOut = "ASGNetworkOut"

	// PredefinedMetricPairTypeAlbrequestCount is a PredefinedMetricPairType enum value
	PredefinedMetricPairTypeAlbrequestCount = "ALBRequestCount"
)
View Source
const (
	// PredefinedScalingMetricTypeAsgaverageCpuutilization is a PredefinedScalingMetricType enum value
	PredefinedScalingMetricTypeAsgaverageCpuutilization = "ASGAverageCPUUtilization"

	// PredefinedScalingMetricTypeAsgaverageNetworkIn is a PredefinedScalingMetricType enum value
	PredefinedScalingMetricTypeAsgaverageNetworkIn = "ASGAverageNetworkIn"

	// PredefinedScalingMetricTypeAsgaverageNetworkOut is a PredefinedScalingMetricType enum value
	PredefinedScalingMetricTypeAsgaverageNetworkOut = "ASGAverageNetworkOut"

	// PredefinedScalingMetricTypeAlbrequestCountPerTarget is a PredefinedScalingMetricType enum value
	PredefinedScalingMetricTypeAlbrequestCountPerTarget = "ALBRequestCountPerTarget"
)
View Source
const (
	// PredictiveScalingMaxCapacityBreachBehaviorHonorMaxCapacity is a PredictiveScalingMaxCapacityBreachBehavior enum value
	PredictiveScalingMaxCapacityBreachBehaviorHonorMaxCapacity = "HonorMaxCapacity"

	// PredictiveScalingMaxCapacityBreachBehaviorIncreaseMaxCapacity is a PredictiveScalingMaxCapacityBreachBehavior enum value
	PredictiveScalingMaxCapacityBreachBehaviorIncreaseMaxCapacity = "IncreaseMaxCapacity"
)
View Source
const (
	// PredictiveScalingModeForecastAndScale is a PredictiveScalingMode enum value
	PredictiveScalingModeForecastAndScale = "ForecastAndScale"

	// PredictiveScalingModeForecastOnly is a PredictiveScalingMode enum value
	PredictiveScalingModeForecastOnly = "ForecastOnly"
)
View Source
const (
	// ScaleInProtectedInstancesRefresh is a ScaleInProtectedInstances enum value
	ScaleInProtectedInstancesRefresh = "Refresh"

	// ScaleInProtectedInstancesIgnore is a ScaleInProtectedInstances enum value
	ScaleInProtectedInstancesIgnore = "Ignore"

	// ScaleInProtectedInstancesWait is a ScaleInProtectedInstances enum value
	ScaleInProtectedInstancesWait = "Wait"
)
View Source
const (
	// ScalingActivityStatusCodePendingSpotBidPlacement is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodePendingSpotBidPlacement = "PendingSpotBidPlacement"

	// ScalingActivityStatusCodeWaitingForSpotInstanceRequestId is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeWaitingForSpotInstanceRequestId = "WaitingForSpotInstanceRequestId"

	// ScalingActivityStatusCodeWaitingForSpotInstanceId is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeWaitingForSpotInstanceId = "WaitingForSpotInstanceId"

	// ScalingActivityStatusCodeWaitingForInstanceId is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeWaitingForInstanceId = "WaitingForInstanceId"

	// ScalingActivityStatusCodePreInService is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodePreInService = "PreInService"

	// ScalingActivityStatusCodeInProgress is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeInProgress = "InProgress"

	// ScalingActivityStatusCodeWaitingForElbconnectionDraining is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeWaitingForElbconnectionDraining = "WaitingForELBConnectionDraining"

	// ScalingActivityStatusCodeMidLifecycleAction is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeMidLifecycleAction = "MidLifecycleAction"

	// ScalingActivityStatusCodeWaitingForInstanceWarmup is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeWaitingForInstanceWarmup = "WaitingForInstanceWarmup"

	// ScalingActivityStatusCodeSuccessful is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeSuccessful = "Successful"

	// ScalingActivityStatusCodeFailed is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeFailed = "Failed"

	// ScalingActivityStatusCodeCancelled is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeCancelled = "Cancelled"

	// ScalingActivityStatusCodeWaitingForConnectionDraining is a ScalingActivityStatusCode enum value
	ScalingActivityStatusCodeWaitingForConnectionDraining = "WaitingForConnectionDraining"
)
View Source
const (
	// StandbyInstancesTerminate is a StandbyInstances enum value
	StandbyInstancesTerminate = "Terminate"

	// StandbyInstancesIgnore is a StandbyInstances enum value
	StandbyInstancesIgnore = "Ignore"

	// StandbyInstancesWait is a StandbyInstances enum value
	StandbyInstancesWait = "Wait"
)
View Source
const (
	// WarmPoolStateStopped is a WarmPoolState enum value
	WarmPoolStateStopped = "Stopped"

	// WarmPoolStateRunning is a WarmPoolState enum value
	WarmPoolStateRunning = "Running"

	// WarmPoolStateHibernated is a WarmPoolState enum value
	WarmPoolStateHibernated = "Hibernated"
)
View Source
const (

	// ErrCodeActiveInstanceRefreshNotFoundFault for service response error code
	// "ActiveInstanceRefreshNotFound".
	//
	// The request failed because an active instance refresh or rollback for the
	// specified Auto Scaling group was not found.
	ErrCodeActiveInstanceRefreshNotFoundFault = "ActiveInstanceRefreshNotFound"

	// ErrCodeAlreadyExistsFault for service response error code
	// "AlreadyExists".
	//
	// You already have an Auto Scaling group or launch configuration with this
	// name.
	ErrCodeAlreadyExistsFault = "AlreadyExists"

	// ErrCodeInstanceRefreshInProgressFault for service response error code
	// "InstanceRefreshInProgress".
	//
	// The request failed because an active instance refresh already exists for
	// the specified Auto Scaling group.
	ErrCodeInstanceRefreshInProgressFault = "InstanceRefreshInProgress"

	// ErrCodeInvalidNextToken for service response error code
	// "InvalidNextToken".
	//
	// The NextToken value is not valid.
	ErrCodeInvalidNextToken = "InvalidNextToken"

	// ErrCodeIrreversibleInstanceRefreshFault for service response error code
	// "IrreversibleInstanceRefresh".
	//
	// The request failed because a desired configuration was not found or an incompatible
	// launch template (uses a Systems Manager parameter instead of an AMI ID) or
	// launch template version ($Latest or $Default) is present on the Auto Scaling
	// group.
	ErrCodeIrreversibleInstanceRefreshFault = "IrreversibleInstanceRefresh"

	// ErrCodeLimitExceededFault for service response error code
	// "LimitExceeded".
	//
	// You have already reached a limit for your Amazon EC2 Auto Scaling resources
	// (for example, Auto Scaling groups, launch configurations, or lifecycle hooks).
	// For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html)
	// in the Amazon EC2 Auto Scaling API Reference.
	ErrCodeLimitExceededFault = "LimitExceeded"

	// ErrCodeResourceContentionFault for service response error code
	// "ResourceContention".
	//
	// You already have a pending update to an Amazon EC2 Auto Scaling resource
	// (for example, an Auto Scaling group, instance, or load balancer).
	ErrCodeResourceContentionFault = "ResourceContention"

	// ErrCodeResourceInUseFault for service response error code
	// "ResourceInUse".
	//
	// The operation can't be performed because the resource is in use.
	ErrCodeResourceInUseFault = "ResourceInUse"

	// ErrCodeScalingActivityInProgressFault for service response error code
	// "ScalingActivityInProgress".
	//
	// The operation can't be performed because there are scaling activities in
	// progress.
	ErrCodeScalingActivityInProgressFault = "ScalingActivityInProgress"

	// ErrCodeServiceLinkedRoleFailure for service response error code
	// "ServiceLinkedRoleFailure".
	//
	// The service-linked role is not yet ready for use.
	ErrCodeServiceLinkedRoleFailure = "ServiceLinkedRoleFailure"
)
View Source
const (
	ServiceName = "autoscaling"  // Name of service.
	EndpointsID = ServiceName    // ID to lookup a service endpoint with.
	ServiceID   = "Auto Scaling" // ServiceID is a unique identifier of a specific service.
)

Service information constants

View Source
const (
	// RefreshStrategyRolling is a RefreshStrategy enum value
	RefreshStrategyRolling = "Rolling"
)
View Source
const (
	// WarmPoolStatusPendingDelete is a WarmPoolStatus enum value
	WarmPoolStatusPendingDelete = "PendingDelete"
)

Variables

This section is empty.

Functions

func AcceleratorManufacturer_Values added in v1.41.12

func AcceleratorManufacturer_Values() []string

AcceleratorManufacturer_Values returns all elements of the AcceleratorManufacturer enum

func AcceleratorName_Values added in v1.41.12

func AcceleratorName_Values() []string

AcceleratorName_Values returns all elements of the AcceleratorName enum

func AcceleratorType_Values added in v1.41.12

func AcceleratorType_Values() []string

AcceleratorType_Values returns all elements of the AcceleratorType enum

func BareMetal_Values added in v1.41.12

func BareMetal_Values() []string

BareMetal_Values returns all elements of the BareMetal enum

func BurstablePerformance_Values added in v1.41.12

func BurstablePerformance_Values() []string

BurstablePerformance_Values returns all elements of the BurstablePerformance enum

func CpuManufacturer_Values added in v1.41.12

func CpuManufacturer_Values() []string

CpuManufacturer_Values returns all elements of the CpuManufacturer enum

func InstanceGeneration_Values added in v1.41.12

func InstanceGeneration_Values() []string

InstanceGeneration_Values returns all elements of the InstanceGeneration enum

func InstanceMetadataEndpointState_Values added in v1.34.3

func InstanceMetadataEndpointState_Values() []string

InstanceMetadataEndpointState_Values returns all elements of the InstanceMetadataEndpointState enum

func InstanceMetadataHttpTokensState_Values added in v1.34.3

func InstanceMetadataHttpTokensState_Values() []string

InstanceMetadataHttpTokensState_Values returns all elements of the InstanceMetadataHttpTokensState enum

func InstanceRefreshStatus_Values added in v1.34.3

func InstanceRefreshStatus_Values() []string

InstanceRefreshStatus_Values returns all elements of the InstanceRefreshStatus enum

func LifecycleState_Values added in v1.34.3

func LifecycleState_Values() []string

LifecycleState_Values returns all elements of the LifecycleState enum

func LocalStorageType_Values added in v1.41.12

func LocalStorageType_Values() []string

LocalStorageType_Values returns all elements of the LocalStorageType enum

func LocalStorage_Values added in v1.41.12

func LocalStorage_Values() []string

LocalStorage_Values returns all elements of the LocalStorage enum

func MetricStatistic_Values added in v1.34.3

func MetricStatistic_Values() []string

MetricStatistic_Values returns all elements of the MetricStatistic enum

func MetricType_Values added in v1.34.3

func MetricType_Values() []string

MetricType_Values returns all elements of the MetricType enum

func PredefinedLoadMetricType_Values added in v1.38.43

func PredefinedLoadMetricType_Values() []string

PredefinedLoadMetricType_Values returns all elements of the PredefinedLoadMetricType enum

func PredefinedMetricPairType_Values added in v1.38.43

func PredefinedMetricPairType_Values() []string

PredefinedMetricPairType_Values returns all elements of the PredefinedMetricPairType enum

func PredefinedScalingMetricType_Values added in v1.38.43

func PredefinedScalingMetricType_Values() []string

PredefinedScalingMetricType_Values returns all elements of the PredefinedScalingMetricType enum

func PredictiveScalingMaxCapacityBreachBehavior_Values added in v1.38.43

func PredictiveScalingMaxCapacityBreachBehavior_Values() []string

PredictiveScalingMaxCapacityBreachBehavior_Values returns all elements of the PredictiveScalingMaxCapacityBreachBehavior enum

func PredictiveScalingMode_Values added in v1.38.43

func PredictiveScalingMode_Values() []string

PredictiveScalingMode_Values returns all elements of the PredictiveScalingMode enum

func RefreshStrategy_Values added in v1.34.3

func RefreshStrategy_Values() []string

RefreshStrategy_Values returns all elements of the RefreshStrategy enum

func ScaleInProtectedInstances_Values added in v1.44.199

func ScaleInProtectedInstances_Values() []string

ScaleInProtectedInstances_Values returns all elements of the ScaleInProtectedInstances enum

func ScalingActivityStatusCode_Values added in v1.34.3

func ScalingActivityStatusCode_Values() []string

ScalingActivityStatusCode_Values returns all elements of the ScalingActivityStatusCode enum

func StandbyInstances_Values added in v1.44.199

func StandbyInstances_Values() []string

StandbyInstances_Values returns all elements of the StandbyInstances enum

func WarmPoolState_Values added in v1.38.16

func WarmPoolState_Values() []string

WarmPoolState_Values returns all elements of the WarmPoolState enum

func WarmPoolStatus_Values added in v1.38.16

func WarmPoolStatus_Values() []string

WarmPoolStatus_Values returns all elements of the WarmPoolStatus enum

Types

type AcceleratorCountRequest added in v1.41.12

type AcceleratorCountRequest struct {

	// The maximum value.
	Max *int64 `type:"integer"`

	// The minimum value.
	Min *int64 `type:"integer"`
	// contains filtered or unexported fields
}

Specifies the minimum and maximum for the AcceleratorCount object when you specify InstanceRequirements for an Auto Scaling group.

func (AcceleratorCountRequest) GoString added in v1.41.12

func (s AcceleratorCountRequest) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AcceleratorCountRequest) SetMax added in v1.41.12

SetMax sets the Max field's value.

func (*AcceleratorCountRequest) SetMin added in v1.41.12

SetMin sets the Min field's value.

func (AcceleratorCountRequest) String added in v1.41.12

func (s AcceleratorCountRequest) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AcceleratorTotalMemoryMiBRequest added in v1.41.12

type AcceleratorTotalMemoryMiBRequest struct {

	// The memory maximum in MiB.
	Max *int64 `type:"integer"`

	// The memory minimum in MiB.
	Min *int64 `type:"integer"`
	// contains filtered or unexported fields
}

Specifies the minimum and maximum for the AcceleratorTotalMemoryMiB object when you specify InstanceRequirements for an Auto Scaling group.

func (AcceleratorTotalMemoryMiBRequest) GoString added in v1.41.12

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AcceleratorTotalMemoryMiBRequest) SetMax added in v1.41.12

SetMax sets the Max field's value.

func (*AcceleratorTotalMemoryMiBRequest) SetMin added in v1.41.12

SetMin sets the Min field's value.

func (AcceleratorTotalMemoryMiBRequest) String added in v1.41.12

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type Activity

type Activity struct {

	// The ID of the activity.
	//
	// ActivityId is a required field
	ActivityId *string `type:"string" required:"true"`

	// The Amazon Resource Name (ARN) of the Auto Scaling group.
	AutoScalingGroupARN *string `min:"1" type:"string"`

	// The name of the Auto Scaling group.
	//
	// AutoScalingGroupName is a required field
	AutoScalingGroupName *string `min:"1" type:"string" required:"true"`

	// The state of the Auto Scaling group, which is either InService or Deleted.
	AutoScalingGroupState *string `min:"1" type:"string"`

	// The reason the activity began.
	//
	// Cause is a required field
	Cause *string `min:"1" type:"string" required:"true"`

	// A friendly, more verbose description of the activity.
	Description *string `type:"string"`

	// The details about the activity.
	Details *string `type:"string"`

	// The end time of the activity.
	EndTime *time.Time `type:"timestamp"`

	// A value between 0 and 100 that indicates the progress of the activity.
	Progress *int64 `type:"integer"`

	// The start time of the activity.
	//
	// StartTime is a required field
	StartTime *time.Time `type:"timestamp" required:"true"`

	// The current status of the activity.
	//
	// StatusCode is a required field
	StatusCode *string `type:"string" required:"true" enum:"ScalingActivityStatusCode"`

	// A friendly, more verbose description of the activity status.
	StatusMessage *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance.

func (Activity) GoString added in v0.6.5

func (s Activity) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*Activity) SetActivityId added in v1.5.0

func (s *Activity) SetActivityId(v string) *Activity

SetActivityId sets the ActivityId field's value.

func (*Activity) SetAutoScalingGroupARN added in v1.37.17

func (s *Activity) SetAutoScalingGroupARN(v string) *Activity

SetAutoScalingGroupARN sets the AutoScalingGroupARN field's value.

func (*Activity) SetAutoScalingGroupName added in v1.5.0

func (s *Activity) SetAutoScalingGroupName(v string) *Activity

SetAutoScalingGroupName sets the AutoScalingGroupName field's value.

func (*Activity) SetAutoScalingGroupState added in v1.37.17

func (s *Activity) SetAutoScalingGroupState(v string) *Activity

SetAutoScalingGroupState sets the AutoScalingGroupState field's value.

func (*Activity) SetCause added in v1.5.0

func (s *Activity) SetCause(v string) *Activity

SetCause sets the Cause field's value.

func (*Activity) SetDescription added in v1.5.0

func (s *Activity) SetDescription(v string) *Activity

SetDescription sets the Description field's value.

func (*Activity) SetDetails added in v1.5.0

func (s *Activity) SetDetails(v string) *Activity

SetDetails sets the Details field's value.

func (*Activity) SetEndTime added in v1.5.0

func (s *Activity) SetEndTime(v time.Time) *Activity

SetEndTime sets the EndTime field's value.

func (*Activity) SetProgress added in v1.5.0

func (s *Activity) SetProgress(v int64) *Activity

SetProgress sets the Progress field's value.

func (*Activity) SetStartTime added in v1.5.0

func (s *Activity) SetStartTime(v time.Time) *Activity

SetStartTime sets the StartTime field's value.

func (*Activity) SetStatusCode added in v1.5.0

func (s *Activity) SetStatusCode(v string) *Activity

SetStatusCode sets the StatusCode field's value.

func (*Activity) SetStatusMessage added in v1.5.0

func (s *Activity) SetStatusMessage(v string) *Activity

SetStatusMessage sets the StatusMessage field's value.

func (Activity) String added in v0.6.5

func (s Activity) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AdjustmentType

type AdjustmentType struct {

	// The policy adjustment type. The valid values are ChangeInCapacity, ExactCapacity,
	// and PercentChangeInCapacity.
	AdjustmentType *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

Describes a policy adjustment type.

func (AdjustmentType) GoString added in v0.6.5

func (s AdjustmentType) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AdjustmentType) SetAdjustmentType added in v1.5.0

func (s *AdjustmentType) SetAdjustmentType(v string) *AdjustmentType

SetAdjustmentType sets the AdjustmentType field's value.

func (AdjustmentType) String added in v0.6.5

func (s AdjustmentType) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type Alarm

type Alarm struct {

	// The Amazon Resource Name (ARN) of the alarm.
	AlarmARN *string `min:"1" type:"string"`

	// The name of the alarm.
	AlarmName *string `min:"1" type:"string"`
	// contains filtered or unexported fields
}

Describes an alarm.

func (Alarm) GoString added in v0.6.5

func (s Alarm) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*Alarm) SetAlarmARN added in v1.5.0

func (s *Alarm) SetAlarmARN(v string) *Alarm

SetAlarmARN sets the AlarmARN field's value.

func (*Alarm) SetAlarmName added in v1.5.0

func (s *Alarm) SetAlarmName(v string) *Alarm

SetAlarmName sets the AlarmName field's value.

func (Alarm) String added in v0.6.5

func (s Alarm) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AlarmSpecification added in v1.44.313

type AlarmSpecification struct {

	// The names of one or more CloudWatch alarms to monitor for the instance refresh.
	// You can specify up to 10 alarms.
	Alarms []*string `type:"list"`
	// contains filtered or unexported fields
}

Specifies the CloudWatch alarm specification to use in an instance refresh.

func (AlarmSpecification) GoString added in v1.44.313

func (s AlarmSpecification) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AlarmSpecification) SetAlarms added in v1.44.313

func (s *AlarmSpecification) SetAlarms(v []*string) *AlarmSpecification

SetAlarms sets the Alarms field's value.

func (AlarmSpecification) String added in v1.44.313

func (s AlarmSpecification) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AttachInstancesInput

type AttachInstancesInput struct {

	// The name of the Auto Scaling group.
	//
	// AutoScalingGroupName is a required field
	AutoScalingGroupName *string `min:"1" type:"string" required:"true"`

	// The IDs of the instances. You can specify up to 20 instances.
	InstanceIds []*string `type:"list"`
	// contains filtered or unexported fields
}

func (AttachInstancesInput) GoString added in v0.6.5

func (s AttachInstancesInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachInstancesInput) SetAutoScalingGroupName added in v1.5.0

func (s *AttachInstancesInput) SetAutoScalingGroupName(v string) *AttachInstancesInput

SetAutoScalingGroupName sets the AutoScalingGroupName field's value.

func (*AttachInstancesInput) SetInstanceIds added in v1.5.0

func (s *AttachInstancesInput) SetInstanceIds(v []*string) *AttachInstancesInput

SetInstanceIds sets the InstanceIds field's value.

func (AttachInstancesInput) String added in v0.6.5

func (s AttachInstancesInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachInstancesInput) Validate added in v1.1.21

func (s *AttachInstancesInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AttachInstancesOutput

type AttachInstancesOutput struct {
	// contains filtered or unexported fields
}

func (AttachInstancesOutput) GoString added in v0.6.5

func (s AttachInstancesOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (AttachInstancesOutput) String added in v0.6.5

func (s AttachInstancesOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AttachLoadBalancerTargetGroupsInput added in v1.4.1

type AttachLoadBalancerTargetGroupsInput struct {

	// The name of the Auto Scaling group.
	//
	// AutoScalingGroupName is a required field
	AutoScalingGroupName *string `min:"1" type:"string" required:"true"`

	// The Amazon Resource Names (ARNs) of the target groups. You can specify up
	// to 10 target groups. To get the ARN of a target group, use the Elastic Load
	// Balancing DescribeTargetGroups (https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html)
	// API operation.
	//
	// TargetGroupARNs is a required field
	TargetGroupARNs []*string `type:"list" required:"true"`
	// contains filtered or unexported fields
}

func (AttachLoadBalancerTargetGroupsInput) GoString added in v1.4.1

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachLoadBalancerTargetGroupsInput) SetAutoScalingGroupName added in v1.5.0

SetAutoScalingGroupName sets the AutoScalingGroupName field's value.

func (*AttachLoadBalancerTargetGroupsInput) SetTargetGroupARNs added in v1.5.0

SetTargetGroupARNs sets the TargetGroupARNs field's value.

func (AttachLoadBalancerTargetGroupsInput) String added in v1.4.1

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachLoadBalancerTargetGroupsInput) Validate added in v1.4.1

Validate inspects the fields of the type to determine if they are valid.

type AttachLoadBalancerTargetGroupsOutput added in v1.4.1

type AttachLoadBalancerTargetGroupsOutput struct {
	// contains filtered or unexported fields
}

func (AttachLoadBalancerTargetGroupsOutput) GoString added in v1.4.1

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (AttachLoadBalancerTargetGroupsOutput) String added in v1.4.1

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AttachLoadBalancersInput added in v0.6.2

type AttachLoadBalancersInput struct {

	// The name of the Auto Scaling group.
	//
	// AutoScalingGroupName is a required field
	AutoScalingGroupName *string `min:"1" type:"string" required:"true"`

	// The names of the load balancers. You can specify up to 10 load balancers.
	//
	// LoadBalancerNames is a required field
	LoadBalancerNames []*string `type:"list" required:"true"`
	// contains filtered or unexported fields
}

func (AttachLoadBalancersInput) GoString added in v0.6.5

func (s AttachLoadBalancersInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachLoadBalancersInput) SetAutoScalingGroupName added in v1.5.0

func (s *AttachLoadBalancersInput) SetAutoScalingGroupName(v string) *AttachLoadBalancersInput

SetAutoScalingGroupName sets the AutoScalingGroupName field's value.

func (*AttachLoadBalancersInput) SetLoadBalancerNames added in v1.5.0

func (s *AttachLoadBalancersInput) SetLoadBalancerNames(v []*string) *AttachLoadBalancersInput

SetLoadBalancerNames sets the LoadBalancerNames field's value.

func (AttachLoadBalancersInput) String added in v0.6.5

func (s AttachLoadBalancersInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachLoadBalancersInput) Validate added in v1.1.21

func (s *AttachLoadBalancersInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AttachLoadBalancersOutput added in v0.6.2

type AttachLoadBalancersOutput struct {
	// contains filtered or unexported fields
}

func (AttachLoadBalancersOutput) GoString added in v0.6.5

func (s AttachLoadBalancersOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (AttachLoadBalancersOutput) String added in v0.6.5

func (s AttachLoadBalancersOutput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AttachTrafficSourcesInput added in v1.44.156

type AttachTrafficSourcesInput struct {

	// The name of the Auto Scaling group.
	//
	// AutoScalingGroupName is a required field
	AutoScalingGroupName *string `min:"1" type:"string" required:"true"`

	// The unique identifiers of one or more traffic sources. You can specify up
	// to 10 traffic sources.
	//
	// TrafficSources is a required field
	TrafficSources []*TrafficSourceIdentifier `type:"list" required:"true"`
	// contains filtered or unexported fields
}

func (AttachTrafficSourcesInput) GoString added in v1.44.156

func (s AttachTrafficSourcesInput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachTrafficSourcesInput) SetAutoScalingGroupName added in v1.44.156

func (s *AttachTrafficSourcesInput) SetAutoScalingGroupName(v string) *AttachTrafficSourcesInput

SetAutoScalingGroupName sets the AutoScalingGroupName field's value.

func (*AttachTrafficSourcesInput) SetTrafficSources added in v1.44.156

SetTrafficSources sets the TrafficSources field's value.

func (AttachTrafficSourcesInput) String added in v1.44.156

func (s AttachTrafficSourcesInput) String() string

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (*AttachTrafficSourcesInput) Validate added in v1.44.156

func (s *AttachTrafficSourcesInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AttachTrafficSourcesOutput added in v1.44.156

type AttachTrafficSourcesOutput struct {
	// contains filtered or unexported fields
}

func (AttachTrafficSourcesOutput) GoString added in v1.44.156

func (s AttachTrafficSourcesOutput) GoString() string

GoString returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

func (AttachTrafficSourcesOutput) String added in v1.44.156

String returns the string representation.

API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".

type AutoScaling

type AutoScaling struct {
	*client.Client
}

AutoScaling provides the API operation methods for making requests to Auto Scaling. See this package's package overview docs for details on the service.

AutoScaling methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

func New

func New(p client.ConfigProvider, cfgs ...*aws.Config) *AutoScaling

New creates a new instance of the AutoScaling client with a session. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.

Example:

mySession := session.Must(session.NewSession())

// Create a AutoScaling client from just a session.
svc := autoscaling.New(mySession)

// Create a AutoScaling client with additional configuration
svc := autoscaling.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

func (*AutoScaling) AttachInstances

func (c *AutoScaling) AttachInstances(input *AttachInstancesInput) (*AttachInstancesOutput, error)

AttachInstances API operation for Auto Scaling.

Attaches one or more EC2 instances to the specified Auto Scaling group.

When you attach instances, Amazon EC2 Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.

If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.

For more information, see Detach or attach instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-detach-attach-instances.html) in the Amazon EC2 Auto Scaling User Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation AttachInstances for usage and error information.

Returned Error Codes:

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" The service-linked role is not yet ready for use.

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachInstances

Example (Shared00)

To attach an instance to an Auto Scaling group This example attaches the specified instance to the specified Auto Scaling group.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.AttachInstancesInput{
		AutoScalingGroupName: aws.String("my-auto-scaling-group"),
		InstanceIds: []*string{
			aws.String("i-93633f9b"),
		},
	}

	result, err := svc.AttachInstances(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) AttachInstancesRequest

func (c *AutoScaling) AttachInstancesRequest(input *AttachInstancesInput) (req *request.Request, output *AttachInstancesOutput)

AttachInstancesRequest generates a "aws/request.Request" representing the client's request for the AttachInstances operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AttachInstances for more information on using the AttachInstances API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AttachInstancesRequest method.
req, resp := client.AttachInstancesRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachInstances

func (*AutoScaling) AttachInstancesWithContext added in v1.8.0

func (c *AutoScaling) AttachInstancesWithContext(ctx aws.Context, input *AttachInstancesInput, opts ...request.Option) (*AttachInstancesOutput, error)

AttachInstancesWithContext is the same as AttachInstances with the addition of the ability to pass a context and additional request options.

See AttachInstances for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) AttachLoadBalancerTargetGroups added in v1.4.1

func (c *AutoScaling) AttachLoadBalancerTargetGroups(input *AttachLoadBalancerTargetGroupsInput) (*AttachLoadBalancerTargetGroupsOutput, error)

AttachLoadBalancerTargetGroups API operation for Auto Scaling.

This API operation is superseded by AttachTrafficSources, which can attach multiple traffic sources types. We recommend using AttachTrafficSources to simplify how you manage traffic sources. However, we continue to support AttachLoadBalancerTargetGroups. You can use both the original AttachLoadBalancerTargetGroups API operation and AttachTrafficSources on the same Auto Scaling group.

Attaches one or more target groups to the specified Auto Scaling group.

This operation is used with the following load balancer types:

  • Application Load Balancer - Operates at the application layer (layer 7) and supports HTTP and HTTPS.

  • Network Load Balancer - Operates at the transport layer (layer 4) and supports TCP, TLS, and UDP.

  • Gateway Load Balancer - Operates at the network layer (layer 3).

To describe the target groups for an Auto Scaling group, call the DescribeLoadBalancerTargetGroups API. To detach the target group from the Auto Scaling group, call the DetachLoadBalancerTargetGroups API.

This operation is additive and does not detach existing target groups or Classic Load Balancers from the Auto Scaling group.

For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) in the Amazon EC2 Auto Scaling User Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation AttachLoadBalancerTargetGroups for usage and error information.

Returned Error Codes:

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" The service-linked role is not yet ready for use.

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancerTargetGroups

Example (Shared00)

To attach a target group to an Auto Scaling group This example attaches the specified target group to the specified Auto Scaling group.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.AttachLoadBalancerTargetGroupsInput{
		AutoScalingGroupName: aws.String("my-auto-scaling-group"),
		TargetGroupARNs: []*string{
			aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"),
		},
	}

	result, err := svc.AttachLoadBalancerTargetGroups(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) AttachLoadBalancerTargetGroupsRequest added in v1.4.1

func (c *AutoScaling) AttachLoadBalancerTargetGroupsRequest(input *AttachLoadBalancerTargetGroupsInput) (req *request.Request, output *AttachLoadBalancerTargetGroupsOutput)

AttachLoadBalancerTargetGroupsRequest generates a "aws/request.Request" representing the client's request for the AttachLoadBalancerTargetGroups operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AttachLoadBalancerTargetGroups for more information on using the AttachLoadBalancerTargetGroups API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AttachLoadBalancerTargetGroupsRequest method.
req, resp := client.AttachLoadBalancerTargetGroupsRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancerTargetGroups

func (*AutoScaling) AttachLoadBalancerTargetGroupsWithContext added in v1.8.0

func (c *AutoScaling) AttachLoadBalancerTargetGroupsWithContext(ctx aws.Context, input *AttachLoadBalancerTargetGroupsInput, opts ...request.Option) (*AttachLoadBalancerTargetGroupsOutput, error)

AttachLoadBalancerTargetGroupsWithContext is the same as AttachLoadBalancerTargetGroups with the addition of the ability to pass a context and additional request options.

See AttachLoadBalancerTargetGroups for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) AttachLoadBalancers added in v0.6.2

func (c *AutoScaling) AttachLoadBalancers(input *AttachLoadBalancersInput) (*AttachLoadBalancersOutput, error)

AttachLoadBalancers API operation for Auto Scaling.

This API operation is superseded by AttachTrafficSources, which can attach multiple traffic sources types. We recommend using AttachTrafficSources to simplify how you manage traffic sources. However, we continue to support AttachLoadBalancers. You can use both the original AttachLoadBalancers API operation and AttachTrafficSources on the same Auto Scaling group.

Attaches one or more Classic Load Balancers to the specified Auto Scaling group. Amazon EC2 Auto Scaling registers the running instances with these Classic Load Balancers.

To describe the load balancers for an Auto Scaling group, call the DescribeLoadBalancers API. To detach a load balancer from the Auto Scaling group, call the DetachLoadBalancers API.

This operation is additive and does not detach existing Classic Load Balancers or target groups from the Auto Scaling group.

For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group (https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) in the Amazon EC2 Auto Scaling User Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation AttachLoadBalancers for usage and error information.

Returned Error Codes:

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" The service-linked role is not yet ready for use.

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancers

Example (Shared00)

To attach a load balancer to an Auto Scaling group This example attaches the specified load balancer to the specified Auto Scaling group.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.AttachLoadBalancersInput{
		AutoScalingGroupName: aws.String("my-auto-scaling-group"),
		LoadBalancerNames: []*string{
			aws.String("my-load-balancer"),
		},
	}

	result, err := svc.AttachLoadBalancers(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) AttachLoadBalancersRequest added in v0.6.2

func (c *AutoScaling) AttachLoadBalancersRequest(input *AttachLoadBalancersInput) (req *request.Request, output *AttachLoadBalancersOutput)

AttachLoadBalancersRequest generates a "aws/request.Request" representing the client's request for the AttachLoadBalancers operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AttachLoadBalancers for more information on using the AttachLoadBalancers API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AttachLoadBalancersRequest method.
req, resp := client.AttachLoadBalancersRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancers

func (*AutoScaling) AttachLoadBalancersWithContext added in v1.8.0

func (c *AutoScaling) AttachLoadBalancersWithContext(ctx aws.Context, input *AttachLoadBalancersInput, opts ...request.Option) (*AttachLoadBalancersOutput, error)

AttachLoadBalancersWithContext is the same as AttachLoadBalancers with the addition of the ability to pass a context and additional request options.

See AttachLoadBalancers for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) AttachTrafficSources added in v1.44.156

func (c *AutoScaling) AttachTrafficSources(input *AttachTrafficSourcesInput) (*AttachTrafficSourcesOutput, error)

AttachTrafficSources API operation for Auto Scaling.

Attaches one or more traffic sources to the specified Auto Scaling group.

You can use any of the following as traffic sources for an Auto Scaling group:

  • Application Load Balancer

  • Classic Load Balancer

  • Gateway Load Balancer

  • Network Load Balancer

  • VPC Lattice

This operation is additive and does not detach existing traffic sources from the Auto Scaling group.

After the operation completes, use the DescribeTrafficSources API to return details about the state of the attachments between traffic sources and your Auto Scaling group. To detach a traffic source from the Auto Scaling group, call the DetachTrafficSources API.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation AttachTrafficSources for usage and error information.

Returned Error Codes:

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" The service-linked role is not yet ready for use.

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachTrafficSources

Example (Shared00)

To attach a target group to an Auto Scaling group This example attaches the specified target group to the specified Auto Scaling group.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.AttachTrafficSourcesInput{
		AutoScalingGroupName: aws.String("my-auto-scaling-group"),
		TrafficSources: []*autoscaling.TrafficSourceIdentifier{
			{
				Identifier: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"),
			},
		},
	}

	result, err := svc.AttachTrafficSources(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) AttachTrafficSourcesRequest added in v1.44.156

func (c *AutoScaling) AttachTrafficSourcesRequest(input *AttachTrafficSourcesInput) (req *request.Request, output *AttachTrafficSourcesOutput)

AttachTrafficSourcesRequest generates a "aws/request.Request" representing the client's request for the AttachTrafficSources operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AttachTrafficSources for more information on using the AttachTrafficSources API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AttachTrafficSourcesRequest method.
req, resp := client.AttachTrafficSourcesRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachTrafficSources

func (*AutoScaling) AttachTrafficSourcesWithContext added in v1.44.156

func (c *AutoScaling) AttachTrafficSourcesWithContext(ctx aws.Context, input *AttachTrafficSourcesInput, opts ...request.Option) (*AttachTrafficSourcesOutput, error)

AttachTrafficSourcesWithContext is the same as AttachTrafficSources with the addition of the ability to pass a context and additional request options.

See AttachTrafficSources for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) BatchDeleteScheduledAction added in v1.15.12

func (c *AutoScaling) BatchDeleteScheduledAction(input *BatchDeleteScheduledActionInput) (*BatchDeleteScheduledActionOutput, error)

BatchDeleteScheduledAction API operation for Auto Scaling.

Deletes one or more scheduled actions for the specified Auto Scaling group.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation BatchDeleteScheduledAction for usage and error information.

Returned Error Codes:

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchDeleteScheduledAction

func (*AutoScaling) BatchDeleteScheduledActionRequest added in v1.15.12

func (c *AutoScaling) BatchDeleteScheduledActionRequest(input *BatchDeleteScheduledActionInput) (req *request.Request, output *BatchDeleteScheduledActionOutput)

BatchDeleteScheduledActionRequest generates a "aws/request.Request" representing the client's request for the BatchDeleteScheduledAction operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See BatchDeleteScheduledAction for more information on using the BatchDeleteScheduledAction API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the BatchDeleteScheduledActionRequest method.
req, resp := client.BatchDeleteScheduledActionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchDeleteScheduledAction

func (*AutoScaling) BatchDeleteScheduledActionWithContext added in v1.15.12

func (c *AutoScaling) BatchDeleteScheduledActionWithContext(ctx aws.Context, input *BatchDeleteScheduledActionInput, opts ...request.Option) (*BatchDeleteScheduledActionOutput, error)

BatchDeleteScheduledActionWithContext is the same as BatchDeleteScheduledAction with the addition of the ability to pass a context and additional request options.

See BatchDeleteScheduledAction for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) BatchPutScheduledUpdateGroupAction added in v1.15.12

BatchPutScheduledUpdateGroupAction API operation for Auto Scaling.

Creates or updates one or more scheduled scaling actions for an Auto Scaling group.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation BatchPutScheduledUpdateGroupAction for usage and error information.

Returned Error Codes:

  • ErrCodeAlreadyExistsFault "AlreadyExists" You already have an Auto Scaling group or launch configuration with this name.

  • ErrCodeLimitExceededFault "LimitExceeded" You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) in the Amazon EC2 Auto Scaling API Reference.

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchPutScheduledUpdateGroupAction

func (*AutoScaling) BatchPutScheduledUpdateGroupActionRequest added in v1.15.12

func (c *AutoScaling) BatchPutScheduledUpdateGroupActionRequest(input *BatchPutScheduledUpdateGroupActionInput) (req *request.Request, output *BatchPutScheduledUpdateGroupActionOutput)

BatchPutScheduledUpdateGroupActionRequest generates a "aws/request.Request" representing the client's request for the BatchPutScheduledUpdateGroupAction operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See BatchPutScheduledUpdateGroupAction for more information on using the BatchPutScheduledUpdateGroupAction API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the BatchPutScheduledUpdateGroupActionRequest method.
req, resp := client.BatchPutScheduledUpdateGroupActionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchPutScheduledUpdateGroupAction

func (*AutoScaling) BatchPutScheduledUpdateGroupActionWithContext added in v1.15.12

func (c *AutoScaling) BatchPutScheduledUpdateGroupActionWithContext(ctx aws.Context, input *BatchPutScheduledUpdateGroupActionInput, opts ...request.Option) (*BatchPutScheduledUpdateGroupActionOutput, error)

BatchPutScheduledUpdateGroupActionWithContext is the same as BatchPutScheduledUpdateGroupAction with the addition of the ability to pass a context and additional request options.

See BatchPutScheduledUpdateGroupAction for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) CancelInstanceRefresh added in v1.32.3

func (c *AutoScaling) CancelInstanceRefresh(input *CancelInstanceRefreshInput) (*CancelInstanceRefreshOutput, error)

CancelInstanceRefresh API operation for Auto Scaling.

Cancels an instance refresh or rollback that is in progress. If an instance refresh or rollback is not in progress, an ActiveInstanceRefreshNotFound error occurs.

This operation is part of the instance refresh feature (https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html) in Amazon EC2 Auto Scaling, which helps you update instances in your Auto Scaling group after you make configuration changes.

When you cancel an instance refresh, this does not roll back any changes that it made. Use the RollbackInstanceRefresh API to roll back instead.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation CancelInstanceRefresh for usage and error information.

Returned Error Codes:

  • ErrCodeLimitExceededFault "LimitExceeded" You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) in the Amazon EC2 Auto Scaling API Reference.

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ErrCodeActiveInstanceRefreshNotFoundFault "ActiveInstanceRefreshNotFound" The request failed because an active instance refresh or rollback for the specified Auto Scaling group was not found.

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CancelInstanceRefresh

Example (Shared00)

To cancel an instance refresh This example cancels an instance refresh operation in progress.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CancelInstanceRefreshInput{
		AutoScalingGroupName: aws.String("my-auto-scaling-group"),
	}

	result, err := svc.CancelInstanceRefresh(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeLimitExceededFault:
				fmt.Println(autoscaling.ErrCodeLimitExceededFault, aerr.Error())
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeActiveInstanceRefreshNotFoundFault:
				fmt.Println(autoscaling.ErrCodeActiveInstanceRefreshNotFoundFault, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) CancelInstanceRefreshRequest added in v1.32.3

func (c *AutoScaling) CancelInstanceRefreshRequest(input *CancelInstanceRefreshInput) (req *request.Request, output *CancelInstanceRefreshOutput)

CancelInstanceRefreshRequest generates a "aws/request.Request" representing the client's request for the CancelInstanceRefresh operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CancelInstanceRefresh for more information on using the CancelInstanceRefresh API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CancelInstanceRefreshRequest method.
req, resp := client.CancelInstanceRefreshRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CancelInstanceRefresh

func (*AutoScaling) CancelInstanceRefreshWithContext added in v1.32.3

func (c *AutoScaling) CancelInstanceRefreshWithContext(ctx aws.Context, input *CancelInstanceRefreshInput, opts ...request.Option) (*CancelInstanceRefreshOutput, error)

CancelInstanceRefreshWithContext is the same as CancelInstanceRefresh with the addition of the ability to pass a context and additional request options.

See CancelInstanceRefresh for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) CompleteLifecycleAction

func (c *AutoScaling) CompleteLifecycleAction(input *CompleteLifecycleActionInput) (*CompleteLifecycleActionOutput, error)

CompleteLifecycleAction API operation for Auto Scaling.

Completes the lifecycle action for the specified token or instance with the specified result.

This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:

(Optional) Create a launch template or launch configuration with a user data script that runs while an instance is in a wait state due to a lifecycle hook.

(Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when an instance is put into a wait state due to a lifecycle hook.

(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.

Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.

If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state.

If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction API call.

For more information, see Complete a lifecycle action (https://docs.aws.amazon.com/autoscaling/ec2/userguide/completing-lifecycle-hooks.html) in the Amazon EC2 Auto Scaling User Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation CompleteLifecycleAction for usage and error information.

Returned Error Codes:

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleAction

Example (Shared00)

To complete the lifecycle action This example notifies Auto Scaling that the specified lifecycle action is complete so that it can finish launching or terminating the instance.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CompleteLifecycleActionInput{
		AutoScalingGroupName:  aws.String("my-auto-scaling-group"),
		LifecycleActionResult: aws.String("CONTINUE"),
		LifecycleActionToken:  aws.String("bcd2f1b8-9a78-44d3-8a7a-4dd07d7cf635"),
		LifecycleHookName:     aws.String("my-lifecycle-hook"),
	}

	result, err := svc.CompleteLifecycleAction(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) CompleteLifecycleActionRequest

func (c *AutoScaling) CompleteLifecycleActionRequest(input *CompleteLifecycleActionInput) (req *request.Request, output *CompleteLifecycleActionOutput)

CompleteLifecycleActionRequest generates a "aws/request.Request" representing the client's request for the CompleteLifecycleAction operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CompleteLifecycleAction for more information on using the CompleteLifecycleAction API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CompleteLifecycleActionRequest method.
req, resp := client.CompleteLifecycleActionRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleAction

func (*AutoScaling) CompleteLifecycleActionWithContext added in v1.8.0

func (c *AutoScaling) CompleteLifecycleActionWithContext(ctx aws.Context, input *CompleteLifecycleActionInput, opts ...request.Option) (*CompleteLifecycleActionOutput, error)

CompleteLifecycleActionWithContext is the same as CompleteLifecycleAction with the addition of the ability to pass a context and additional request options.

See CompleteLifecycleAction for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) CreateAutoScalingGroup

func (c *AutoScaling) CreateAutoScalingGroup(input *CreateAutoScalingGroupInput) (*CreateAutoScalingGroupOutput, error)

CreateAutoScalingGroup API operation for Auto Scaling.

We strongly recommend using a launch template when calling this operation to ensure full functionality for Amazon EC2 Auto Scaling and Amazon EC2.

Creates an Auto Scaling group with the specified name and attributes.

If you exceed your maximum limit of Auto Scaling groups, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Quotas for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-quotas.html) in the Amazon EC2 Auto Scaling User Guide.

If you're new to Amazon EC2 Auto Scaling, see the introductory tutorials in Get started with Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/get-started-with-ec2-auto-scaling.html) in the Amazon EC2 Auto Scaling User Guide.

Every Auto Scaling group has three size properties (DesiredCapacity, MaxSize, and MinSize). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation CreateAutoScalingGroup for usage and error information.

Returned Error Codes:

  • ErrCodeAlreadyExistsFault "AlreadyExists" You already have an Auto Scaling group or launch configuration with this name.

  • ErrCodeLimitExceededFault "LimitExceeded" You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) in the Amazon EC2 Auto Scaling API Reference.

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ErrCodeServiceLinkedRoleFailure "ServiceLinkedRoleFailure" The service-linked role is not yet ready for use.

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateAutoScalingGroup

Example (Shared00)

To create an Auto Scaling group This example creates an Auto Scaling group.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CreateAutoScalingGroupInput{
		AutoScalingGroupName:  aws.String("my-auto-scaling-group"),
		DefaultInstanceWarmup: aws.Int64(120),
		LaunchTemplate: &autoscaling.LaunchTemplateSpecification{
			LaunchTemplateName: aws.String("my-template-for-auto-scaling"),
			Version:            aws.String("$Default"),
		},
		MaxInstanceLifetime: aws.Int64(2592000),
		MaxSize:             aws.Int64(3),
		MinSize:             aws.Int64(1),
		VPCZoneIdentifier:   aws.String("subnet-057fa0918fEXAMPLE"),
	}

	result, err := svc.CreateAutoScalingGroup(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeAlreadyExistsFault:
				fmt.Println(autoscaling.ErrCodeAlreadyExistsFault, aerr.Error())
			case autoscaling.ErrCodeLimitExceededFault:
				fmt.Println(autoscaling.ErrCodeLimitExceededFault, aerr.Error())
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

Example (Shared01)

To create an Auto Scaling group with an attached target group This example creates an Auto Scaling group and attaches the specified target group.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CreateAutoScalingGroupInput{
		AutoScalingGroupName:   aws.String("my-auto-scaling-group"),
		HealthCheckGracePeriod: aws.Int64(300),
		HealthCheckType:        aws.String("ELB"),
		LaunchTemplate: &autoscaling.LaunchTemplateSpecification{
			LaunchTemplateName: aws.String("my-template-for-auto-scaling"),
			Version:            aws.String("$Default"),
		},
		MaxSize: aws.Int64(3),
		MinSize: aws.Int64(1),
		TargetGroupARNs: []*string{
			aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"),
		},
		VPCZoneIdentifier: aws.String("subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE"),
	}

	result, err := svc.CreateAutoScalingGroup(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeAlreadyExistsFault:
				fmt.Println(autoscaling.ErrCodeAlreadyExistsFault, aerr.Error())
			case autoscaling.ErrCodeLimitExceededFault:
				fmt.Println(autoscaling.ErrCodeLimitExceededFault, aerr.Error())
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

Example (Shared02)

To create an Auto Scaling group with a mixed instances policy This example creates an Auto Scaling group with a mixed instances policy. It specifies the c5.large, c5a.large, and c6g.large instance types and defines a different launch template for the c6g.large instance type.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CreateAutoScalingGroupInput{
		AutoScalingGroupName: aws.String("my-asg"),
		DesiredCapacity:      aws.Int64(3),
		MaxSize:              aws.Int64(5),
		MinSize:              aws.Int64(1),
		MixedInstancesPolicy: &autoscaling.MixedInstancesPolicy{
			InstancesDistribution: &autoscaling.InstancesDistribution{
				OnDemandBaseCapacity:                aws.Int64(1),
				OnDemandPercentageAboveBaseCapacity: aws.Int64(50),
				SpotAllocationStrategy:              aws.String("price-capacity-optimized"),
			},
			LaunchTemplate: &autoscaling.LaunchTemplate{
				LaunchTemplateSpecification: &autoscaling.LaunchTemplateSpecification{
					LaunchTemplateName: aws.String("my-launch-template-for-x86"),
					Version:            aws.String("$Default"),
				},
				Overrides: []*autoscaling.LaunchTemplateOverrides{
					{
						InstanceType: aws.String("c6g.large"),
						LaunchTemplateSpecification: &autoscaling.LaunchTemplateSpecification{
							LaunchTemplateName: aws.String("my-launch-template-for-arm"),
							Version:            aws.String("$Default"),
						},
					},
					{
						InstanceType: aws.String("c5.large"),
					},
					{
						InstanceType: aws.String("c5a.large"),
					},
				},
			},
		},
		VPCZoneIdentifier: aws.String("subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE"),
	}

	result, err := svc.CreateAutoScalingGroup(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeAlreadyExistsFault:
				fmt.Println(autoscaling.ErrCodeAlreadyExistsFault, aerr.Error())
			case autoscaling.ErrCodeLimitExceededFault:
				fmt.Println(autoscaling.ErrCodeLimitExceededFault, aerr.Error())
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

Example (Shared03)

To create an Auto Scaling group using attribute-based instance type selection This example creates an Auto Scaling group using attribute-based instance type selection. It requires the instance types to have a minimum of four vCPUs and a maximum of eight vCPUs, a minimum of 16,384 MiB of memory, and an Intel manufactured CPU.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CreateAutoScalingGroupInput{
		AutoScalingGroupName: aws.String("my-asg"),
		DesiredCapacity:      aws.Int64(4),
		DesiredCapacityType:  aws.String("units"),
		MaxSize:              aws.Int64(100),
		MinSize:              aws.Int64(0),
		MixedInstancesPolicy: &autoscaling.MixedInstancesPolicy{
			InstancesDistribution: &autoscaling.InstancesDistribution{
				OnDemandPercentageAboveBaseCapacity: aws.Int64(50),
				SpotAllocationStrategy:              aws.String("price-capacity-optimized"),
			},
			LaunchTemplate: &autoscaling.LaunchTemplate{
				LaunchTemplateSpecification: &autoscaling.LaunchTemplateSpecification{
					LaunchTemplateName: aws.String("my-template-for-auto-scaling"),
					Version:            aws.String("$Default"),
				},
				Overrides: []*autoscaling.LaunchTemplateOverrides{
					{
						InstanceRequirements: &autoscaling.InstanceRequirements{
							CpuManufacturers: []*string{
								aws.String("intel"),
							},
							MemoryMiB: &autoscaling.MemoryMiBRequest{
								Min: aws.Int64(16384),
							},
							VCpuCount: &autoscaling.VCpuCountRequest{
								Max: aws.Int64(8),
								Min: aws.Int64(4),
							},
						},
					},
				},
			},
		},
		VPCZoneIdentifier: aws.String("subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE"),
	}

	result, err := svc.CreateAutoScalingGroup(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeAlreadyExistsFault:
				fmt.Println(autoscaling.ErrCodeAlreadyExistsFault, aerr.Error())
			case autoscaling.ErrCodeLimitExceededFault:
				fmt.Println(autoscaling.ErrCodeLimitExceededFault, aerr.Error())
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeServiceLinkedRoleFailure:
				fmt.Println(autoscaling.ErrCodeServiceLinkedRoleFailure, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) CreateAutoScalingGroupRequest

func (c *AutoScaling) CreateAutoScalingGroupRequest(input *CreateAutoScalingGroupInput) (req *request.Request, output *CreateAutoScalingGroupOutput)

CreateAutoScalingGroupRequest generates a "aws/request.Request" representing the client's request for the CreateAutoScalingGroup operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateAutoScalingGroup for more information on using the CreateAutoScalingGroup API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateAutoScalingGroupRequest method.
req, resp := client.CreateAutoScalingGroupRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateAutoScalingGroup

func (*AutoScaling) CreateAutoScalingGroupWithContext added in v1.8.0

func (c *AutoScaling) CreateAutoScalingGroupWithContext(ctx aws.Context, input *CreateAutoScalingGroupInput, opts ...request.Option) (*CreateAutoScalingGroupOutput, error)

CreateAutoScalingGroupWithContext is the same as CreateAutoScalingGroup with the addition of the ability to pass a context and additional request options.

See CreateAutoScalingGroup for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) CreateLaunchConfiguration

func (c *AutoScaling) CreateLaunchConfiguration(input *CreateLaunchConfigurationInput) (*CreateLaunchConfigurationOutput, error)

CreateLaunchConfiguration API operation for Auto Scaling.

Creates a launch configuration.

If you exceed your maximum limit of launch configurations, the call fails. To query this limit, call the DescribeAccountLimits API. For information about updating this limit, see Quotas for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-quotas.html) in the Amazon EC2 Auto Scaling User Guide.

For more information, see Launch configurations (https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-configurations.html) in the Amazon EC2 Auto Scaling User Guide.

Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a launch template or a launch configuration. We strongly recommend that you do not use launch configurations. They do not provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For information about using launch templates, see Launch templates (https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-templates.html) in the Amazon EC2 Auto Scaling User Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation CreateLaunchConfiguration for usage and error information.

Returned Error Codes:

  • ErrCodeAlreadyExistsFault "AlreadyExists" You already have an Auto Scaling group or launch configuration with this name.

  • ErrCodeLimitExceededFault "LimitExceeded" You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) in the Amazon EC2 Auto Scaling API Reference.

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateLaunchConfiguration

Example (Shared00)

To create a launch configuration This example creates a launch configuration.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CreateLaunchConfigurationInput{
		IamInstanceProfile:      aws.String("my-iam-role"),
		ImageId:                 aws.String("ami-12345678"),
		InstanceType:            aws.String("m3.medium"),
		LaunchConfigurationName: aws.String("my-launch-config"),
		SecurityGroups: []*string{
			aws.String("sg-eb2af88e"),
		},
	}

	result, err := svc.CreateLaunchConfiguration(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeAlreadyExistsFault:
				fmt.Println(autoscaling.ErrCodeAlreadyExistsFault, aerr.Error())
			case autoscaling.ErrCodeLimitExceededFault:
				fmt.Println(autoscaling.ErrCodeLimitExceededFault, aerr.Error())
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output:

func (*AutoScaling) CreateLaunchConfigurationRequest

func (c *AutoScaling) CreateLaunchConfigurationRequest(input *CreateLaunchConfigurationInput) (req *request.Request, output *CreateLaunchConfigurationOutput)

CreateLaunchConfigurationRequest generates a "aws/request.Request" representing the client's request for the CreateLaunchConfiguration operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateLaunchConfiguration for more information on using the CreateLaunchConfiguration API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateLaunchConfigurationRequest method.
req, resp := client.CreateLaunchConfigurationRequest(params)

err := req.Send()
if err == nil { // resp is now filled
    fmt.Println(resp)
}

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateLaunchConfiguration

func (*AutoScaling) CreateLaunchConfigurationWithContext added in v1.8.0

func (c *AutoScaling) CreateLaunchConfigurationWithContext(ctx aws.Context, input *CreateLaunchConfigurationInput, opts ...request.Option) (*CreateLaunchConfigurationOutput, error)

CreateLaunchConfigurationWithContext is the same as CreateLaunchConfiguration with the addition of the ability to pass a context and additional request options.

See CreateLaunchConfiguration for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

func (*AutoScaling) CreateOrUpdateTags

func (c *AutoScaling) CreateOrUpdateTags(input *CreateOrUpdateTagsInput) (*CreateOrUpdateTagsOutput, error)

CreateOrUpdateTags API operation for Auto Scaling.

Creates or updates tags for the specified Auto Scaling group.

When you specify a tag with a key that already exists, the operation overwrites the previous tag definition, and you do not get an error message.

For more information, see Tag Auto Scaling groups and instances (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html) in the Amazon EC2 Auto Scaling User Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Auto Scaling's API operation CreateOrUpdateTags for usage and error information.

Returned Error Codes:

  • ErrCodeLimitExceededFault "LimitExceeded" You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html) in the Amazon EC2 Auto Scaling API Reference.

  • ErrCodeAlreadyExistsFault "AlreadyExists" You already have an Auto Scaling group or launch configuration with this name.

  • ErrCodeResourceContentionFault "ResourceContention" You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ErrCodeResourceInUseFault "ResourceInUse" The operation can't be performed because the resource is in use.

See also, https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateOrUpdateTags

Example (Shared00)

To create or update tags for an Auto Scaling group This example adds two tags to the specified Auto Scaling group.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/autoscaling"
)

func main() {
	svc := autoscaling.New(session.New())
	input := &autoscaling.CreateOrUpdateTagsInput{
		Tags: []*autoscaling.Tag{
			{
				Key:               aws.String("Role"),
				PropagateAtLaunch: aws.Bool(true),
				ResourceId:        aws.String("my-auto-scaling-group"),
				ResourceType:      aws.String("auto-scaling-group"),
				Value:             aws.String("WebServer"),
			},
			{
				Key:               aws.String("Dept"),
				PropagateAtLaunch: aws.Bool(true),
				ResourceId:        aws.String("my-auto-scaling-group"),
				ResourceType:      aws.String("auto-scaling-group"),
				Value:             aws.String("Research"),
			},
		},
	}

	result, err := svc.CreateOrUpdateTags(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			switch aerr.Code() {
			case autoscaling.ErrCodeLimitExceededFault:
				fmt.Println(autoscaling.ErrCodeLimitExceededFault, aerr.Error())
			case autoscaling.ErrCodeAlreadyExistsFault:
				fmt.Println(autoscaling.ErrCodeAlreadyExistsFault, aerr.Error())
			case autoscaling.ErrCodeResourceContentionFault:
				fmt.Println(autoscaling.ErrCodeResourceContentionFault, aerr.Error())
			case autoscaling.ErrCodeResourceInUseFault:
				fmt.Println(autoscaling.ErrCodeResourceInUseFault, aerr.Error())
			default:
				fmt.Println(aerr.Error())
			}
		} else {
			// Print the error, cast err to awserr.Error to get the Code and
			// Message from an error.
			fmt.Println(err.Error())
		}
		return
	}

	fmt.Println(result)
}
Output: