aws автоматическое масштабирование целевых-групп, балансировщика нагрузки и присоединения - PullRequest
1 голос
/ 06 мая 2020

Добрый день. Я пытаюсь добавить экземпляр в целевую группу, как написано в руководстве aws: https://docs.aws.amazon.com/cli/latest/reference/autoscaling/attach-load-balancer-target-groups.html, но по какой-то причине это не работает. aws cli

aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name awseb-e-txwhwjxk75-stack-AWSEBAutoScalingGroup-14CH3JZ6DNIPT --target-group-arns arn:aws:elasticloadbalancing:eu-central-1:063129209410:targetgroup/aifit-cc-qa/d9d8c7a85f2ea7df

Экземпляр не добавляется, в консоли ошибок нет:

 aws cli version - aws-cli/1.18.52 Python/3.6.9 Linux/5.3.0-51-generic botocore/1.16.2


UPD. debug `root@HP:/home/bell# aws --version
aws-cli/2.0.10 Python/3.7.3 Linux/5.3.0-51-generic botocore/2.0.0dev14
root@HP:/home/bell# aws --debug autoscaling attach-load-balancer-target-groups --auto-scaling-group-name awseb-e-txwhwjxk75-stack-AWSEBAutoScalingGroup-14CH3JZ6DNIPT --target-group-arns arn:aws:elasticloadbalancing:eu-central-1:063129209410:targetgroup/aifit-cc-qa/d9d8c7a85f2ea7df
2020-05-06 10:31:19,636 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.0.10 Python/3.7.3 Linux/5.3.0-51-generic botocore/2.0.0dev14
2020-05-06 10:31:19,641 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['--debug', 'autoscaling', 'attach-load-balancer-target-groups', '--auto-scaling-group-name', 'awseb-e-txwhwjxk75-stack-AWSEBAutoScalingGroup-14CH3JZ6DNIPT', '--target-group-arns', 'arn:aws:elasticloadbalancing:eu-central-1:063129209410:targetgroup/aifit-cc-qa/d9d8c7a85f2ea7df']
2020-05-06 10:31:19,641 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x7f18da53b158>
2020-05-06 10:31:19,641 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x7f18dae1d400>
2020-05-06 10:31:19,642 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x7f18da502620>
2020-05-06 10:31:19,644 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7f18dae45400>
2020-05-06 10:31:19,646 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x7f18da685bf8>
2020-05-06 10:31:19,646 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x7f18da6bd598>
2020-05-06 10:31:19,662 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.0.10/dist/botocore/data/autoscaling/2011-01-01/service-2.json
2020-05-06 10:31:19,673 - MainThread - botocore.hooks - DEBUG - Event building-command-table.autoscaling: calling handler <function add_waiters at 0x7f18da546598>
2020-05-06 10:31:19,680 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('auto-scaling-group-name', <awscli.arguments.CLIArgument object at 0x7f18da38c0b8>), ('target-group-arns', <awscli.arguments.ListArgument object at 0x7f18da391780>)])
2020-05-06 10:31:19,680 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.attach-load-balancer-target-groups: calling handler <function add_streaming_output_arg at 0x7f18da53b400>
2020-05-06 10:31:19,680 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.attach-load-balancer-target-groups: calling handler <function add_cli_input_json at 0x7f18dae45bf8>
2020-05-06 10:31:19,680 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.attach-load-balancer-target-groups: calling handler <function add_cli_input_yaml at 0x7f18dae512f0>
2020-05-06 10:31:19,680 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.attach-load-balancer-target-groups: calling handler <function unify_paging_params at 0x7f18da6bed08>
2020-05-06 10:31:19,686 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.0.10/dist/botocore/data/autoscaling/2011-01-01/paginators-1.json
2020-05-06 10:31:19,687 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.attach-load-balancer-target-groups: calling handler <function add_generate_skeleton at 0x7f18da59c9d8>
2020-05-06 10:31:19,687 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.autoscaling.attach-load-balancer-target-groups: calling handler <function add_auto_prompt at 0x7f18da502598>
2020-05-06 10:31:19,687 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.autoscaling.attach-load-balancer-target-groups: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x7f18da3917b8>>
2020-05-06 10:31:19,687 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.autoscaling.attach-load-balancer-target-groups: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x7f18da3918d0>>
2020-05-06 10:31:19,687 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.autoscaling.attach-load-balancer-target-groups: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7f18da391940>>
2020-05-06 10:31:19,687 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.autoscaling.attach-load-balancer-target-groups: calling handler <bound method AutoPromptArgument.override_required_args of <awscli.customizations.autoprompt.AutoPromptArgument object at 0x7f18da393e10>>
2020-05-06 10:31:19,693 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.attach-load-balancer-target-groups.auto-scaling-group-name: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f18da47ffd0>
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.autoscaling.attach-load-balancer-target-groups: calling handler <awscli.argprocess.ParamShorthandParser object at 0x7f18dae92dd8>
2020-05-06 10:31:19,694 - MainThread - awscli.arguments - DEBUG - Unpacked value of 'awseb-e-txwhwjxk75-stack-AWSEBAutoScalingGroup-14CH3JZ6DNIPT' for parameter "auto_scaling_group_name": 'awseb-e-txwhwjxk75-stack-AWSEBAutoScalingGroup-14CH3JZ6DNIPT'
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.attach-load-balancer-target-groups.target-group-arns: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f18da47ffd0>
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.autoscaling.attach-load-balancer-target-groups: calling handler <awscli.argprocess.ParamShorthandParser object at 0x7f18dae92dd8>
2020-05-06 10:31:19,694 - MainThread - awscli.arguments - DEBUG - Unpacked value of ['arn:aws:elasticloadbalancing:eu-central-1:063129209410:targetgroup/aifit-cc-qa/d9d8c7a85f2ea7df'] for parameter "target_group_arns": ['arn:aws:elasticloadbalancing:eu-central-1:063129209410:targetgroup/aifit-cc-qa/d9d8c7a85f2ea7df']
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.attach-load-balancer-target-groups.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f18da47ffd0>
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.attach-load-balancer-target-groups.cli-input-yaml: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f18da47ffd0>
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.attach-load-balancer-target-groups.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f18da47ffd0>
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.autoscaling.attach-load-balancer-target-groups.cli-auto-prompt: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f18da47ffd0>
2020-05-06 10:31:19,694 - MainThread - botocore.hooks - DEBUG - Event calling-command.autoscaling.attach-load-balancer-target-groups: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x7f18da3917b8>>
2020-05-06 10:31:19,695 - MainThread - botocore.hooks - DEBUG - Event calling-command.autoscaling.attach-load-balancer-target-groups: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x7f18da3918d0>>
2020-05-06 10:31:19,695 - MainThread - botocore.hooks - DEBUG - Event calling-command.autoscaling.attach-load-balancer-target-groups: calling handler <bound method GenerateCliSkeletonArgument.generate_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x7f18da391940>>
2020-05-06 10:31:19,695 - MainThread - botocore.hooks - DEBUG - Event calling-command.autoscaling.attach-load-balancer-target-groups: calling handler <bound method AutoPromptArgument.auto_prompt_arguments of <awscli.customizations.autoprompt.AutoPromptArgument object at 0x7f18da393e10>>
2020-05-06 10:31:19,695 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2020-05-06 10:31:19,695 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2020-05-06 10:31:19,695 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role-with-web-identity
2020-05-06 10:31:19,695 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: sso
2020-05-06 10:31:19,695 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2020-05-06 10:31:19,696 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2020-05-06 10:31:19,697 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.0.10/dist/botocore/data/endpoints.json
2020-05-06 10:31:19,705 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f18dbe3a7b8>
2020-05-06 10:31:19,708 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.auto-scaling: calling handler <function add_generate_presigned_url at 0x7f18dbe8c6a8>
2020-05-06 10:31:19,712 - MainThread - botocore.endpoint - DEBUG - Setting autoscaling timeout as (60, 60)
2020-05-06 10:31:19,713 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.auto-scaling.AttachLoadBalancerTargetGroups: calling handler <function base64_decode_input_blobs at 0x7f18da502e18>
2020-05-06 10:31:19,713 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.auto-scaling.AttachLoadBalancerTargetGroups: calling handler <function generate_idempotent_uuid at 0x7f18dbe5b6a8>
2020-05-06 10:31:19,713 - MainThread - botocore.hooks - DEBUG - Event before-call.auto-scaling.AttachLoadBalancerTargetGroups: calling handler <function inject_api_version_header_if_needed at 0x7f18dbe5e0d0>
2020-05-06 10:31:19,713 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=AttachLoadBalancerTargetGroups) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': 'aws-cli/2.0.10 Python/3.7.3 Linux/5.3.0-51-generic botocore/2.0.0dev14'}, 'body': {'Action': 'AttachLoadBalancerTargetGroups', 'Version': '2011-01-01', 'AutoScalingGroupName': 'awseb-e-txwhwjxk75-stack-AWSEBAutoScalingGroup-14CH3JZ6DNIPT', 'TargetGroupARNs.member.1': 'arn:aws:elasticloadbalancing:eu-central-1:063129209410:targetgroup/aifit-cc-qa/d9d8c7a85f2ea7df'}, 'url': 'https://autoscaling.eu-central-1.amazonaws.com/', 'context': {'client_region': 'eu-central-1', 'client_config': <botocore.config.Config object at 0x7f18da18b0b8>, 'has_streaming_input': False, 'auth_type': None}}
2020-05-06 10:31:19,713 - MainThread - botocore.hooks - DEBUG - Event request-created.auto-scaling.AttachLoadBalancerTargetGroups: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f18da18b048>>
2020-05-06 10:31:19,713 - MainThread - botocore.hooks - DEBUG - Event choose-signer.auto-scaling.AttachLoadBalancerTargetGroups: calling handler <function set_operation_specific_signer at 0x7f18dbe5b598>
2020-05-06 10:31:19,714 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2020-05-06 10:31:19,714 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/

content-type:application/x-www-form-urlencoded; charset=utf-8
host:autoscaling.eu-central-1.amazonaws.com
x-amz-date:20200506T073119Z

content-type;host;x-amz-date
ba70ad1394364a129f19ff772f06863a805d1770a9d72bbe0d42ca38ba9d468c
2020-05-06 10:31:19,714 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20200506T073119Z
20200506/eu-central-1/autoscaling/aws4_request
a79a67df4af15c410777059b1d48efd8e81573ed093ed5d0b6e66b05d407d6c0
2020-05-06 10:31:19,714 - MainThread - botocore.auth - DEBUG - Signature:
9160bb5484cfe8669fbbd172ccd599f1927c90590915df875d393c3aae40c6d5
2020-05-06 10:31:19,714 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://autoscaling.eu-central-1.amazonaws.com/, headers={'Content-Type': b'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': b'aws-cli/2.0.10 Python/3.7.3 Linux/5.3.0-51-generic botocore/2.0.0dev14', 'X-Amz-Date': b'20200506T073119Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIAQ5MWLJJBJRFYEGVQ/20200506/eu-central-1/autoscaling/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=9160bb5484cfe8669fbbd172ccd599f1927c90590915df875d393c3aae40c6d5', 'Content-Length': '273'}>
2020-05-06 10:31:19,715 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): autoscaling.eu-central-1.amazonaws.com:443
2020-05-06 10:31:20,125 - MainThread - urllib3.connectionpool - DEBUG - https://autoscaling.eu-central-1.amazonaws.com:443 "POST / HTTP/1.1" 200 289
2020-05-06 10:31:20,127 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-RequestId': '27e1a1a4-638e-4d7f-81bc-f37388584eab', 'Content-Type': 'text/xml', 'Content-Length': '289', 'Date': 'Wed, 06 May 2020 07:31:19 GMT'}
2020-05-06 10:31:20,127 - MainThread - botocore.parsers - DEBUG - Response body:
b'<AttachLoadBalancerTargetGroupsResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">\n  <AttachLoadBalancerTargetGroupsResult/>\n  <ResponseMetadata>\n    <RequestId>27e1a1a4-638e-4d7f-81bc-f37388584eab</RequestId>\n  </ResponseMetadata>\n</AttachLoadBalancerTargetGroupsResponse>\n'
2020-05-06 10:31:20,128 - MainThread - botocore.hooks - DEBUG - Event needs-retry.auto-scaling.AttachLoadBalancerTargetGroups: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x7f18da18b710>>
2020-05-06 10:31:20,129 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2020-05-06 10:31:20,130 - MainThread - botocore.hooks - DEBUG - Event after-call.auto-scaling.AttachLoadBalancerTargetGroups: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x7f18da18b438>>
2020-05-06 10:31:20,143 - MainThread - awscli.formatter - DEBUG - RequestId: 27e1a1a4-638e-4d7f-81bc-f37388584eab
root@HP:/home/bell# aws elbv2 describe-target-groups|jq -r '.[]|.[].TargetGroupArn'|cut -d/ -f2`

1 Ответ

0 голосов
/ 06 мая 2020

Ваша цель - присоединить экземпляр к целевой группе, которая используется Load Balancer.

Указанная вами команда неверна. aws autoscaling attach-load-balancer-target-groups используется для присоединения целевой группы к loadbalancer, а не экземпляра к целевой группе.

To добавьте экземпляр в целевую группу, чтобы ваш балансировщик нагрузки балансировал нагрузку. Запрос, который вы должны использовать aws elbv2 register-targets

Подробнее об этом здесь

...