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

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.

主站蜘蛛池模板: 铜山县| 手游| 遵义市| 许昌市| 卢氏县| 锡林浩特市| 阿鲁科尔沁旗| 延边| 昭平县| 确山县| 京山县| 新郑市| 伊宁市| 綦江县| 红安县| 平乡县| 昆明市| 射阳县| 泸水县| 沈阳市| 龙门县| 云林县| 绥德县| 朔州市| 信宜市| 岢岚县| 贞丰县| 博兴县| 临汾市| 耿马| 鞍山市| 卢龙县| 射阳县| 宜良县| 泰安市| 中宁县| 渝北区| 朔州市| 绥阳县| 叶城县| 银川市|