Tổ chức Stack

Tổ chức Stack

  1. Mở file root Fcj2024CdkApp

Architect

  1. Tạo ApiStack với id là Api
ApiStack apiStack = new ApiStack(app, "Api", StackProps.builder()
                .build(), 
                new ApiStackProps(
                        nlbStack.getNetworkLoadBalancer(),
                        nlbStack.getVpcLink()));

Architect

  1. Thêm environmen* và Tags cho ApiStack
   .env(environment)
   .tags(infraTags)

Architect

  1. Thêm phụ thuộc để đảm bảo rằng NLB được tao trước API Gateway
apiStack.addDependency(nlbStack);

Architect

Kiểm tra resource

  1. Trong giao diện AWS console, nhập API Gateway

Architect

  1. Trong giao diện API Gateway chọn APIs ta có thể thấy một API tên ECommerceAPI đã được tạo

Architect

  1. Chọn ECommerceAPI sau đó chọn GET

Architect

Test API trên postman

  1. Trong giao diện ECommerceAPI chọn Stages và copy Invoke URL

Architect

  1. Mở postman và tạo phương thức GET với đường dẫn Invoke URL/product

Architect