I have a simple python
script that is scanning a DynamoDB
table. The table holds ARNs for all the accounts I own. There is one primary key "ARNs" of data type string. When I scan the table, I would like to only get the ARN string returned. I am having trouble finding anything in the boto3
documentation that can accomplish this. Below is my code, the returned output, and the desired output.
CODE:
import boto3
dynamo = boto3.client('dynamodb')
# Scans Dynamo for all account role ARNs
def get_arns():
response = dynamo.scan(TableName='AllAccountARNs')
print(response)
get_arns()
OUTPUT:
{'ARNs': {'S': 'arn:aws:iam::xxxxxxx:role/custom_role'}},
{'ARNs': {'S': 'arn:aws:iam::yyyyyyy:role/custom_role'}},
{'ARNs': {'S': 'arn:aws:iam::zzzzzzz:role/custom_role'}}
DESIRED OUPUT:
arn:aws:iam::xxxxxxx:role/custom_role
arn:aws:iam::yyyyyyy:role/custom_role
arn:aws:iam::zzzzzzz:role/custom_role