Estou recebendo esse erro quando vou fazer o deploy.
Meu código
package com.myorg;
import software.amazon.awscdk.CfnOutput;
import software.amazon.awscdk.SecretValue;
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.ec2.InstanceType;
import software.amazon.awscdk.services.rds.*;
import software.amazon.awscdk.services.ssm.CfnParameter;
import software.constructs.Construct;
import java.util.Collections;
public class AluraRdsStack extends Stack {
public AluraRdsStack(final Construct scope, final String id, final Vpc vpc) {
this(scope, id, null, vpc);
}
public AluraRdsStack(final Construct scope, final String id, final StackProps props, final Vpc vpc) {
super(scope, id, props);
CfnParameter senha = CfnParameter.Builder.create (this, "senha")
.type("String")
.description("Senha do database pedidos-ms")
.build();
ISecurityGroup iSecurityGroup = SecurityGroup.fromSecurityGroupId(this, id, vpc.getVpcDefaultSecurityGroup());
iSecurityGroup.addIngressRule(Peer.anyIpv4(), Port.tcp(3306));
DatabaseInstance database = DatabaseInstance.Builder
.create(this, "Rds-pedidos")
.instanceIdentifier("alura-aws-pedido-db")
.engine(DatabaseInstanceEngine.mysql(MySqlInstanceEngineProps.builder()
.version(MysqlEngineVersion.VER_8_0)
.build()))
.vpc(vpc)
.credentials(Credentials.fromUsername("admin",
CredentialsFromUsernameOptions.builder()
.password(SecretValue.unsafePlainText(senha.getValue()))
.build()))
.instanceType(InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO))
.multiAz(false)
.allocatedStorage(10)
.securityGroups(Collections.singletonList(iSecurityGroup))
.vpcSubnets(SubnetSelection.builder()
.subnets(vpc.getPrivateSubnets())
.build())
.build();
CfnOutput.Builder.create(this,"pedidos-db-endpoint")
.exportName("pedidos-db-endpoint")
.value(database.getDbInstanceEndpointAddress())
.build();
CfnOutput.Builder.create(this,"pedidos-db-senha")
.exportName("pedidos-db-senha")
.value(senha.getValue())
.build();
}
}
Infra App
package com.myorg;
import software.amazon.awscdk.App;
import software.amazon.awscdk.Environment;
import software.amazon.awscdk.StackProps;
import software.amazon.awscdk.services.ecs.Cluster;
import java.util.Arrays;
public class AluraAwsInfraApp {
public static void main(final String[] args) {
App app = new App();
AluraVpcStack vpcStack = new AluraVpcStack(app, "Vpc");
AluraClusterStack clusterStack = new AluraClusterStack(app, "Cluster", vpcStack.getVpc());
clusterStack.addDependency(vpcStack);
AluraRdsStack rdsStack = new AluraRdsStack(app, "Rds", vpcStack.getVpc());
rdsStack.addDependency(vpcStack);
AluraServiceStack serviceStack = new AluraServiceStack(app, "Service", clusterStack.getCluster());
serviceStack.addDependency(clusterStack);
app.synth();
}
}