Stéphane Burwash
07/22/2022, 5:32 PMaaronsteers
07/22/2022, 7:12 PMboto3
for AWS parsing creds from AWS_ACCESS_KEY_ID
, etc., even if they are not explicitly sent through the config.Stéphane Burwash
07/22/2022, 7:13 PMStéphane Burwash
07/25/2022, 5:46 PMaaronsteers
07/25/2022, 6:31 PMStéphane Burwash
07/25/2022, 6:32 PMStéphane Burwash
07/25/2022, 7:40 PMimport subprocess
import json
values = [
("SECRET_#1_NAME", "RESULTING_FILE_#1_NAME")
]
def create_keyfile(aws_secret_name, associated_file_name):
data = subprocess.run(["aws",
"secretsmanager",
"get-secret-value",
"--secret-id",
"SECRET_ARN"],
capture_output=True,
text=True)
y = json.loads(data.stdout)
ss = json.loads(y["SecretString"])
secret = json.loads(ss[aws_secret_name])
with open(f'.secrets/tmp_{associated_file_name}.json', 'w') as st:
json.dump(secret, st)
for t in values:
create_keyfile(t[0], t[1])
Stéphane Burwash
07/25/2022, 7:40 PM