By using AWS re:Post, you agree to the Terms of Use
/AWS Glue Image issue/

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.

1 Answers
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

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions