Skip to content

Commit 9a03b1f

Browse files
committed
fix: attach SSM managed policy to EC2 demo role for debugging access
Signed-off-by: Kyle Hounslow <kylhouns@amazon.com>
1 parent 268dffa commit 9a03b1f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

aws/cli-installer/src/ec2-demo.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,15 @@ async function createDemoInstanceProfile(iam, cfg) {
207207

208208
await iam.send(new PutRolePolicyCommand({ RoleName: roleName, PolicyName: 'osis-ingest', PolicyDocument: ingestPolicy }));
209209

210+
// Attach SSM managed policy for debugging access
211+
const { AttachRolePolicyCommand } = await import('@aws-sdk/client-iam');
212+
try {
213+
await iam.send(new AttachRolePolicyCommand({
214+
RoleName: roleName,
215+
PolicyArn: 'arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore',
216+
}));
217+
} catch (e) { /* already attached */ }
218+
210219
try {
211220
await iam.send(new CreateInstanceProfileCommand({ InstanceProfileName: profileName, Tags: tags(cfg.pipelineName) }));
212221
await iam.send(new AddRoleToInstanceProfileCommand({ InstanceProfileName: profileName, RoleName: roleName }));

0 commit comments

Comments
 (0)