How it works...

In step 1, we should note that iam_pass is a variable defined in our variables file, protected by Ansible Vault for storing secrets.

In step 2, we wrote an IAM policy and saved that file with the name iam_admin.json.

In step 3, we created an IAM policy with the name Admin and attached that policy to the user cookbook-admin.

We should note here that we have used iam_type as a user here, which can be changed to a group or role. In a production environment, it's good practice to create IAM groups with attached policies and add users to the group. Also, changing iam_type to a role will create a role with a defined policy and can be used with various AWS resources.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset