|
| 1 | +This section explains the core concepts and components of Amazon VPC Lattice, along with common usage patterns and examples. |
| 2 | + |
| 3 | +Core Concepts |
| 4 | +++++++++++++ |
| 5 | + |
| 6 | +Amazon VPC Lattice is an application networking service that lets you connect, secure, and monitor all your services across multiple VPCs and AWS accounts. Here are the key concepts: |
| 7 | + |
| 8 | +Service Network |
| 9 | +~~~~~~~~~~~~~~ |
| 10 | +A service network is a logical boundary for a group of services. It acts as a container where you can: |
| 11 | + |
| 12 | +* Connect multiple VPCs |
| 13 | +* Define shared security policies |
| 14 | +* Monitor service-to-service communication |
| 15 | +* Implement consistent access controls |
| 16 | + |
| 17 | +Services |
| 18 | +~~~~~~~~ |
| 19 | +A service represents an application that you want to make available to other applications. Services: |
| 20 | + |
| 21 | +* Can be accessed via DNS names |
| 22 | +* Support HTTP/HTTPS traffic |
| 23 | +* Can have multiple listeners |
| 24 | +* Can route traffic to different target groups |
| 25 | + |
| 26 | +Target Groups |
| 27 | +~~~~~~~~~~~~ |
| 28 | +Target groups define where your service traffic should be directed. They can be: |
| 29 | + |
| 30 | +* Instance-based (EC2 instances) |
| 31 | +* IP-based (IP addresses) |
| 32 | +* Lambda functions |
| 33 | +* Application Load Balancers (ALB) |
| 34 | + |
| 35 | +Components and Their Relationships |
| 36 | +++++++++++++++++++++++++++++++++ |
| 37 | + |
| 38 | +Service Network Association |
| 39 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 40 | +There are two types of associations: |
| 41 | + |
| 42 | +1. Service Association: Links a service to a service network |
| 43 | +2. VPC Association: Links a VPC to a service network |
| 44 | + |
| 45 | +This creates the networking fabric that allows services to communicate. |
| 46 | + |
| 47 | +Listeners and Rules |
| 48 | +~~~~~~~~~~~~~~~~~ |
| 49 | +Listeners define how your service accepts traffic: |
| 50 | + |
| 51 | +* Protocol (HTTP/HTTPS) |
| 52 | +* Port number |
| 53 | +* Rules for routing traffic |
| 54 | +* Optional authentication policies |
| 55 | + |
| 56 | +Authentication and Authorization |
| 57 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 58 | +VPC Lattice supports multiple authentication methods: |
| 59 | + |
| 60 | +* None (open access) |
| 61 | +* IAM authentication |
| 62 | +* Custom authentication via Lambda |
| 63 | + |
| 64 | +End-to-End Example |
| 65 | ++++++++++++++++++ |
| 66 | + |
| 67 | +Here's a complete example of setting up a service network with two services: |
| 68 | + |
| 69 | +1. Create a service network:: |
| 70 | + |
| 71 | + aws vpc-lattice create-service-network \ |
| 72 | + --name my-service-network |
| 73 | + |
| 74 | +2. Create two services:: |
| 75 | + |
| 76 | + aws vpc-lattice create-service \ |
| 77 | + --name service-a \ |
| 78 | + --auth-type NONE |
| 79 | + |
| 80 | + aws vpc-lattice create-service \ |
| 81 | + --name service-b \ |
| 82 | + --auth-type AWS_IAM |
| 83 | + |
| 84 | +3. Create target groups for each service:: |
| 85 | + |
| 86 | + aws vpc-lattice create-target-group \ |
| 87 | + --name service-a-tg \ |
| 88 | + --type INSTANCE \ |
| 89 | + --config file://tg-config.json |
| 90 | + |
| 91 | +Contents of ``tg-config.json``:: |
| 92 | + |
| 93 | + { |
| 94 | + "port": 80, |
| 95 | + "protocol": "HTTP", |
| 96 | + "protocolVersion": "HTTP1", |
| 97 | + "vpcIdentifier": "vpc-1234567890abcdef0" |
| 98 | + } |
| 99 | + |
| 100 | +4. Create listeners for the services:: |
| 101 | + |
| 102 | + aws vpc-lattice create-listener \ |
| 103 | + --service-identifier service-a \ |
| 104 | + --name http-listener \ |
| 105 | + --protocol HTTP \ |
| 106 | + --port 80 \ |
| 107 | + --default-action file://default-action.json |
| 108 | + |
| 109 | +Contents of ``default-action.json``:: |
| 110 | + |
| 111 | + { |
| 112 | + "forward": { |
| 113 | + "targetGroups": [ |
| 114 | + { |
| 115 | + "targetGroupIdentifier": "service-a-tg", |
| 116 | + "weight": 100 |
| 117 | + } |
| 118 | + ] |
| 119 | + } |
| 120 | + } |
| 121 | + |
| 122 | +5. Associate services with the service network:: |
| 123 | + |
| 124 | + aws vpc-lattice create-service-network-service-association \ |
| 125 | + --service-network-identifier my-service-network \ |
| 126 | + --service-identifier service-a |
| 127 | + |
| 128 | +6. Associate VPCs with the service network:: |
| 129 | + |
| 130 | + aws vpc-lattice create-service-network-vpc-association \ |
| 131 | + --service-network-identifier my-service-network \ |
| 132 | + --vpc-identifier vpc-1234567890abcdef0 |
| 133 | + |
| 134 | +Best Practices |
| 135 | ++++++++++++++ |
| 136 | + |
| 137 | +Security |
| 138 | +~~~~~~~~ |
| 139 | +* Use IAM authentication when possible |
| 140 | +* Implement least-privilege access policies |
| 141 | +* Use HTTPS listeners for sensitive traffic |
| 142 | +* Regularly audit service network associations |
| 143 | +* Rotate security credentials regularly |
| 144 | +* Use AWS Organizations SCPs to control VPC Lattice permissions |
| 145 | +* Implement network ACLs and security groups for additional protection |
| 146 | + |
| 147 | +Monitoring |
| 148 | +~~~~~~~~~ |
| 149 | +* Enable access logs for auditing |
| 150 | +* Set up CloudWatch metrics for monitoring |
| 151 | +* Use AWS X-Ray for tracing requests |
| 152 | +* Monitor target group health status |
| 153 | +* Configure CloudWatch alarms for key metrics: |
| 154 | + * TargetGroupHealthyCount |
| 155 | + * RequestCount |
| 156 | + * HTTP 4xx/5xx errors |
| 157 | +* Use AWS CloudTrail for API activity monitoring |
| 158 | + |
| 159 | +Scalability |
| 160 | +~~~~~~~~~~ |
| 161 | +* Use multiple target groups for high availability |
| 162 | +* Implement health checks for automatic failover |
| 163 | +* Configure appropriate timeouts and retries |
| 164 | +* Use weighted target groups for traffic distribution |
| 165 | +* Consider the following limits: |
| 166 | + * Services per service network |
| 167 | + * Target groups per service |
| 168 | + * Rules per listener |
| 169 | +* Implement circuit breakers for downstream service protection |
| 170 | + |
| 171 | +Performance Optimization |
| 172 | +~~~~~~~~~~~~~~~~~~~~~~ |
| 173 | +* Use connection pooling when possible |
| 174 | +* Configure appropriate keep-alive settings |
| 175 | +* Implement request timeouts based on service SLAs |
| 176 | +* Use caching where appropriate |
| 177 | +* Monitor and tune target group settings: |
| 178 | + * Health check intervals |
| 179 | + * Deregistration delay |
| 180 | + * Slow start duration |
| 181 | + |
| 182 | +Troubleshooting Guide |
| 183 | ++++++++++++++++++++ |
| 184 | + |
| 185 | +Common Issues and Solutions |
| 186 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 187 | + |
| 188 | +1. Service Discovery Issues |
| 189 | +------------------------- |
| 190 | +If services cannot discover each other: |
| 191 | + |
| 192 | +* Verify DNS resolution is working:: |
| 193 | + |
| 194 | + aws vpc-lattice get-service \ |
| 195 | + --service-identifier service-a \ |
| 196 | + --query 'dnsEntry' |
| 197 | + |
| 198 | +* Check VPC DNS settings:: |
| 199 | + |
| 200 | + aws ec2 describe-vpc-attribute \ |
| 201 | + --vpc-id vpc-1234567890abcdef0 \ |
| 202 | + --attribute enableDnsSupport |
| 203 | + |
| 204 | +* Ensure service network associations are active:: |
| 205 | + |
| 206 | + aws vpc-lattice list-service-network-service-associations \ |
| 207 | + --service-network-identifier my-service-network \ |
| 208 | + --status ACTIVE |
| 209 | + |
| 210 | +2. Authentication Failures |
| 211 | +------------------------ |
| 212 | +For IAM authentication issues: |
| 213 | + |
| 214 | +* Verify IAM policy attachments |
| 215 | +* Check for correct principal configuration |
| 216 | +* Ensure clock synchronization for signature verification |
| 217 | +* Review CloudWatch logs for specific authentication errors |
| 218 | + |
| 219 | +3. Health Check Failures |
| 220 | +---------------------- |
| 221 | +If targets are being marked unhealthy: |
| 222 | + |
| 223 | +* Verify target health status:: |
| 224 | + |
| 225 | + aws vpc-lattice get-target-group-health \ |
| 226 | + --target-group-identifier tg-1234567890abcdef0 |
| 227 | + |
| 228 | +* Common causes: |
| 229 | + * Security group rules blocking health check traffic |
| 230 | + * Application not responding on configured port |
| 231 | + * Incorrect health check path configuration |
| 232 | + * Target instance/container not running |
| 233 | + |
| 234 | +4. Performance Issues |
| 235 | +------------------- |
| 236 | +For latency or timeout problems: |
| 237 | + |
| 238 | +* Check target group metrics:: |
| 239 | + |
| 240 | + aws cloudwatch get-metric-statistics \ |
| 241 | + --namespace AWS/VpcLattice \ |
| 242 | + --metric-name TargetResponseTime \ |
| 243 | + --dimensions Name=TargetGroupId,Value=tg-1234567890abcdef0 |
| 244 | + |
| 245 | +* Review and adjust: |
| 246 | + * Connection timeouts |
| 247 | + * Request timeouts |
| 248 | + * Health check intervals |
| 249 | + * Target group attributes |
| 250 | + |
| 251 | +Diagnostic Commands |
| 252 | +~~~~~~~~~~~~~~~~~ |
| 253 | + |
| 254 | +1. Check Service Status:: |
| 255 | + |
| 256 | + aws vpc-lattice get-service \ |
| 257 | + --service-identifier service-a \ |
| 258 | + --query 'status' |
| 259 | + |
| 260 | +2. List Active Listeners:: |
| 261 | + |
| 262 | + aws vpc-lattice list-listeners \ |
| 263 | + --service-identifier service-a \ |
| 264 | + --status ACTIVE |
| 265 | + |
| 266 | +3. Verify Target Group Configuration:: |
| 267 | + |
| 268 | + aws vpc-lattice get-target-group \ |
| 269 | + --target-group-identifier tg-1234567890abcdef0 |
| 270 | + |
| 271 | +4. Review Access Logs:: |
| 272 | + |
| 273 | + aws logs get-log-events \ |
| 274 | + --log-group-name /aws/vpc-lattice/my-service-network \ |
| 275 | + --log-stream-name access-logs |
| 276 | + |
| 277 | +Common Use Cases |
| 278 | ++++++++++++++++ |
| 279 | + |
| 280 | +1. Service-to-Service Communication |
| 281 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 282 | +Connect microservices across multiple VPCs while maintaining security and observability. |
| 283 | + |
| 284 | +2. Multi-Account Architecture |
| 285 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 286 | +Share services across AWS accounts while maintaining centralized control and monitoring. |
| 287 | + |
| 288 | +3. Zero Trust Security |
| 289 | +~~~~~~~~~~~~~~~~~~~~ |
| 290 | +Implement fine-grained access controls and authentication for all service-to-service communication. |
| 291 | + |
| 292 | +4. API Gateway Alternative |
| 293 | +~~~~~~~~~~~~~~~~~~~~~~~~ |
| 294 | +Use VPC Lattice as an internal API gateway for service-to-service communication within your VPCs. |
0 commit comments