This is the example of creating SLB/ECS, and binding ECS to SLB. This will create following resources. Architecture overview is here.
- Create VPC
- Create Vswitch
- Create Security Group and set some rules
- Create two ECS instances in Vswitch
- Httpd and index.html including hostname will be provisioned
- Create EIP and bind it to ECS instance
- Create SLB instance
- Configure listener and binding to ECS instances
First you need to chnage configuration to yours.
$ cp terraform.tfvars.sample terrafrom.tfvars
$ vim terraform.tfvars
=> Edit variables with your favorite editor.
Deploy to Alibaba Cloud
$ terraform apply
...
Apply complete! Resources: 9 added, 0 changed, 0 destroyed.
Outputs:
slb = xx.xx.xx.xx
Please access slb ip address many times by web browser. You will find change html output.