Skip to content

Commit ac29df3

Browse files
committed
Updated to follow frontend/backend structure
1 parent b83385c commit ac29df3

File tree

16 files changed

+57
-57
lines changed

16 files changed

+57
-57
lines changed

walkthroughs/howto-tls-file-provided/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export ENVIRONMENT_NAME="AppMeshTLSExample"
2424
export MESH_NAME="ColorApp-TLS"
2525
export ENVOY_IMAGE=<get the latest from https://docs.aws.amazon.com/app-mesh/latest/userguide/envoy.html>
2626
export SERVICES_DOMAIN="default.svc.cluster.local"
27-
export GATEWAY_IMAGE_NAME="gateway"
27+
export FRONTEND_IMAGE_NAME="frontend"
2828
export COLOR_TELLER_IMAGE_NAME="colorteller"
2929
export COLOR_APP_ENVOY_IMAGE_NAME="colorapp-envoy"
3030
```
@@ -63,14 +63,14 @@ Next, build and deploy the color app images.
6363

6464
```bash
6565
./src/colorteller/deploy.sh
66-
./src/gateway/deploy.sh
66+
./src/frontend/deploy.sh
6767
```
6868

6969
Note that the example apps use go modules. If you have trouble accessing https://proxy.golang.org during the deployment you can override the GOPROXY by setting `GO_PROXY=direct`
7070

7171
```bash
7272
GO_PROXY=direct ./src/colorteller/deploy.sh
73-
GO_PROXY=direct ./src/gateway/deploy.sh
73+
GO_PROXY=direct ./src/frontend/deploy.sh
7474
```
7575

7676
## Step 2: Generate the Certficates
@@ -161,7 +161,7 @@ Now with the mesh defined, we can deploy our service to ECS and test it out.
161161
./infrastructure/ecs-service.sh
162162
```
163163

164-
Let's issue a request to the color gateway.
164+
Let's issue a request to the frontend.
165165

166166
```bash
167167
COLORAPP_ENDPOINT=$(aws cloudformation describe-stacks \
@@ -182,13 +182,13 @@ ssh -i ~/.ssh/$KEY_PAIR_NAME.pem ec2-user@$BASTION_IP
182182
curl -s http://colorteller.default.svc.cluster.local:9901/stats | grep ssl.handshake
183183
```
184184

185-
You should see output similar to: `listener.0.0.0.0_15000.ssl.handshake: 1`, indicating a successful SSL handshake was achieved between gateway and color teller.
185+
You should see output similar to: `listener.0.0.0.0_15000.ssl.handshake: 1`, indicating a successful SSL handshake was achieved between frontend and color teller.
186186

187187
Check out the [TLS Encryption](https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual-node-tls.html) documentation for more information on enabling encryption between services in App Mesh.
188188

189189
## Client TLS Validation Tutorial
190190

191-
Enabling TLS communication from your virtual node is the first step to securing your traffic. In a zero trust system, the Color Gateway should also be responsible for defining what certificate authorities are trusted. App Mesh allows you to configure Envoy with information on what CAs you trust to vend certificates. We will demonstrate this by adding a new color teller to our service that has a TLS certificate vended from a different CA than the first.
191+
Enabling TLS communication from your virtual node is the first step to securing your traffic. In a zero trust system, the frontend should also be responsible for defining what certificate authorities are trusted. App Mesh allows you to configure Envoy with information on what CAs you trust to vend certificates. We will demonstrate this by adding a new color teller to our service that has a TLS certificate vended from a different CA than the first.
192192

193193
## Step 6: Add the Green Color Teller
194194

@@ -227,15 +227,15 @@ After a couple seconds, when you hit the service, you should see both green and
227227
curl "${COLORAPP_ENDPOINT}/color"
228228
```
229229

230-
### Step 7: Add TLS Validation to the Gateway
230+
### Step 7: Add TLS Validation to the Frontend
231231

232-
As you just saw, we were able to add a new Virtual Node with TLS to our mesh and the Color Gateway was able to communicate with it no problem.
232+
As you just saw, we were able to add a new Virtual Node with TLS to our mesh and the Frontend was able to communicate with it no problem.
233233

234234
In the client/server relationship, if the server decides to turn on TLS, App Mesh configures the client Envoys to accept the certificate offered. However, clients should also validate that the certificate offered by the server is from a certificate authority they trust. App Mesh allows you to define a client policy for TLS validation to ensure that the certificate is valid and issued from a trustworthy source.
235235

236236
If you recall, the Green Color Teller certificates were signed by a different CA than the White Color Teller certificates. Perhaps this is not the intended behavior and we want to reject certificates from any CA that is not CA 1.
237237

238-
We are going to update the Color Gateway backend to have this configuration:
238+
We are going to update the Frontend's backend to have this configuration:
239239

240240
```yaml
241241
Backends:
@@ -254,7 +254,7 @@ BackendDefaults:
254254
In this situation, we add a backend default for the Client Policy that instructs Envoy to only allow certificates signed by CA 1 to be accepted. If we had a separate backend with a `ClientPolicy` defined for `TLS`, then the default policy would not be applied for `TLS`.
255255

256256
```bash
257-
./mesh/mesh.sh updateGateway
257+
./mesh/mesh.sh updateFrontend
258258
```
259259

260260
Now when call the service, you will see `white` is working properly, but you will start to see `upstream connect error or disconnect/reset before headers. reset reason: connection failure` from the Green Colorteller.
@@ -268,7 +268,7 @@ curl "${COLORAPP_ENDPOINT}/color"
268268
We can restore communication by changing the `certificateChain` in the backend group to be `ca_1_ca_2_bundle.pem`. This contains both the public certificates for CA 1 and CA 2, which will instructs Envoy to accept certificates signed by both CA 1 and CA 2.
269269

270270
```bash
271-
./mesh/mesh.sh updateGateway2
271+
./mesh/mesh.sh updateFrontend2
272272
```
273273

274274
Now when you call the service, you will see both `white` and `green` again.
@@ -292,7 +292,7 @@ Run the following commands to clean up and tear down the resources that we’ve
292292
aws cloudformation delete-stack --stack-name $ENVIRONMENT_NAME-ecs-service
293293
aws cloudformation delete-stack --stack-name $ENVIRONMENT_NAME-ecs-cluster
294294
aws ecr delete-repository --force --repository-name $COLOR_TELLER_IMAGE_NAME
295-
aws ecr delete-repository --force --repository-name $GATEWAY_IMAGE_NAME
295+
aws ecr delete-repository --force --repository-name $FRONTEND_IMAGE_NAME
296296
aws ecr delete-repository --force --repository-name $COLOR_APP_ENVOY_IMAGE_NAME
297297
aws cloudformation delete-stack --stack-name $ENVIRONMENT_NAME-ecr-repositories
298298
aws cloudformation delete-stack --stack-name $ENVIRONMENT_NAME-vpc

walkthroughs/howto-tls-file-provided/infrastructure/ecr-repositories.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ aws --profile "${AWS_PROFILE}" --region "${AWS_DEFAULT_REGION}" \
1010
--capabilities CAPABILITY_IAM \
1111
--template-file "${DIR}/ecr-repositories.yaml" \
1212
--parameter-overrides \
13-
GatewayImageName="${GATEWAY_IMAGE_NAME}" \
13+
FrontendImageName="${FRONTEND_IMAGE_NAME}" \
1414
ColorTellerImageName="${COLOR_TELLER_IMAGE_NAME}" \
1515
ColorAppEnvoyImageName="${COLOR_APP_ENVOY_IMAGE_NAME}"

walkthroughs/howto-tls-file-provided/infrastructure/ecr-repositories.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
Parameters:
22

3-
GatewayImageName:
4-
Description: The name for the gateway image
3+
FrontendImageName:
4+
Description: The name for the Frontend image
55
Type: String
66

77
ColorTellerImageName:
8-
Description: The name for the color teller image
8+
Description: The name for the color teller backend image
99
Type: String
1010

1111
ColorAppEnvoyImageName:
1212
Description: The name for the color app envoy image
1313
Type: String
1414

1515
Resources:
16-
GatewayRepository:
16+
FrontendRepository:
1717
Type: AWS::ECR::Repository
1818
Properties:
19-
RepositoryName: !Ref GatewayImageName
19+
RepositoryName: !Ref FrontendImageName
2020

2121
ColorTellerRepository:
2222
Type: AWS::ECR::Repository

walkthroughs/howto-tls-file-provided/infrastructure/ecs-service.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ aws --profile "${AWS_PROFILE}" --region "${AWS_DEFAULT_REGION}" \
1414
ECSServicesDomain="${SERVICES_DOMAIN}" \
1515
AppMeshMeshName="${MESH_NAME}" \
1616
EnvoyImage="${ENVOY_IMAGE}" \
17-
GatewayImageName="${GATEWAY_IMAGE_NAME}" \
17+
FrontendImageName="${FRONTEND_IMAGE_NAME}" \
1818
ColorTellerImageName="${COLOR_TELLER_IMAGE_NAME}" \
1919
ColorAppEnvoyImageName="${COLOR_APP_ENVOY_IMAGE_NAME}"
2020

walkthroughs/howto-tls-file-provided/infrastructure/ecs-service.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Parameters:
1616
Type: String
1717
Description: The image to use for the Envoy container
1818

19-
GatewayImageName:
20-
Description: The name for the gateway image
19+
FrontendImageName:
20+
Description: The name for the frontend image
2121
Type: String
2222

2323
ColorTellerImageName:
@@ -280,11 +280,11 @@ Resources:
280280
- 'Fn::ImportValue': !Sub "${EnvironmentName}:PrivateSubnet2"
281281
TaskDefinition: { Ref: ColorTellerGreenTaskDefinition }
282282

283-
### colorgateway.default.svc.cluster.local
284-
ColorGatewayServiceDiscoveryRecord:
283+
### frontend.default.svc.cluster.local
284+
FrontendServiceDiscoveryRecord:
285285
Type: 'AWS::ServiceDiscovery::Service'
286286
Properties:
287-
Name: "colorgateway"
287+
Name: "frontend"
288288
DnsConfig:
289289
NamespaceId:
290290
'Fn::ImportValue': !Sub "${EnvironmentName}:ECSServiceDiscoveryNamespace"
@@ -294,12 +294,12 @@ Resources:
294294
HealthCheckCustomConfig:
295295
FailureThreshold: 1
296296

297-
ColorGatewayTaskDefinition:
297+
FrontendTaskDefinition:
298298
Type: AWS::ECS::TaskDefinition
299299
Properties:
300300
RequiresCompatibilities:
301301
- 'FARGATE'
302-
Family: 'gateway'
302+
Family: 'frontend'
303303
NetworkMode: 'awsvpc'
304304
Cpu: 256
305305
Memory: 512
@@ -323,7 +323,7 @@ Resources:
323323
Value: '169.254.170.2,169.254.169.254'
324324
ContainerDefinitions:
325325
- Name: 'app'
326-
Image: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${GatewayImageName}'
326+
Image: !Sub '${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${FrontendImageName}'
327327
Essential: true
328328
DependsOn:
329329
- ContainerName: 'envoy'
@@ -334,7 +334,7 @@ Resources:
334334
awslogs-group:
335335
Fn::ImportValue: !Sub "${EnvironmentName}:ECSServiceLogGroup"
336336
awslogs-region: !Ref AWS::Region
337-
awslogs-stream-prefix: 'gateway'
337+
awslogs-stream-prefix: 'frontend'
338338
PortMappings:
339339
- ContainerPort: 80
340340
Protocol: 'http'
@@ -373,14 +373,14 @@ Resources:
373373
awslogs-group:
374374
Fn::ImportValue: !Sub "${EnvironmentName}:ECSServiceLogGroup"
375375
awslogs-region: !Ref AWS::Region
376-
awslogs-stream-prefix: 'gateway-envoy'
376+
awslogs-stream-prefix: 'frontend-envoy'
377377
Environment:
378378
- Name: 'APPMESH_VIRTUAL_NODE_NAME'
379-
Value: !Sub 'mesh/${AppMeshMeshName}/virtualNode/ColorGateway'
379+
Value: !Sub 'mesh/${AppMeshMeshName}/virtualNode/Frontend'
380380
- Name: CERTIFICATE_NAME
381-
Value: 'colorgateway'
381+
Value: 'frontend'
382382

383-
ColorGatewayService:
383+
FrontendService:
384384
Type: 'AWS::ECS::Service'
385385
DependsOn:
386386
- WebLoadBalancerRule
@@ -394,7 +394,7 @@ Resources:
394394
LaunchType: FARGATE
395395
ServiceRegistries:
396396
- RegistryArn:
397-
'Fn::GetAtt': ColorGatewayServiceDiscoveryRecord.Arn
397+
'Fn::GetAtt': FrontendServiceDiscoveryRecord.Arn
398398
NetworkConfiguration:
399399
AwsvpcConfiguration:
400400
AssignPublicIp: DISABLED
@@ -403,7 +403,7 @@ Resources:
403403
Subnets:
404404
- 'Fn::ImportValue': !Sub "${EnvironmentName}:PrivateSubnet1"
405405
- 'Fn::ImportValue': !Sub "${EnvironmentName}:PrivateSubnet2"
406-
TaskDefinition: { Ref: ColorGatewayTaskDefinition }
406+
TaskDefinition: { Ref: FrontendTaskDefinition }
407407
LoadBalancers:
408408
- ContainerName: app
409409
ContainerPort: 80
@@ -419,7 +419,7 @@ Resources:
419419
- CidrIp: 0.0.0.0/0
420420
IpProtocol: -1
421421

422-
# public ALB for color gateway
422+
# public ALB for frontend
423423
PublicLoadBalancer:
424424
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
425425
Properties:

walkthroughs/howto-tls-file-provided/mesh/mesh.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sanity_check() {
2323

2424
# $1 ColorTellerGreenRouteWeight
2525
# $2 EnableClientValidationFlag
26-
# $3 ColorGatewayTlsValidationPath
26+
# $3 FrontendTlsValidationPath
2727
callCloudformation() {
2828
aws --profile "${AWS_PROFILE}" --region "${AWS_DEFAULT_REGION}" \
2929
cloudformation deploy \
@@ -35,15 +35,15 @@ callCloudformation() {
3535
ServicesDomain="${SERVICES_DOMAIN}" \
3636
ColorTellerGreenRouteWeight=$1 \
3737
EnableClientValidationFlag=$2 \
38-
ColorGatewayTlsValidationPath=$3
38+
FrontendTlsValidationPath=$3
3939
}
4040

4141

4242
main() {
4343
action="$1"
4444
if [ -z "$action" ]; then
4545
echo "Usage:"
46-
echo "mesh.sh [up|addGreen|updateGateway|updateGateway2]"
46+
echo "mesh.sh [up|addGreen|updateFrontend|updateFrontend2]"
4747
fi
4848
sanity_check
4949

@@ -54,10 +54,10 @@ main() {
5454
addGreen)
5555
callCloudformation 1 "false"
5656
;;
57-
updateGateway)
57+
updateFrontend)
5858
callCloudformation 1 "true" "/keys/ca_1_cert.pem"
5959
;;
60-
updateGateway2)
60+
updateFrontend2)
6161
callCloudformation 1 "true" "/keys/ca_1_ca_2_bundle.pem"
6262
;;
6363
*)

walkthroughs/howto-tls-file-provided/mesh/mesh.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Parameters:
1717
AllowedValues: [0, 1]
1818
Default: 0
1919

20-
ColorGatewayTlsValidationPath:
21-
Description: The path to use for TLS client validation on the Color Gateway
20+
FrontendTlsValidationPath:
21+
Description: The path to use for TLS client validation on the Frontend
2222
Type: String
2323
Default: ""
2424

@@ -29,7 +29,7 @@ Parameters:
2929

3030
Conditions:
3131
EnableClientValidation: !Equals [!Ref EnableClientValidationFlag, "true"]
32-
ColorGatewayTlsValidationPathPresent: !Not [!Equals [!Ref ColorGatewayTlsValidationPath, ""]]
32+
FrontendTlsValidationPathPresent: !Not [!Equals [!Ref FrontendTlsValidationPath, ""]]
3333

3434

3535
Resources:
@@ -39,11 +39,11 @@ Resources:
3939
Properties:
4040
MeshName: !Ref MeshName
4141

42-
ColorGatewayVirtualNode:
42+
FrontendVirtualNode:
4343
Type: AWS::AppMesh::VirtualNode
4444
Properties:
4545
MeshName: !GetAtt Mesh.MeshName
46-
VirtualNodeName: ColorGateway
46+
VirtualNodeName: Frontend
4747
Spec:
4848
Backends:
4949
- VirtualService:
@@ -52,20 +52,20 @@ Resources:
5252
ClientPolicy:
5353
TLS:
5454
Fn::If:
55-
- ColorGatewayTlsValidationPathPresent
55+
- FrontendTlsValidationPathPresent
5656
- Enforce: !If [EnableClientValidation, True, False]
5757
Validation:
5858
Trust:
5959
File:
60-
CertificateChain: !Ref ColorGatewayTlsValidationPath
60+
CertificateChain: !Ref FrontendTlsValidationPath
6161
- !Ref AWS::NoValue
6262
Listeners:
6363
- PortMapping:
6464
Port: 80
6565
Protocol: http
6666
ServiceDiscovery:
6767
DNS:
68-
Hostname: !Sub "colorgateway.${ServicesDomain}"
68+
Hostname: !Sub "Frontend.${ServicesDomain}"
6969

7070
ColorTellerWhiteVirtualNode:
7171
Type: AWS::AppMesh::VirtualNode

walkthroughs/howto-tls-file-provided/src/customEnvoyImage/entryPoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ getSecret() {
77
}
88

99
getCertificates() {
10-
if [[ $CERTIFICATE_NAME = "colorgateway" ]];
10+
if [[ $CERTIFICATE_NAME = "frontend" ]];
1111
then
1212
getSecret "ca_1_cert"
1313
getSecret "ca_2_cert"

0 commit comments

Comments
 (0)