官术网_书友最值得收藏!

Security Token Service

The AWS Security Token Service (STS) is a web service that enables you to request temporary, limited-privilege credentials for IAM users. We'll see why this is a great feature when we cover least privilege security in Chapter 4, Security - Ensuring the Integrity of Your Systems.

Speaking of least privilege, you really shouldn't be using your root user for AWS console access. Let's create a new user. Then go back and see whether you can recreate your environment with the new user.

Create a file named user.tf and add the following:

resource "aws_iam_user" "cloudpatterns" {
name = "loadbalancer"
}

resource "aws_iam_group" "group" {
name = "cloudpatterngroup"
}

resource "aws_iam_group_membership" "admin" {
name = "tf-admin-group-membership"
users = [
"${aws_iam_user.cloudpatterns.name}",
]
group = "${aws_iam_group.group.name}"
}

resource "aws_iam_group_policy_attachment" "test-attach" {
group = "${aws_iam_group.group.name}"
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
}

Save it, then run the following:

terraform plan
terraform apply -target=aws_iam_user.cloudpatterns

You should see your new user in the IAM console.

主站蜘蛛池模板: 安泽县| 甘谷县| 霍林郭勒市| 唐山市| 淳安县| 诸城市| 慈溪市| 塘沽区| 南皮县| 津南区| 合江县| 彰武县| 青海省| 荆州市| 衢州市| 合水县| 涟源市| 岳阳县| 盘山县| 资兴市| 东乡族自治县| 武陟县| 龙陵县| 平舆县| SHOW| 滨州市| 黎城县| 池州市| 浦北县| 河池市| 平塘县| 镇原县| 白银市| 宁安市| 七台河市| 河曲县| 新郑市| 扎兰屯市| 永城市| 潼关县| 额敏县|