Copyright | (c) 2013-2016 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay@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 in the Auto Scaling Developer Guide.
If you exceed your maximum limit of lifecycle hooks, which by default is 50 per region, the call fails. For information about updating this limit, see AWS Service Limits in the Amazon Web Services General Reference.
- 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:
data PutLifecycleHook Source
See: putLifecycleHook
smart constructor.
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 amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the default action. You can prevent the lifecycle hook from timing out by calling RecordLifecycleActionHeartbeat. The default is 3600 seconds (1 hour).
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.
The notification messages sent to the target include the following information:
- AutoScalingGroupName. The name of the Auto Scaling group.
- AccountId. The AWS account ID.
- LifecycleTransition. The lifecycle hook type.
- LifecycleActionToken. The lifecycle action token.
- EC2InstanceId. The EC2 instance ID.
- LifecycleHookName. The name of the lifecycle hook.
- NotificationMetadata. User-defined information.
This operation uses the JSON format when sending notifications to an Amazon SQS queue, and an email key/value 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 key/value 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 to which you want to assign the lifecycle hook.
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:
data PutLifecycleHookResponse Source
See: putLifecycleHookResponse
smart constructor.
Response Lenses
plhrsResponseStatus :: Lens' PutLifecycleHookResponse Int Source
The response status code.