Connection module for Amazon IAM
New in version 2014.7.0.
This module accepts explicit iam credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
If IAM roles are not used you need to specify them either in a pillar or in the minion's config file:
iam.keyid: GKTADJGHEIQSXMKKRBJ08H
iam.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
iam.region: us-east-1
It's also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
boto
Add user to group.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.add_user_to_group myuser mygroup
Associate an instance profile with an IAM role.
CLI Example:
salt myminion boto_iam.associate_profile_to_role myirole myiprofile
Attach a managed policy to a group.
CLI Example:
salt myminion boto_iam.attach_group_policy mypolicy mygroup
Attach a managed policy to a role.
CLI Example:
salt myminion boto_iam.attach_role_policy mypolicy myrole
Attach a managed policy to a user.
CLI Example:
salt myminion boto_iam.attach_user_policy mypolicy myuser
Build a default assume role policy.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.build_policy
Create access key id for a user.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.create_access_key myuser
Create a group.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.create_group group
Create an instance profile.
CLI Example:
salt myminion boto_iam.create_instance_profile myiprofile
Creates a login profile for the specified user, give the user the ability to access AWS services and the AWS Management Console.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.create_login_profile user_name password
Create a policy.
CLI Example:
salt myminios boto_iam.create_policy mypolicy '{"Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:Get*", "s3:List*"], "Resource": ["arn:aws:s3:::my-bucket/shared/*"]},]}'
Create a policy version.
CLI Example:
salt myminios boto_iam.create_policy_version mypolicy '{"Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:Get*", "s3:List*"], "Resource": ["arn:aws:s3:::my-bucket/shared/*"]},]}'
Create an instance role.
CLI Example:
salt myminion boto_iam.create_role myrole
Create or modify a role policy.
CLI Example:
salt myminion boto_iam.create_role_policy myirole mypolicy '{"MyPolicy": "Statement": [{"Action": ["sqs:*"], "Effect": "Allow", "Resource": ["arn:aws:sqs:*:*:*"], "Sid": "MyPolicySqs1"}]}'
Create SAML provider
CLI Example:
salt myminion boto_iam.create_saml_provider my_saml_provider_name saml_metadata_document
Create a user.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.create_user myuser
Deactivates the specified MFA device and removes it from association with the user.
New in version 2016.3.0.
CLI Example:
salt myminion boto_iam.deactivate_mfa_device user_name serial_num
Delete access key id from a user.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.delete_access_key myuser
Delete a group policy.
CLI Example:
salt myminion boto_iam.delete_group mygroup
Delete a group policy.
CLI Example:
salt myminion boto_iam.delete_group_policy mygroup mypolicy
Delete an instance profile.
CLI Example:
salt myminion boto_iam.delete_instance_profile myiprofile
Deletes a login profile for the specified user.
New in version 2016.3.0.
CLI Example:
salt myminion boto_iam.delete_login_profile user_name
Delete a policy.
CLI Example:
salt myminion boto_iam.delete_policy mypolicy
Delete a policy version.
CLI Example:
salt myminion boto_iam.delete_policy_version mypolicy v1
Delete an IAM role.
CLI Example:
salt myminion boto_iam.delete_role myirole
Delete a role policy.
CLI Example:
salt myminion boto_iam.delete_role_policy myirole mypolicy
Delete SAML provider
CLI Example:
salt myminion boto_iam.delete_saml_provider my_saml_provider_name
Deletes a certificate from Amazon.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.delete_server_cert mycert_name
Delete a user.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.delete_user myuser
Delete a user policy.
CLI Example:
salt myminion boto_iam.delete_user_policy myuser mypolicy
Deletes the specified virtual MFA device.
CLI Example:
salt myminion boto_iam.delete_virtual_mfa_device serial_num
Get information for a role.
CLI Example:
salt myminion boto_iam.describe_role myirole
Detach a managed policy to a group.
CLI Example:
salt myminion boto_iam.detach_group_policy mypolicy mygroup
Detach a managed policy to a role.
CLI Example:
salt myminion boto_iam.detach_role_policy mypolicy myrole
Detach a managed policy to a user.
CLI Example:
salt myminion boto_iam.detach_user_policy mypolicy myuser
Disassociate an instance profile from an IAM role.
CLI Example:
salt myminion boto_iam.disassociate_profile_from_role myirole myiprofile
Get all IAM role details. Produces results that can be used to create an sls file.
CLI Example:
salt-call boto_iam.export_roles --out=txt | sed "s/local: //" > iam_roles.sls
Get all IAM user details. Produces results that can be used to create an sls file.
New in version 2016.3.0.
CLI Example:
salt-call boto_iam.export_users --out=txt | sed "s/local: //" > iam_users.sls
Get a the AWS account id associated with the used credentials.
CLI Example:
salt myminion boto_iam.get_account_id
Get account policy for the AWS account.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_account_policy
Get all access keys from a user.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_all_access_keys myuser
Get a list of policy names from a group.
CLI Example:
salt myminion boto_iam.get_all_group_policies mygroup
Get and return all IAM group details, starting at the optional path.
New in version 2016.3.0.
CLI Example:
salt-call boto_iam.get_all_groups
Get and return all IAM instance profiles, starting at the optional path.
New in version 2016.11.0.
CLI Example:
salt-call boto_iam.get_all_instance_profiles
Get all MFA devices associated with an IAM user.
New in version 2016.3.0.
CLI Example:
salt myminion boto_iam.get_all_mfa_devices user_name
Get and return all IAM role details, starting at the optional path.
New in version 2016.3.0.
CLI Example:
salt-call boto_iam.get_all_roles
Get all user policies.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_all_user_policies myuser
Get and return all IAM user details, starting at the optional path.
New in version 2016.3.0.
CLI Example:
salt-call boto_iam.get_all_users
Get group information.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_group mygroup
Get group information.
New in version 2016.3.0.
CLI Example:
salt myminion boto_iam.get_group mygroup
Retrieves the specified policy document for the specified group.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_group_policy mygroup policyname
Check to see if policy exists.
CLI Example:
salt myminion boto_iam.instance_profile_exists myiprofile
Check to see if policy exists.
CLI Example:
salt myminion boto_iam.instance_profile_exists myiprofile
Get a role policy.
CLI Example:
salt myminion boto_iam.get_role_policy myirole mypolicy
Get SAML provider document.
CLI Example:
salt myminion boto_iam.get_saml_provider arn
Get SAML provider
CLI Example:
salt myminion boto_iam.get_saml_provider_arn my_saml_provider_name
Returns certificate information from Amazon
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_server_certificate mycert_name
Get user information.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_user myuser
Retrieves the specified policy document for the specified user.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.get_user_policy myuser mypolicyname
Check to see if an instance profile exists.
CLI Example:
salt myminion boto_iam.instance_profile_exists myiprofile
List entities attached to the given group.
CLI Example:
salt myminion boto_iam.list_entities_for_policy mypolicy
List entities attached to the given role.
CLI Example:
salt myminion boto_iam.list_entities_for_policy mypolicy
List entities attached to the given user.
CLI Example:
salt myminion boto_iam.list_entities_for_policy mypolicy
List entities that a policy is attached to.
CLI Example:
salt myminion boto_iam.list_entities_for_policy mypolicy
List all IAM instance profiles, starting at the optional path.
New in version 2016.11.0.
CLI Example:
salt-call boto_iam.list_instance_profiles
List policies.
CLI Example:
salt myminion boto_iam.list_policies
List versions of a policy.
CLI Example:
salt myminion boto_iam.list_policy_versions mypolicy
Get a list of policy names from a role.
CLI Example:
salt myminion boto_iam.list_role_policies myirole
List SAML providers.
CLI Example:
salt myminion boto_iam.list_saml_providers
Check to see if policy exists.
CLI Example:
salt myminion boto_iam.instance_profile_exists myiprofile
Check to see if policy exists.
CLI Example:
salt myminion boto_iam.instance_profile_exists myiprofile
Check to see if an instance profile is associated with an IAM role.
CLI Example:
salt myminion boto_iam.profile_associated myirole myiprofile
Adds or updates the specified policy document for the specified group.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.put_group_policy mygroup policyname policyrules
Adds or updates the specified policy document for the specified user.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.put_user_policy myuser policyname policyrules
Remove user from group.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.remove_user_from_group mygroup myuser
Check to see if an IAM role exists.
CLI Example:
salt myminion boto_iam.role_exists myirole
Set the default version of a policy.
CLI Example:
salt myminion boto_iam.set_default_policy_version mypolicy v1
Update the password policy for the AWS account.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.update_account_password_policy True
Update an assume role policy for a role.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.update_assume_role_policy myrole '{"Statement":"..."}'
Update SAML provider.
CLI Example:
salt myminion boto_iam.update_saml_provider my_saml_provider_name saml_metadata_document
Upload a certificate to Amazon.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.upload_server_cert mycert_name crt priv_key
cert_name -- The name for the server certificate. Do not include the path in this value.
cert_body -- The contents of the public key certificate in PEM-encoded format.
private_key -- The contents of the private key in PEM-encoded format.
cert_chain -- The contents of the certificate chain. This is typically a concatenation of the PEM-encoded public key certificates of the chain.
path -- The path for the server certificate.
region -- The name of the region to connect to.
key -- The key to be used in order to connect
keyid -- The keyid to be used in order to connect
profile -- The profile that contains a dict of region, key, keyid
True / False
Check if user exists in group.
New in version 2015.8.0.
CLI Example:
salt myminion boto_iam.user_exists_in_group myuser mygroup