https://pulumi.com logo
Title
v

victorious-megabyte-32350

06/22/2021, 8:38 PM
Hi everybody! - I started using pulumi and I not sure how to do it, maybe if anyone can help it will be great. I'm creating a IAM Role and I need to attach to an existent  aws policy
const roleES = new aws.iam.Role(`es-role-test`, {
   name: `CognitoAccessForAmazonES`,
   assumeRolePolicy: {
   Version: '2012-10-17',
   Statement: [
   {
     Effect: 'Allow',
     Principal: {
        Service: '<http://es.amazonaws.com|es.amazonaws.com>',
     },
     Action: 'sts:AssumeRole',
     Sid: '',
   },
 ],
}
  I wanna add the 
AmazonESCognitoAccess
l

little-cartoon-10569

06/22/2021, 9:17 PM
Use an aws.iam.RolePolicyAttachment resource.
🙌 1
It takes both a policy and a role.