Skip to content

InfrastructureConfiguration

Source: src/AWS/ImageBuilder/InfrastructureConfiguration.ts

An EC2 Image Builder infrastructure configuration — the environment (instance profile, instance types, network, logging) in which images are built and tested.

const role = yield* IAM.Role("BuilderRole", {
assumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [{
Effect: "Allow",
Principal: { Service: "ec2.amazonaws.com" },
Action: ["sts:AssumeRole"],
}],
},
managedPolicyArns: [
"arn:aws:iam::aws:policy/EC2InstanceProfileForImageBuilder",
"arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
],
});
const profile = yield* IAM.InstanceProfile("BuilderProfile", {
roleName: role.roleName,
});
const infra = yield* ImageBuilder.InfrastructureConfiguration("Infra", {
instanceProfileName: profile.instanceProfileName,
instanceTypes: ["t3.micro"],
terminateInstanceOnFailure: true,
});