Aws Iam Python Script - Add New User To Existing Group
Context: I have a Python script that can create a User, decide on programmatic access or not, list the current Groups for Users. My issue is that I wish to add the new User to one
Solution 1:
You've already calculated which group was selected - it's the option-1
'th element in the groups
list. You can retrieve any of its attributes in the normal way, for example:
group = groups[option-1]
group_name = group["GroupName"]
group_arn = group["Arn"]
Instead of calculating and using g
, simply use groups[option-1][“GroupName”]
for the group name (or group_name
as calculated above).
The bigger picture here is that you’re going to need to learn how to debug your code. Printing out values as you go along (var and g, for example) and comparing them to what you expected to see is one way. A source-level debugger is another way.
Post a Comment for "Aws Iam Python Script - Add New User To Existing Group"