我有一个专门作为网站管理区域前端的微服务。微服务有专门的路由,/admin
. 404 error
当我尝试访问时,这给了我一个。下面给出的是微服务云模板的摘录。
Resources:
Service:
Type: AWS::ECS::Service
DependsOn: ListenerRule
Properties:
Cluster: !Ref Cluster
Role: !Ref ServiceRole
DesiredCount: !Ref DesiredCount
TaskDefinition: !Ref TaskDefinition
LoadBalancers:
- ContainerName: "activity-monitor-service"
ContainerPort: 80
TargetGroupArn: !Ref TargetGroup
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: activity-monitor-service
ContainerDefinitions:
- Name: activity-monitor-service
Essential: true
Image: registry.hub.docker.com/abameerdeen/activity_monitor:v4
Memory: 128
Environment:
- Name: PRODUCT_SERVICE_URL
Value: !Ref ProductServiceUrl
PortMappings:
- ContainerPort: 80
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref CloudWatchLogsGroup
awslogs-region: !Ref AWS::Region
CloudWatchLogsGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Ref AWS::StackName
RetentionInDays: 365
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 80
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 10
HealthCheckPath: /test.html
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
ListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 2
Conditions:
- Field: path-pattern
Values: [ "/admin/*" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
我在基础设施中也有一个应用程序负载均衡器 (ALB)。这是我的项目:https ://github.com/ammarisme/aws-cloudformation.git