Skip to content

Commit bd50253

Browse files
authored
Adding AWS CLI example (#11)
1 parent 8f4cc0e commit bd50253

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/aws/__init__.py

Whitespace-only changes.

src/aws/aws-ssm-parameters.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"Parameters": [
3+
{
4+
"Name": "Steve Rogers",
5+
"Value": "Captain America",
6+
"Type": "String",
7+
"Description": "Sentinel of Liberty, Avenger"
8+
},
9+
{
10+
"Name": "Peter Parker",
11+
"Value": "Spider-Man",
12+
"Type": "String",
13+
"Description": "Friendly Neighborhood, Avenger"
14+
}
15+
]
16+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import json
2+
3+
with open("./aws-ssm-parameters.json") as file:
4+
data = json.load(file)
5+
for item in data["Parameters"]:
6+
cmd = f'aws ssm put-parameter --name "{item['Name']}" \
7+
--description "{item['Description']}" --value "{item['Value']}" \
8+
--type "{item['Type']}" --overwrite'
9+
print(f'Executing AWS SSM command: {cmd}')
10+
# Execute the command to put the data in AWS Parameter Store
11+
# It is commented out in the example, but in order to execute
12+
# the following lines, AWS CLI must be installed first!
13+
# https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
14+
# import os
15+
# os.system(cmd)

0 commit comments

Comments
 (0)