Hi,
I am assessing an AWS account. When I run awspx with --assume-role
I get the below error. But when I run without --assume-role
it works fine. The following command I used.
awspx ingest --profile prof --services EC2 S3 Lambda IAM --assume-role arn:aws:iam::11111111111:role/some-role
Error
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/local/lib/python3.7/dist-packages/urllib3/connection.py:170 in _new_conn │
│ │
│ 167 │ │ │
│ 168 │ │ try: │
│ 169 │ │ │ conn = connection.create_connection( │
│ ❱ 170 │ │ │ │ (self._dns_host, self.port), self.timeout, **extra_kw │
│ 171 │ │ │ ) │
│ 172 │ │ │
│ 173 │ │ except SocketTimeout: │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/util/connection.py:73 in create_connection │
│ │
│ 70 │ │ │ LocationParseError(u"'%s', label empty or too long" % host), None │
│ 71 │ │ ) │
│ 72 │ │
│ ❱ 73 │ for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): │
│ 74 │ │ af, socktype, proto, canonname, sa = res │
│ 75 │ │ sock = None │
│ 76 │ │ try: │
│ │
│ /usr/lib/python3.7/socket.py:748 in getaddrinfo │
│ │
│ 745 │ # We override this function since we want to translate the numeric family │
│ 746 │ # and socket type values to enum constants. │
│ 747 │ addrlist = [] │
│ ❱ 748 │ for res in _socket.getaddrinfo(host, port, family, type, proto, flags): │
│ 749 │ │ af, socktype, proto, canonname, sa = res │
│ 750 │ │ addrlist.append((_intenum_converter(af, AddressFamily), │
│ 751 │ │ │ │ │ │ _intenum_converter(socktype, SocketKind), │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
gaierror: [Errno -3] Temporary failure in name resolution
During handling of the above exception, another exception occurred:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/local/lib/python3.7/dist-packages/botocore/httpsession.py:332 in send │
│ │
│ 329 │ │ │ │ assert_same_host=False, │
│ 330 │ │ │ │ preload_content=False, │
│ 331 │ │ │ │ decode_content=False, │
│ ❱ 332 │ │ │ │ chunked=self._chunked(request.headers), │
│ 333 │ │ │ ) │
│ 334 │ │ │ │
│ 335 │ │ │ http_response = botocore.awsrequest.AWSResponse( │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:756 in urlopen │
│ │
│ 753 │ │ │ │ e = ProtocolError("Connection aborted.", e) │
│ 754 │ │ │ │
│ 755 │ │ │ retries = retries.increment( │
│ ❱ 756 │ │ │ │ method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] │
│ 757 │ │ │ ) │
│ 758 │ │ │ retries.sleep() │
│ 759 │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/util/retry.py:507 in increment │
│ │
│ 504 │ │ """ │
│ 505 │ │ if self.total is False and error: │
│ 506 │ │ │ # Disabled, indicate to re-raise the error. │
│ ❱ 507 │ │ │ raise six.reraise(type(error), error, _stacktrace) │
│ 508 │ │ │
│ 509 │ │ total = self.total │
│ 510 │ │ if total is not None: │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/packages/six.py:770 in reraise │
│ │
│ 767 │ │ │ │ value = tp() │
│ 768 │ │ │ if value.traceback is not tb: │
│ 769 │ │ │ │ raise value.with_traceback(tb) │
│ ❱ 770 │ │ │ raise value │
│ 771 │ │ finally: │
│ 772 │ │ │ value = None │
│ 773 │ │ │ tb = None │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:706 in urlopen │
│ │
│ 703 │ │ │ │ timeout=timeout_obj, │
│ 704 │ │ │ │ body=body, │
│ 705 │ │ │ │ headers=headers, │
│ ❱ 706 │ │ │ │ chunked=chunked, │
│ 707 │ │ │ ) │
│ 708 │ │ │ │
│ 709 │ │ │ # If we're going to release the connection in finally:
, then │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:382 in _make_request │
│ │
│ 379 │ │ │
│ 380 │ │ # Trigger any extra validation we need to do. │
│ 381 │ │ try: │
│ ❱ 382 │ │ │ self._validate_conn(conn) │
│ 383 │ │ except (SocketTimeout, BaseSSLError) as e: │
│ 384 │ │ │ # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout. │
│ 385 │ │ │ self._raise_timeout(err=e, url=url, timeout_value=conn.timeout) │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:1010 in _validate_conn │
│ │
│ 1007 │ │ │
│ 1008 │ │ # Force connect early to allow us to validate the connection. │
│ 1009 │ │ if not getattr(conn, "sock", None): # AppEngine might not have .sock
│
│ ❱ 1010 │ │ │ conn.connect() │
│ 1011 │ │ │
│ 1012 │ │ if not conn.is_verified: │
│ 1013 │ │ │ warnings.warn( │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/connection.py:353 in connect │
│ │
│ 350 │ │
│ 351 │ def connect(self): │
│ 352 │ │ # Add certificate verification │
│ ❱ 353 │ │ conn = self._new_conn() │
│ 354 │ │ hostname = self.host │
│ 355 │ │ tls_in_tls = False │
│ 356 │
│ │
│ /usr/local/lib/python3.7/dist-packages/urllib3/connection.py:182 in _new_conn │
│ │
│ 179 │ │ │
│ 180 │ │ except SocketError as e: │
│ 181 │ │ │ raise NewConnectionError( │
│ ❱ 182 │ │ │ │ self, "Failed to establish a new connection: %s" % e │
│ 183 │ │ │ ) │
│ 184 │ │ │
│ 185 │ │ return conn │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x7fe595689898>: Failed to establish a new connection: [Errno -3] Temporary failure in
name resolution
During handling of the above exception, another exception occurred:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /opt/awspx/cli.py:398 in main │
│ │
│ 395 │ │ console.start() │
│ 396 │ │
│ 397 │ try: │
│ ❱ 398 │ │ args.func(args) │
│ 399 │ │
│ 400 │ except (KeyboardInterrupt, SystemExit): │
│ 401 │ │ console.stop() │
│ │
│ /opt/awspx/cli.py:135 in handle_ingest │
│ │
│ 132 │ │ │ │ │ │ │ │ } │
│ 133 │ │ │ │
│ 134 │ │ │ assumed_role = session.client('sts').assume_role( │
│ ❱ 135 │ │ │ │ **assume_role_args)["Credentials"] │
│ 136 │ │ │ │
│ 137 │ │ │ session = boto3.session.Session( │
│ 138 │ │ │ │ aws_access_key_id=assumed_role["AccessKeyId"], │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/client.py:386 in _api_call │
│ │
│ 383 │ │ │ │ raise TypeError( │
│ 384 │ │ │ │ │ "%s() only accepts keyword arguments." % py_operation_name) │
│ 385 │ │ │ # The "self" in this scope is referring to the BaseClient. │
│ ❱ 386 │ │ │ return self._make_api_call(operation_name, kwargs) │
│ 387 │ │ │
│ 388 │ │ _api_call.name = str(py_operation_name) │
│ 389 │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/client.py:692 in _make_api_call │
│ │
│ 689 │ │ │ http, parsed_response = event_response │
│ 690 │ │ else: │
│ 691 │ │ │ http, parsed_response = self._make_request( │
│ ❱ 692 │ │ │ │ operation_model, request_dict, request_context) │
│ 693 │ │ │
│ 694 │ │ self.meta.events.emit( │
│ 695 │ │ │ 'after-call.{service_id}.{operation_name}'.format( │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/client.py:711 in _make_request │
│ │
│ 708 │ │
│ 709 │ def _make_request(self, operation_model, request_dict, request_context): │
│ 710 │ │ try: │
│ ❱ 711 │ │ │ return self._endpoint.make_request(operation_model, request_dict) │
│ 712 │ │ except Exception as e: │
│ 713 │ │ │ self.meta.events.emit( │
│ 714 │ │ │ │ 'after-call-error.{service_id}.{operation_name}'.format( │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/endpoint.py:102 in make_request │
│ │
│ 99 │ def make_request(self, operation_model, request_dict): │
│ 100 │ │ logger.debug("Making request for %s with params: %s", │
│ 101 │ │ │ │ │ operation_model, request_dict) │
│ ❱ 102 │ │ return self._send_request(request_dict, operation_model) │
│ 103 │ │
│ 104 │ def create_request(self, params, operation_model=None): │
│ 105 │ │ request = create_request_object(params) │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/endpoint.py:137 in _send_request │
│ │
│ 134 │ │ success_response, exception = self._get_response( │
│ 135 │ │ │ request, operation_model, context) │
│ 136 │ │ while self._needs_retry(attempts, operation_model, request_dict, │
│ ❱ 137 │ │ │ │ │ │ │ │ success_response, exception): │
│ 138 │ │ │ attempts += 1 │
│ 139 │ │ │ # If there is a stream associated with the request, we need │
│ 140 │ │ │ # to reset it before attempting to send the request again. │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/endpoint.py:256 in _needs_retry │
│ │
│ 253 │ │ responses = self._event_emitter.emit( │
│ 254 │ │ │ event_name, response=response, endpoint=self, │
│ 255 │ │ │ operation=operation_model, attempts=attempts, │
│ ❱ 256 │ │ │ caught_exception=caught_exception, request_dict=request_dict) │
│ 257 │ │ handler_response = first_non_none_response(responses) │
│ 258 │ │ if handler_response is None: │
│ 259 │ │ │ return False │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/hooks.py:357 in emit │
│ │
│ 354 │ │
│ 355 │ def emit(self, event_name, **kwargs): │
│ 356 │ │ aliased_event_name = self._alias_event_name(event_name) │
│ ❱ 357 │ │ return self._emitter.emit(aliased_event_name, **kwargs) │
│ 358 │ │
│ 359 │ def emit_until_response(self, event_name, **kwargs): │
│ 360 │ │ aliased_event_name = self._alias_event_name(event_name) │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/hooks.py:228 in emit │
│ │
│ 225 │ │ :return: List of (handler, response) tuples from all processed │
│ 226 │ │ │ │ handlers. │
│ 227 │ │ """ │
│ ❱ 228 │ │ return self._emit(event_name, kwargs) │
│ 229 │ │
│ 230 │ def emit_until_response(self, event_name, **kwargs): │
│ 231 │ │ """ │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/hooks.py:211 in _emit │
│ │
│ 208 │ │ responses = [] │
│ 209 │ │ for handler in handlers_to_call: │
│ 210 │ │ │ logger.debug('Event %s: calling handler %s', event_name, handler) │
│ ❱ 211 │ │ │ response = handler(**kwargs) │
│ 212 │ │ │ responses.append((handler, response)) │
│ 213 │ │ │ if stop_on_response and response is not None: │
│ 214 │ │ │ │ return responses │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/retryhandler.py:183 in call │
│ │
│ 180 │ │ this will process retries appropriately. │
│ 181 │ │ │
│ 182 │ │ """ │
│ ❱ 183 │ │ if self._checker(attempts, response, caught_exception): │
│ 184 │ │ │ result = self._action(attempts=attempts) │
│ 185 │ │ │ logger.debug("Retry needed, action of: %s", result) │
│ 186 │ │ │ return result │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/retryhandler.py:251 in call │
│ │
│ 248 │ │
│ 249 │ def call(self, attempt_number, response, caught_exception): │
│ 250 │ │ should_retry = self._should_retry(attempt_number, response, │
│ ❱ 251 │ │ │ │ │ │ │ │ │ │ caught_exception) │
│ 252 │ │ if should_retry: │
│ 253 │ │ │ if attempt_number >= self._max_attempts: │
│ 254 │ │ │ │ # explicitly set MaxAttemptsReached │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/retryhandler.py:277 in _should_retry │
│ │
│ 274 │ │ else: │
│ 275 │ │ │ # If we've exceeded the max attempts we just let the exception │
│ 276 │ │ │ # propogate if one has occurred. │
│ ❱ 277 │ │ │ return self._checker(attempt_number, response, caught_exception) │
│ 278 │
│ 279 │
│ 280 class HTTPStatusCodeChecker(BaseChecker): │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/retryhandler.py:317 in call │
│ │
│ 314 │ def call(self, attempt_number, response, caught_exception): │
│ 315 │ │ for checker in self._checkers: │
│ 316 │ │ │ checker_response = checker(attempt_number, response, │
│ ❱ 317 │ │ │ │ │ │ │ │ │ caught_exception) │
│ 318 │ │ │ if checker_response: │
│ 319 │ │ │ │ return checker_response │
│ 320 │ │ return False │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/retryhandler.py:223 in call │
│ │
│ 220 │ │ │ return self._check_response(attempt_number, response) │
│ 221 │ │ elif caught_exception is not None: │
│ 222 │ │ │ return self._check_caught_exception( │
│ ❱ 223 │ │ │ │ attempt_number, caught_exception) │
│ 224 │ │ else: │
│ 225 │ │ │ raise ValueError("Both response and caught_exception are None.") │
│ 226 │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/retryhandler.py:359 in _check_caught_exception │
│ │
│ 356 │ │ # caught_exception. That's what this class is being used for. If │
│ 357 │ │ # the MaxAttemptsDecorator is not interested in retrying the exception │
│ 358 │ │ # then this exception just propogates out past the retry code. │
│ ❱ 359 │ │ raise caught_exception │
│ 360 │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/endpoint.py:200 in _do_get_response │
│ │
│ 197 │ │ │ responses = self._event_emitter.emit(event_name, request=request) │
│ 198 │ │ │ http_response = first_non_none_response(responses) │
│ 199 │ │ │ if http_response is None: │
│ ❱ 200 │ │ │ │ http_response = self._send(request) │
│ 201 │ │ except HTTPClientError as e: │
│ 202 │ │ │ return (None, e) │
│ 203 │ │ except Exception as e: │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/endpoint.py:269 in _send │
│ │
│ 266 │ │ │ return True │
│ 267 │ │
│ 268 │ def _send(self, request): │
│ ❱ 269 │ │ return self.http_session.send(request) │
│ 270 │
│ 271 │
│ 272 class EndpointCreator(object): │
│ │
│ /usr/local/lib/python3.7/dist-packages/botocore/httpsession.py:352 in send │
│ │
│ 349 │ │ except URLLib3SSLError as e: │
│ 350 │ │ │ raise SSLError(endpoint_url=request.url, error=e) │
│ 351 │ │ except (NewConnectionError, socket.gaierror) as e: │
│ ❱ 352 │ │ │ raise EndpointConnectionError(endpoint_url=request.url, error=e) │
│ 353 │ │ except ProxyError as e: │
│ 354 │ │ │ raise ProxyConnectionError(proxy_url=proxy_url, error=e) │
│ 355 │ │ except URLLib3ConnectTimeoutError as e: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
EndpointConnectionError: Could not connect to the endpoint URL: "https://sts.amazonaws.com/"