Skip to content

Commit

Permalink
add bitwarden setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hex22a committed Mar 13, 2021
1 parent 79579ff commit 266d166
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions lib/password-manager-stack.ts
@@ -0,0 +1,51 @@
import core = require('@aws-cdk/core');
import ec2 = require('@aws-cdk/aws-ec2');

export class PasswordManagetStack extends core.Stack {
constructor(scope: core.Construct, id: string, props?: core.StackProps) {
super(scope, id, props);

const Ubuntu20 = 'ami-042e8287309f5df03';
const everyone = "0.0.0.0/0";
const everyoneV6 = "::/0";

const httpsTraffic = {
cidrIp: everyone,
fromPort: 443,
ipProtocol: "TCP",
toPort: 443
};

const sshTraffic = {
cidrIp: everyone,
fromPort: 22,
ipProtocol: "TCP",
toPort: 22
};

const securityGroup = new ec2.CfnSecurityGroup(this, 'pwdmgr_sg', {
groupName: 'pwdmgr_sg',
groupDescription: 'Allows TCP traffic for the password manager',
securityGroupIngress: [
httpsTraffic,
sshTraffic,
]
});

// const startupScript = readFileSync('./lib/startup.sh').toString();

new ec2.CfnInstance(this, 'UbuntuBitWarden', {
imageId: Ubuntu20,
instanceType: 't3.small',
monitoring: false,
// userData: Base64.encode(startupScript),
securityGroupIds: [securityGroup.attrGroupId],
tags: [
{
key: 'Name',
value: 'Password Manager',
},
]
});
}
}

0 comments on commit 266d166

Please sign in to comment.