Listing 1: Health Check als Shell-Skript resource "aws_instance" "" { # ... Andere Konfigurationen provisioner "remote-exec" { inline = [ "echo 'Health Check: Running...'", "if curl -s http://localhost:8080/health | grep 'OK'; then exit 0; else exit 1; fi" ] connection { type = "ssh" user = "ubuntu" private_key = file("/path/to/private_key") host = self.public_ip } } lifecycle { create_before_destroy = true } } Listing 2: Einen Server auf AWS einrichten resource "aws_instance" "blue" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" subnet_id = aws_subnet.main.id security_groups = [aws_security_group. main.name] tags = { Name = "blue-green-app-blue" } // ... Andere Konfigurationen } resource "aws_elb" "main" { name = "blue-green-app-elb" // ... Andere Konfigurationen instances = [aws_instance.blue.id] } ``` Listing 3: Weitere Ressourcen in AWS bereitstellen resource "aws_instance" "green" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" subnet_id = aws_subnet.main.id security_groups = [aws_security_group.main.name] tags = { Name = "blue-green-app-green" } // ... Andere Konfigurationen } ```