Copyright | (c) 2013-2018 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Creates or updates a lifecycle hook for the specified Auto Scaling Group.
A lifecycle hook tells Auto Scaling that you want to perform an action on an instance that is not actively in service; for example, either when the instance launches or before the instance terminates.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
- (Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Auto Scaling launches or terminates instances.
- (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 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 pending state.
- If you finish before the timeout period ends, complete the lifecycle action.
For more information, see Auto Scaling Lifecycle Hooks in the Auto Scaling User Guide .
If you exceed your maximum limit of lifecycle hooks, which by default is 50 per Auto Scaling group, the call fails. For information about updating this limit, see AWS Service Limits in the Amazon Web Services General Reference .
Synopsis
- putLifecycleHook :: Text -> Text -> PutLifecycleHook
- data PutLifecycleHook
- plhDefaultResult :: Lens' PutLifecycleHook (Maybe Text)
- plhHeartbeatTimeout :: Lens' PutLifecycleHook (Maybe Int)
- plhNotificationMetadata :: Lens' PutLifecycleHook (Maybe Text)
- plhNotificationTargetARN :: Lens' PutLifecycleHook (Maybe Text)
- plhLifecycleTransition :: Lens' PutLifecycleHook (Maybe Text)
- plhRoleARN :: Lens' PutLifecycleHook (Maybe Text)
- plhLifecycleHookName :: Lens' PutLifecycleHook Text
- plhAutoScalingGroupName :: Lens' PutLifecycleHook Text
- putLifecycleHookResponse :: Int -> PutLifecycleHookResponse
- data PutLifecycleHookResponse
- plhrsResponseStatus :: Lens' PutLifecycleHookResponse Int
Creating a Request
Creates a value of PutLifecycleHook
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
plhDefaultResult
- Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. This parameter can be eitherCONTINUE
orABANDON
. The default value isABANDON
.plhHeartbeatTimeout
- The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default is 3600 seconds (1 hour). If the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by callingRecordLifecycleActionHeartbeat
.plhNotificationMetadata
- Contains additional information that you want to include any time Auto Scaling sends a message to the notification target.plhNotificationTargetARN
- The ARN of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic. If you specify an empty string, this overrides the current ARN. This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email keyvalue pair format when sending notifications to an Amazon SNS topic. When you specify a notification target, Auto Scaling sends it a test message. Test messages contains the following additional keyvalue pair:Event: "autoscaling:TEST_NOTIFICATION"
.plhLifecycleTransition
- The instance state to which you want to attach the lifecycle hook. For a list of lifecycle hook types, seeDescribeLifecycleHookTypes
. This parameter is required for new lifecycle hooks, but optional when updating existing hooks.plhRoleARN
- The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. This parameter is required for new lifecycle hooks, but optional when updating existing hooks.plhLifecycleHookName
- The name of the lifecycle hook.plhAutoScalingGroupName
- The name of the Auto Scaling group.
data PutLifecycleHook Source #
See: putLifecycleHook
smart constructor.
Instances
Request Lenses
plhDefaultResult :: Lens' PutLifecycleHook (Maybe Text) Source #
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. This parameter can be either CONTINUE
or ABANDON
. The default value is ABANDON
.
plhHeartbeatTimeout :: Lens' PutLifecycleHook (Maybe Int) Source #
The maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from 30 to 7200 seconds. The default is 3600 seconds (1 hour). If the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat
.
plhNotificationMetadata :: Lens' PutLifecycleHook (Maybe Text) Source #
Contains additional information that you want to include any time Auto Scaling sends a message to the notification target.
plhNotificationTargetARN :: Lens' PutLifecycleHook (Maybe Text) Source #
The ARN of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an SQS queue or an SNS topic. If you specify an empty string, this overrides the current ARN. This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email keyvalue pair format when sending notifications to an Amazon SNS topic. When you specify a notification target, Auto Scaling sends it a test message. Test messages contains the following additional keyvalue pair: Event: "autoscaling:TEST_NOTIFICATION"
.
plhLifecycleTransition :: Lens' PutLifecycleHook (Maybe Text) Source #
The instance state to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see DescribeLifecycleHookTypes
. This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
plhRoleARN :: Lens' PutLifecycleHook (Maybe Text) Source #
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. This parameter is required for new lifecycle hooks, but optional when updating existing hooks.
plhLifecycleHookName :: Lens' PutLifecycleHook Text Source #
The name of the lifecycle hook.
plhAutoScalingGroupName :: Lens' PutLifecycleHook Text Source #
The name of the Auto Scaling group.
Destructuring the Response
putLifecycleHookResponse Source #
Creates a value of PutLifecycleHookResponse
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
plhrsResponseStatus
- -- | The response status code.
data PutLifecycleHookResponse Source #
See: putLifecycleHookResponse
smart constructor.
Instances
Response Lenses
plhrsResponseStatus :: Lens' PutLifecycleHookResponse Int Source #
- - | The response status code.