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
resource "aws_iam_group" "GameDesigners" {
name = "GameDesigners"
path = "/"
}
resource "aws_iam_group" "admin" {
resource "aws_iam_group" "GameDesigners" {
name = "GameDesigners"
path = "/"
}
resource "aws_iam_group" "admin" {
resource "aws_iam_group" "business_owner" {
name = "Business_Owner"
}
resource "aws_iam_group" "budget_owner" {
name = "Budget_Owner"
resource "aws_iam_group" "admindatalake" {
name = "Admin-Datalake"
path = "/"
}
resource "aws_iam_group" "dataengineer" {
resource "aws_iam_group" "CloudAdmin" {
name = "CloudAdmin"
path = "/"
}
resource "aws_iam_group" "DBA" {
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.
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.
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
Type: AWS::IAM::Group
Properties:
GroupName: Admins
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AdministratorAccess
Type: "AWS::IAM::Group"
Properties:
GroupName: PrimeAdmins
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AdministratorAccess
Type: "AWS::IAM::Group"
DeletionPolicy: Retain
Properties:
GroupName: PrimeAdmins
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AdministratorAccess
Type: AWS::IAM::Group
Properties:
GroupName: !Ref DevgroupName
AdministratorGroup:
Type: AWS::IAM::Group
Properties:
Type: "AWS::IAM::Group"
Properties:
GroupName: "groupA"
groupB:
Type: "AWS::IAM::Group"
"Type": "AWS::IAM::Group",
"Description": "Accountants will have access only to the billing section of AWS.",
"Properties": {
"GroupName": "Accountants",
"Path": "/Department/Accountants/",
"Policies": [
"Type": "AWS::IAM::Group",
"Properties": {
"GroupName": "BlockedUsers",
"ManagedPolicyArns": [
{ "Fn::ImportValue": "DenyAllPolicyArn" }
]
"Type" : "AWS::IAM::Group",
"Properties" : {
"GroupName" : "Administrators",
"Path" : "/",
"ManagedPolicyArns" : [
"arn:aws:iam::aws:policy/AdministratorAccess"
"Type" : "AWS::IAM::Group",
"Properties" : {
"GroupName" : "Administrators",
"Path" : "/",
"ManagedPolicyArns" : [
"arn:aws:iam::aws:policy/AdministratorAccess"
"Type": "AWS::IAM::Group",
"Properties": {
"GroupName": "groupA"
}
},
Parameters
-
GroupName
optional - String -
ManagedPolicyArns
optional - List -
Path
optional - String -
Policies
optional - List of Policy
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 FluxAugur/serverless-infrastructure, ServerlessOpsIO/infrastructure and ServerlessOpsIO/infrastructure source code examples are useful. See the CloudFormation Example section for further details.