AWS IAM Group

This page shows how to write Terraform and CloudFormation for IAM Group and write them securely.

aws_iam_group (Terraform)

The Group in IAM can be configured in Terraform with the resource name aws_iam_group. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

iam_group.tf#L1
resource "aws_iam_group" "GameDesigners" {
  name = "GameDesigners"
  path = "/"
}

resource "aws_iam_group" "admin" {
iam_group.tf#L1
resource "aws_iam_group" "GameDesigners" {
  name = "GameDesigners"
  path = "/"
}

resource "aws_iam_group" "admin" {
aws_iam_groups.tf#L1
resource "aws_iam_group" "business_owner" {
  name = "Business_Owner"
}

resource "aws_iam_group" "budget_owner" {
  name = "Budget_Owner"
iam-usergroups.tf#L2
resource "aws_iam_group" "admindatalake" {
  name = "Admin-Datalake"
  path = "/"
}

resource "aws_iam_group" "dataengineer" {
groups.tf#L1
resource "aws_iam_group" "CloudAdmin" {
  name = "CloudAdmin"
  path = "/"
}

resource "aws_iam_group" "DBA" {

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

  • arn optional computed - string
  • id optional computed - string
  • name required - string
  • path optional - string
  • unique_id optional computed - string

Explanation in Terraform Registry

Provides an IAM group.

Tips: Best Practices for The Other AWS IAM Resources

In addition to the aws_iam_account_password_policy, AWS IAM has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

aws_iam_account_password_policy

Ensure AWS IAM account password policies requires long passwords

It's better to enforce the use of long and complex passwords to reduce the risk of bruteforce attacks.

Review your AWS IAM settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

AWS::IAM::Group (CloudFormation)

The Group in IAM can be configured in CloudFormation with the resource name AWS::IAM::Group. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

groups.yml#L3
    Type: "AWS::IAM::Group"
    DeletionPolicy: Retain
    Properties:
      GroupName: PrimeAdmins
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/AdministratorAccess
groups.yml#L3
    Type: "AWS::IAM::Group"
    Properties:
      GroupName: PrimeAdmins
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/AdministratorAccess

dev.yml#L3
    Type: AWS::IAM::Group
    Properties:
      GroupName: Admins
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/AdministratorAccess

creategroups.yml#L20
    Type: AWS::IAM::Group
    Properties:
      GroupName: !Ref DevgroupName
  AdministratorGroup:
    Type: AWS::IAM::Group
    Properties:
iam_user_with_two_additions.yml#L14
    Type: "AWS::IAM::Group"
    Properties:
      GroupName: "groupA"

  groupB:
    Type: "AWS::IAM::Group"
CloudFormation.json#L6
            "Type": "AWS::IAM::Group",
            "Description": "Accountants will have access only to the billing section of AWS.",
            "Properties": {
                "GroupName": "Accountants",
                "Path": "/Department/Accountants/",
                "Policies": [
Scout2-Master-003-IAMGroups-Global-Wait.json#L6
            "Type": "AWS::IAM::Group",
            "Properties": {
                "GroupName": "BlockedUsers",
                "ManagedPolicyArns": [
                    { "Fn::ImportValue": "DenyAllPolicyArn" }
                ]
Identity-StandardGroups.json#L37
      "Type" : "AWS::IAM::Group",
      "Properties" : {
        "GroupName" : "Administrators",
        "Path" : "/",
        "ManagedPolicyArns" : [
          "arn:aws:iam::aws:policy/AdministratorAccess"
Identity-StandardGroups.json#L37
      "Type" : "AWS::IAM::Group",
      "Properties" : {
        "GroupName" : "Administrators",
        "Path" : "/",
        "ManagedPolicyArns" : [
          "arn:aws:iam::aws:policy/AdministratorAccess"
iam_user_with_two_additions.json#L18
      "Type": "AWS::IAM::Group",
      "Properties": {
        "GroupName": "groupA"
      }
    },

Parameters

Explanation in CloudFormation Registry

Creates a new group. For information about the number of groups you can create, see Limitations on IAM Entities in the IAM User Guide.

Frequently asked questions

What is AWS IAM Group?

AWS IAM Group is a resource for IAM of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS IAM Group?

For Terraform, the mortyre/misc, mortyre/misc and osodevops/aws-terraform-module-iam-groups source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the ServerlessOpsIO/infrastructure, ServerlessOpsIO/infrastructure and FluxAugur/serverless-infrastructure source code examples are useful. See the CloudFormation Example section for further details.