use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.
the class TestHostedZone method testDNSSEC.
@Test
public void testDNSSEC() {
final Context context = new Context();
final String keyStackName = "key-" + this.random8String();
final String zoneStackName = "hostedzone-" + this.random8String();
final String dnssecStackName = "dnssec-" + this.random8String();
try {
this.createStack(context, keyStackName, "security/kms-key.yaml", new Parameter().withParameterKey("Service").withParameterValue("dnssec-route53"), new Parameter().withParameterKey("KeySpec").withParameterValue("ECC_NIST_P256"), new Parameter().withParameterKey("KeyUsage").withParameterValue("SIGN_VERIFY"));
try {
this.createStack(context, zoneStackName, "vpc/zone-legacy.yaml", new Parameter().withParameterKey("HostedZoneName").withParameterValue(Config.get(Config.Key.DOMAIN_SUFFIX)), new Parameter().withParameterKey("HostedZoneId").withParameterValue(Config.get(Config.Key.HOSTED_ZONE_ID)));
try {
this.createStack(context, dnssecStackName, "vpc/zone-dnssec.yaml", new Parameter().withParameterKey("ParentZoneStack").withParameterValue(zoneStackName), new Parameter().withParameterKey("ParentKmsKeyStack").withParameterValue(keyStackName));
} finally {
this.deleteStack(context, dnssecStackName);
}
} finally {
this.deleteStack(context, zoneStackName);
}
} finally {
this.deleteStack(context, keyStackName);
}
}
use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.
the class TestVPCNatInstance method test.
@Test
public void test() {
final Context context = new Context();
final String vpcStackName = "vpc-2azs-" + this.random8String();
final String natStackName = "vpc-nat-instance-" + this.random8String();
final String classB = "10";
final String keyName = "key-" + this.random8String();
try {
this.createKey(keyName);
try {
this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue(classB));
try {
this.createStack(context, natStackName, "vpc/vpc-nat-instance.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("KeyName").withParameterValue(keyName));
this.testVPCSubnetInternetAccess(context, vpcStackName, "SubnetAPrivate");
} finally {
this.deleteStack(context, natStackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
} finally {
this.deleteKey(context, keyName);
}
}
use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.
the class TestVPCVpnBastion method test.
@Test
public void test() {
final Context context = new Context();
final String vpcStackName = "vpc-2azs-" + this.random8String();
final String bastionStackName = "vpc-vpn-bastion-" + this.random8String();
final String classB = "10";
final String keyName = "key-" + this.random8String();
final String vpnPSK = this.random8String();
final String vpnUserPassword = this.random8String();
final String vpnAdminPassword = this.random8String();
try {
final KeyPair key = this.createKey(keyName);
try {
this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue(classB));
try {
this.createStack(context, bastionStackName, "vpc/vpc-vpn-bastion.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("KeyName").withParameterValue(keyName), new Parameter().withParameterKey("VPNPSK").withParameterValue(vpnPSK), new Parameter().withParameterKey("VPNUserName").withParameterValue("test"), new Parameter().withParameterKey("VPNUserPassword").withParameterValue(vpnUserPassword), new Parameter().withParameterKey("VPNAdminPassword").withParameterValue(vpnAdminPassword), new Parameter().withParameterKey("EFSBackupRetentionPeriod").withParameterValue("0"));
// TODO how can we check if this stack works?
} finally {
this.deleteStack(context, bastionStackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
} finally {
this.deleteKey(context, keyName);
}
}
use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.
the class TestRDSAuroraServerless method testMySQL57.
@Test
public void testMySQL57() {
final Context context = new Context();
final String vpcStackName = "vpc-2azs-" + this.random8String();
final String clientStackName = "client-" + this.random8String();
final String kmsKeyStackName = "key-" + this.random8String();
final String stackName = "rds-aurora-serverless-" + this.random8String();
final String password = this.random8String();
try {
this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml");
try {
this.createStack(context, clientStackName, "state/client-sg.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
try {
this.createStack(context, kmsKeyStackName, "security/kms-key.yaml");
try {
this.createStack(context, stackName, "state/rds-aurora-serverless.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentClientStack").withParameterValue(clientStackName), new Parameter().withParameterKey("ParentKmsKeyStack").withParameterValue(kmsKeyStackName), new Parameter().withParameterKey("DBName").withParameterValue("db1"), new Parameter().withParameterKey("DBMasterUserPassword").withParameterValue(password), new Parameter().withParameterKey("EngineVersion").withParameterValue("5.7.mysql-aurora.2.07.1"));
// TODO how can we check if this stack works? start a bastion host and try to connect?
} finally {
this.deleteStack(context, stackName);
}
} finally {
this.deleteStack(context, kmsKeyStackName);
}
} finally {
this.deleteStack(context, clientStackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
}
use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.
the class TestRDSAuroraServerless method testWithSecret.
@Test
public void testWithSecret() {
final Context context = new Context();
final String vpcStackName = "vpc-2azs-" + this.random8String();
final String clientStackName = "client-" + this.random8String();
final String kmsKeyStackName = "key-" + this.random8String();
final String secretStackName = "secret-" + this.random8String();
final String stackName = "rds-aurora-serverless-" + this.random8String();
try {
this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml");
try {
this.createStack(context, clientStackName, "state/client-sg.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
try {
this.createStack(context, kmsKeyStackName, "security/kms-key.yaml");
try {
this.createStack(context, secretStackName, "state/secretsmanager-dbsecret.yaml");
try {
this.createStack(context, stackName, "state/rds-aurora-serverless.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentClientStack").withParameterValue(clientStackName), new Parameter().withParameterKey("ParentKmsKeyStack").withParameterValue(kmsKeyStackName), new Parameter().withParameterKey("ParentSecretStack").withParameterValue(secretStackName), new Parameter().withParameterKey("DBName").withParameterValue("db1"));
// TODO how can we check if this stack works? start a bastion host and try to connect?
} finally {
this.deleteStack(context, stackName);
}
} finally {
this.deleteStack(context, secretStackName);
}
} finally {
this.deleteStack(context, kmsKeyStackName);
}
} finally {
this.deleteStack(context, clientStackName);
}
} finally {
this.deleteStack(context, vpcStackName);
}
}
Aggregations