This repo will demonstrate the features of AWS VPC Lattice and will provision the below infra components.
- hello-service is a Java Spring boot service and will be deployed in VPC
hello-world-svc-vpc
which have below endpoints./hello
-> Returns a static response ofHello
- demo-service is a Java Spring boot service and will be deployed in VPC
demo-svc-vpc
/hello
-> Connects to/hello
endpoint ofhello-world
using VPC lattice service endpoint./v1/hello
-> Connects to/hello
endpoint ofhello-world
using service connect
- An ALB with Lambda as a target group will be provisioned
- Lambda will return a static response with
Hello World
aws s3api create-bucket --bucket <terraform_state_bucket_name> --region ap-southeast-1
terraform init
terraform plan
terraform apply
Step 4: Go to AWS Console -> VPC -> Endpoints -> Choose the endpoint with prefix *-endpoint-to-rds-resource-gw
-> Click on Associations tab to get the details of endpoint.
Step 5: Use the below commands to get the demo-service
task-id and execute-command
into the container
aws ecs list-tasks --cluster merlion-dev-vpc-lattice-demo --service-name merlion-dev-demo-svc
aws ecs execute-command --cluster merlion-dev-vpc-lattice-demo --task <task_id_demo-service> --container demo_service --command "/bin/sh" --interactive
Step 6: Use the below command to test the connection from demo_service
to the endpoints copied in Step 4
. Should return SSL error.
# Should return SSL error.
curl -kv https://<endpoint_copied_from_step_4>:3306
aws s3api create-bucket --bucket <terraform_state_bucket_name> --region ap-southeast-1
terraform init
terraform plan
terraform apply
Step 4: Use the below commands to get the demo-service
task-id and execute-command
into the container
aws ecs list-tasks --cluster merlion-dev-vpc-lattice-demo --service-name merlion-dev-demo-svc
aws ecs execute-command --cluster merlion-dev-vpc-lattice-demo --task <task_id_demo-service> --container demo_service --command "/bin/sh" --interactive
# Should return SSL Hello.
curl http://localhost:8080/hello
Step 6: Get the value from the output variable vpc_lattice_service_endpoint
and use it in the below commands.
# Should return SSL Hello World.
curl https://<vpc_lattice_service_endpoint>/alb
curl https://<vpc_lattice_service_endpoint>/lambda