AWS Glue Image issue

0

Team,

I have created AWS glue container using aws glue image . When I am logging into docker using bash command I can see aws credentials are set in docker . When I am running aws s3 ls from docker it s providing me list of s3 buckets.

I have written small code to test to connection to aws but it is giving error .

import os
import boto3
boto3.__version__
client = boto3.client('sts')
response=client.get_caller_identity()

error I am getting is : An error was encountered: An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid. Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 314, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 612, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid.

I have tried unset the existing credentials and set new still getting same issue

I am using 1.0 glue image.

feita há 2 anos538 visualizações
1 Resposta
0

Hello,

Looks like some issue with your credentials or configuration.

Below steps worked fine for me:

docker pull amazon/aws-glue-libs:glue_libs_1.0.0_image_01

docker run -it amazon/aws-glue-libs:glue_libs_1.0.0_image_01 bash

root@98c197939c1b:/# aws configure

root@98c197939c1b:/# aws sts get-caller-identity --no-cli-pager

root@98c197939c1b:/# python --version
Python 3.6.15

root@98c197939c1b:/# python
Python 3.6.15 (default, Dec  3 2021, 03:07:35)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os,boto3
>>> print(boto3.__version__)
1.8.9
>>> client = boto3.client('sts')
>>> print(client.get_caller_identity())

Ref docs:

[1. Configuring AWS CLI ] (https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)

[2. GetCallerIdentity api call] (https://docs.aws.amazon.com/STS/latest/APIReference/API_GetCallerIdentity.html)

3. Glue local development using Docker

AWS
ENGENHEIRO DE SUPORTE
respondido há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas