debug log attached:
2017-12-30 22:13:46,474 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.14.9 Python/3.6.3 Darwin/16.7.0 botocore/1.8.13
2017-12-30 22:13:46,475 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['autoscaling', 'put-lifecycle-hook', '--lifecycle-hook-name', 'my-hook', '--auto-scaling-group-name', 'drain-test-EcsInstanceAsg-6TJ96189ZKY3', '--lifecycle-transition', 'autoscaling:EC2_INSTANCE_TERMINATING', '--notification-target-arn', 'arn:aws-cn:sns:cn-north-1:157197624774:drain-test-ASGSNSTopic-C9V6GOPIDIN7', '--role-arn', 'arn:aws-cn:iam::157197624774:role/drain-test-SNSLambdaRole-1EPINIZB33OMT', '--debug']
2017-12-30 22:13:46,475 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x1057f4378>
2017-12-30 22:13:46,475 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,476 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x1052ff840>
2017-12-30 22:13:46,476 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,476 - MainThread - botocore.session - DEBUG - Loading variable credentials_file from defaults.
2017-12-30 22:13:46,476 - MainThread - botocore.session - DEBUG - Loading variable config_file from defaults.
2017-12-30 22:13:46,476 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,476 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_timeout from defaults.
2017-12-30 22:13:46,476 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,476 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_num_attempts from defaults.
2017-12-30 22:13:46,477 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,477 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x1056a8d90>
2017-12-30 22:13:46,477 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,477 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,478 - MainThread - botocore.session - DEBUG - Loading variable api_versions from defaults.
2017-12-30 22:13:46,478 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python3.6/site-packages/botocore/data/autoscaling/2011-01-01/service-2.json
2017-12-30 22:13:46,482 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.autoscaling: calling handler <function register_retries_for_service at 0x104e180d0>
2017-12-30 22:13:46,482 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: autoscaling
2017-12-30 22:13:46,484 - MainThread - botocore.hooks - DEBUG - Event building-command-table.autoscaling: calling handler <function add_waiters at 0x1057fd620>
2017-12-30 22:13:46,490 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('lifecycle-hook-name', <awscli.arguments.CLIArgument object at 0x1059abdd8>), ('auto-scaling-group-name', <awscli.arguments.CLIArgument object at 0x1059abe10>), ('lifecycle-transition', <awscli.arguments.CLIArgument object at 0x1059abe48>), ('role-arn', <awscli.arguments.CLIArgument object at 0x1059abeb8>), ('notification-target-arn', <awscli.arguments.CLIArgument object at 0x1059a3320>), ('notification-metadata', <awscli.arguments.CLIArgument object at 0x1059abe80>), ('heartbeat-timeout', <awscli.arguments.CLIArgument object at 0x1059abf98>), ('default-result', <awscli.arguments.CLIArgument object at 0x1059b4048>)])
2017-12-30 22:13:46,490 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.put-lifecycle-hook: calling handler <function add_streaming_output_arg at 0x1057f48c8>
2017-12-30 22:13:46,490 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.put-lifecycle-hook: calling handler <function add_cli_input_json at 0x105302048>
2017-12-30 22:13:46,490 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.put-lifecycle-hook: calling handler <function unify_paging_params at 0x105778d08>
2017-12-30 22:13:46,501 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python3.6/site-packages/botocore/data/autoscaling/2011-01-01/paginators-1.json
2017-12-30 22:13:46,502 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.put-lifecycle-hook: calling handler <function add_generate_skeleton at 0x10575e620>
2017-12-30 22:13:46,502 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.autoscaling.put-lifecycle-hook: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x1059b40b8>>
2017-12-30 22:13:46,502 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.autoscaling.put-lifecycle-hook: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1059b40f0>>
2017-12-30 22:13:46,504 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.lifecycle-hook-name: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,504 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.autoscaling.put-lifecycle-hook: calling handler <awscli.argprocess.ParamShorthandParser object at 0x1052c7860>
2017-12-30 22:13:46,504 - MainThread - awscli.arguments - DEBUG - Unpacked value of 'my-hook' for parameter "lifecycle_hook_name": 'my-hook'
2017-12-30 22:13:46,504 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.auto-scaling-group-name: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,504 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.autoscaling.put-lifecycle-hook: calling handler <awscli.argprocess.ParamShorthandParser object at 0x1052c7860>
2017-12-30 22:13:46,504 - MainThread - awscli.arguments - DEBUG - Unpacked value of 'drain-test-EcsInstanceAsg-6TJ96189ZKY3' for parameter "auto_scaling_group_name": 'drain-test-EcsInstanceAsg-6TJ96189ZKY3'
2017-12-30 22:13:46,504 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.lifecycle-transition: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,504 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.autoscaling.put-lifecycle-hook: calling handler <awscli.argprocess.ParamShorthandParser object at 0x1052c7860>
2017-12-30 22:13:46,505 - MainThread - awscli.arguments - DEBUG - Unpacked value of 'autoscaling:EC2_INSTANCE_TERMINATING' for parameter "lifecycle_transition": 'autoscaling:EC2_INSTANCE_TERMINATING'
2017-12-30 22:13:46,505 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.role-arn: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,505 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.autoscaling.put-lifecycle-hook: calling handler <awscli.argprocess.ParamShorthandParser object at 0x1052c7860>
2017-12-30 22:13:46,505 - MainThread - awscli.arguments - DEBUG - Unpacked value of 'arn:aws-cn:iam::157197624774:role/drain-test-SNSLambdaRole-1EPINIZB33OMT' for parameter "role_arn": 'arn:aws-cn:iam::157197624774:role/drain-test-SNSLambdaRole-1EPINIZB33OMT'
2017-12-30 22:13:46,505 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.notification-target-arn: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,505 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.autoscaling.put-lifecycle-hook: calling handler <awscli.argprocess.ParamShorthandParser object at 0x1052c7860>
2017-12-30 22:13:46,505 - MainThread - awscli.arguments - DEBUG - Unpacked value of 'arn:aws-cn:sns:cn-north-1:157197624774:drain-test-ASGSNSTopic-C9V6GOPIDIN7' for parameter "notification_target_arn": 'arn:aws-cn:sns:cn-north-1:157197624774:drain-test-ASGSNSTopic-C9V6GOPIDIN7'
2017-12-30 22:13:46,505 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.notification-metadata: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,505 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.heartbeat-timeout: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,505 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.default-result: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,506 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.cli-input-json: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,506 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.put-lifecycle-hook.generate-cli-skeleton: calling handler <function uri_param at 0x10528ce18>
2017-12-30 22:13:46,506 - MainThread - botocore.hooks - DEBUG - Event calling-command.autoscaling.put-lifecycle-hook: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x1059b40b8>>
2017-12-30 22:13:46,506 - MainThread - botocore.hooks - DEBUG - Event calling-command.autoscaling.put-lifecycle-hook: calling handler <bound method GenerateCliSkeletonArgument.generate_json_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1059b40f0>>
2017-12-30 22:13:46,506 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,506 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,506 - MainThread - botocore.session - DEBUG - Loading variable region from config file with value 'cn-north-1'.
2017-12-30 22:13:46,506 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,506 - MainThread - botocore.session - DEBUG - Loading variable ca_bundle from defaults.
2017-12-30 22:13:46,506 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,506 - MainThread - botocore.session - DEBUG - Loading variable api_versions from defaults.
2017-12-30 22:13:46,507 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2017-12-30 22:13:46,507 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2017-12-30 22:13:46,509 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2017-12-30 22:13:46,511 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2017-12-30 22:13:46,512 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/lib/python3.6/site-packages/botocore/data/endpoints.json
2017-12-30 22:13:46,515 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2017-12-30 22:13:46,515 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x104e00400>
2017-12-30 22:13:46,519 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.autoscaling: calling handler <function add_generate_presigned_url at 0x104d96f28>
2017-12-30 22:13:46,521 - MainThread - botocore.args - DEBUG - The s3 config key is not a dictionary type, ignoring its value of: None
2017-12-30 22:13:46,536 - MainThread - botocore.endpoint - DEBUG - Setting autoscaling timeout as (60, 60)
2017-12-30 22:13:46,536 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: autoscaling
2017-12-30 22:13:46,537 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.autoscaling.PutLifecycleHook: calling handler <function generate_idempotent_uuid at 0x104e139d8>
2017-12-30 22:13:46,537 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=PutLifecycleHook) (verify_ssl=True) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': 'aws-cli/1.14.9 Python/3.6.3 Darwin/16.7.0 botocore/1.8.13'}, 'body': {'Action': 'PutLifecycleHook', 'Version': '2011-01-01', 'LifecycleHookName': 'my-hook', 'AutoScalingGroupName': 'drain-test-EcsInstanceAsg-6TJ96189ZKY3', 'LifecycleTransition': 'autoscaling:EC2_INSTANCE_TERMINATING', 'RoleARN': 'arn:aws-cn:iam::157197624774:role/drain-test-SNSLambdaRole-1EPINIZB33OMT', 'NotificationTargetARN': 'arn:aws-cn:sns:cn-north-1:157197624774:drain-test-ASGSNSTopic-C9V6GOPIDIN7'}, 'url': 'https://autoscaling.cn-north-1.amazonaws.com.cn/', 'context': {'client_region': 'cn-north-1', 'client_config': <botocore.config.Config object at 0x105a6cf28>, 'has_streaming_input': False, 'auth_type': None}}
2017-12-30 22:13:46,537 - MainThread - botocore.hooks - DEBUG - Event request-created.autoscaling.PutLifecycleHook: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x105a6ce10>>
2017-12-30 22:13:46,537 - MainThread - botocore.hooks - DEBUG - Event choose-signer.autoscaling.PutLifecycleHook: calling handler <function set_operation_specific_signer at 0x104e138c8>
2017-12-30 22:13:46,538 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2017-12-30 22:13:46,538 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/
content-type:application/x-www-form-urlencoded; charset=utf-8
host:autoscaling.cn-north-1.amazonaws.com.cn
x-amz-date:20171230T141346Z
content-type;host;x-amz-date
dac71e31547c0406fbe5f9b0a25c0cbea1685f6222b5d84728a5c66e6c9df674
2017-12-30 22:13:46,538 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20171230T141346Z
20171230/cn-north-1/autoscaling/aws4_request
404656a0fac924bedb409a3e87e707d16fe270756723c8f1c94100ae87f43ec6
2017-12-30 22:13:46,539 - MainThread - botocore.auth - DEBUG - Signature:
c197cc793db4b313fa053d983ff7ae8fcb4145dbbcd98944484d851754253a21
2017-12-30 22:13:46,541 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [POST]>
2017-12-30 22:13:46,542 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): autoscaling.cn-north-1.amazonaws.com.cn
2017-12-30 22:13:46,942 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "POST / HTTP/1.1" 400 556
2017-12-30 22:13:46,947 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-requestid': 'a4ef28f8-ed6b-11e7-8518-77f8caf04164', 'content-type': 'text/xml', 'content-length': '556', 'date': 'Sat, 30 Dec 2017 14:13:43 GMT', 'connection': 'close'}
2017-12-30 22:13:46,947 - MainThread - botocore.parsers - DEBUG - Response body:
b'\n \n Sender\n ValidationError
\n Unable to publish test message to notification target arn:aws-cn:sns:cn-north-1:157197624774:drain-test-ASGSNSTopic-C9V6GOPIDIN7 using IAM role arn:aws-cn:iam::157197624774:role/drain-test-SNSLambdaRole-1EPINIZB33OMT. Please check your target and role configuration and try to put lifecycle hook again.\n \n a4ef28f8-ed6b-11e7-8518-77f8caf04164\n\n'
2017-12-30 22:13:46,947 - MainThread - botocore.hooks - DEBUG - Event needs-retry.autoscaling.PutLifecycleHook: calling handler <botocore.retryhandler.RetryHandler object at 0x1058b2ef0>
2017-12-30 22:13:46,947 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2017-12-30 22:13:46,949 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/awscli/clidriver.py", line 207, in main
return command_table[parsed_args.command](remaining, parsed_args)
File "/usr/local/lib/python3.6/site-packages/awscli/clidriver.py", line 347, in call
return command_table[parsed_args.operation](remaining, parsed_globals)
File "/usr/local/lib/python3.6/site-packages/awscli/clidriver.py", line 519, in call
call_parameters, parsed_globals)
File "/usr/local/lib/python3.6/site-packages/awscli/clidriver.py", line 639, in invoke
client, operation_name, parameters, parsed_globals)
File "/usr/local/lib/python3.6/site-packages/awscli/clidriver.py", line 651, in _make_client_call
**parameters)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 317, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 615, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the PutLifecycleHook operation: Unable to publish test message to notification target arn:aws-cn:sns:cn-north-1:157197624774:drain-test-ASGSNSTopic-C9V6GOPIDIN7 using IAM role arn:aws-cn:iam::157197624774:role/drain-test-SNSLambdaRole-1EPINIZB33OMT. Please check your target and role configuration and try to put lifecycle hook again.
2017-12-30 22:13:46,953 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
An error occurred (ValidationError) when calling the PutLifecycleHook operation: Unable to publish test message to notification target arn:aws-cn:sns:cn-north-1:157197624774:drain-test-ASGSNSTopic-C9V6GOPIDIN7 using IAM role arn:aws-cn:iam::157197624774:role/drain-test-SNSLambdaRole-1EPINIZB33OMT. Please check your target and role configuration and try to put lifecycle hook again.