Skip to content

Commit 5f853b3

Browse files
author
Michael Kaiser
committed
Fix: CachinContext requires a lookup that cause build to fail without valid aws creds
1 parent fe9eceb commit 5f853b3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

typescript/ssm-document-association/lib/ssm-document-association-stack.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class SsmDocumentAssociationStack extends cdk.Stack {
4343
]
4444
}
4545
});
46-
46+
4747
// Create an association for the document
4848
// Apply the document to all EC2 instances with the tag Environment:Development
4949
// The association will run every 30 minutes
@@ -76,7 +76,7 @@ export class SsmDocumentAssociationStack extends cdk.Stack {
7676
}
7777
]
7878
});
79-
79+
8080
const role = new iam.Role(this, 'EC2SSMRole', {
8181
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
8282
managedPolicies: [
@@ -89,25 +89,23 @@ export class SsmDocumentAssociationStack extends cdk.Stack {
8989
const instance = new ec2.Instance(this, 'SSMTestInstance', {
9090
vpc,
9191
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO),
92-
machineImage: ec2.MachineImage.latestAmazonLinux2023({
93-
cachedInContext: true,
94-
}),
92+
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
9593
role,
9694
vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
9795
});
98-
96+
9997
// Add the Environment:Development tag that matches our SSM Document association
10098
cdk.Tags.of(instance).add('Environment', 'Development');
101-
99+
102100
// Outputs
103101
new cdk.CfnOutput(this, 'DocumentName', {
104102
value: ssmDocument.ref,
105103
description: 'The name of the SSM document'
106104
});
107-
105+
108106
new cdk.CfnOutput(this, 'InstanceId', {
109107
value: instance.instanceId,
110108
description: 'The ID of the test EC2 instance'
111109
});
112110
}
113-
}
111+
}

0 commit comments

Comments
 (0)