in lib/compute/agent-nodes.ts [40:53]
constructor(stack: Stack) {
const key = new KeyPair(stack, 'AgentNode-KeyPair', {
name: 'AgentNodeKeyPair',
description: 'KeyPair used by Jenkins Main Node to SSH into Agent Nodes',
});
Tags.of(key)
.add('jenkins:credentials:type', 'sshUserPrivateKey');
const AgentNodeRole = new Role(stack, 'JenkinsAgentNodeRole', {
assumedBy: new ServicePrincipal('ec2.amazonaws.com'),
});
const AgentNodeInstanceProfile = new CfnInstanceProfile(stack, 'JenkinsAgentNodeInstanceProfile', { roles: [AgentNodeRole.roleName] });
this.AgentNodeInstanceProfileArn = AgentNodeInstanceProfile.attrArn.toString();
this.SSHEC2KeySecretId = Fn.join('/', ['ec2-ssh-key', key.keyPairName.toString(), 'private']);
}