Last active
August 29, 2015 14:04
-
-
Save schen1628/3837ce8c087af2584b44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "Create and assign an IAM Policy to an existing group to allow users to manage their own credentials and MFA.", | |
"Parameters": { | |
"Group": { | |
"Description": "Assign the IAM policy to an existing group", | |
"Type": "String" | |
} | |
}, | |
"Resources": { | |
"SelfManageIAMPolicy": { | |
"Type": "AWS::IAM::Policy", | |
"Properties": { | |
"Groups" : [ { "Ref" : "Group" } ], | |
"PolicyDocument": { | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowUsersAllActionsForCredentials", | |
"Effect": "Allow", | |
"Action": [ | |
"iam:*LoginProfile", | |
"iam:*AccessKey*", | |
"iam:*SigningCertificate*" | |
], | |
"Resource": { | |
"Fn::Join": [ | |
"", | |
[ | |
"arn:aws:iam::", | |
{ | |
"Ref": "AWS::AccountId" | |
}, | |
":user/${aws:username}" | |
] | |
] | |
} | |
}, | |
{ | |
"Sid": "AllowUsersToCreateDeleteTheirOwnVirtualMFADevices", | |
"Effect": "Allow", | |
"Action": [ | |
"iam:*VirtualMFADevice" | |
], | |
"Resource": { | |
"Fn::Join": [ | |
"", | |
[ | |
"arn:aws:iam::", | |
{ | |
"Ref": "AWS::AccountId" | |
}, | |
":mfa/${aws:username}" | |
] | |
] | |
} | |
}, | |
{ | |
"Sid": "AllowUsersToEnableSyncDisableTheirOwnMFADevices", | |
"Effect": "Allow", | |
"Action": [ | |
"iam:DeactivateMFADevice", | |
"iam:EnableMFADevice", | |
"iam:ListMFADevices", | |
"iam:ResyncMFADevice" | |
], | |
"Resource": { | |
"Fn::Join": [ | |
"", | |
[ | |
"arn:aws:iam::", | |
{ | |
"Ref": "AWS::AccountId" | |
}, | |
":user/${aws:username}" | |
] | |
] | |
} | |
}, | |
{ | |
"Sid": "AllowUsersToListVirtualMFADevices", | |
"Effect": "Allow", | |
"Action": [ | |
"iam:ListVirtualMFADevices" | |
], | |
"Resource": { | |
"Fn::Join": [ | |
"", | |
[ | |
"arn:aws:iam::", | |
{ | |
"Ref": "AWS::AccountId" | |
}, | |
":mfa/*" | |
] | |
] | |
} | |
}, | |
{ | |
"Sid": "AllowUsersToListUsersInConsole", | |
"Effect": "Allow", | |
"Action": [ | |
"iam:ListUsers" | |
], | |
"Resource": { | |
"Fn::Join": [ | |
"", | |
[ | |
"arn:aws:iam::", | |
{ | |
"Ref": "AWS::AccountId" | |
}, | |
":user/*" | |
] | |
] | |
} | |
} | |
] | |
}, | |
"PolicyName": "SelfManageIAMPolicy" | |
} | |
} | |
}, | |
"Outputs": { | |
"SelfManageIAMPolicyName": { | |
"Value": { | |
"Ref": "SelfManageIAMPolicy" | |
}, | |
"Description": "IAM Policy Name" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment