我尝试附加AWS管理策略。 但这些角色不会附加到角色之一。
我尝试过这个。
const amazonEC2ReadOnlyAccess = new aws.iam.RolePolicyAttachment("amazonEC2ReadOnlyAccess", {
role: role,
policyArn: 'arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess'
});
const cloudWatchLogsFullAccess = new aws.iam.RolePolicyAttachment("cloudWatchLogsFullAccess", {
role: role,
policyArn: 'arn:aws:iam::aws:policy/CloudWatchLogsFullAccess'
});
,但未附加这两项政策。 接下来,我尝试使用这样的for循环。
const policyData = [
'arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess',
'arn:aws:iam::aws:policy/CloudWatchLogsFullAccess'
];
for (let i = 0; i < policyData.length; i++) {
new aws.iam.RolePolicyAttachment("cloudWatchLogsFullAccess" + i, {
role: role,
policyArn: policyData[i]
});
}
此代码也相同。
如何将多个AWS策略附加到一个角色?