Quick Links
I had a lot of difficulty deleting the ALB and the ALB Security Group from CloudFormation due to the tight coupling of the cluster stack with the networking one's subnets. The network interfaces were in use. I had to wait for the deletion to finally fail then manually delete the ALB. After it was deleted I had to wait for the interfaces to go from "in use" to available.
In CloudFormation templates:
YAML compiles down to JSON so,
VPC:
# ...
IGW:
Type: AWS::EC2::InternetGateway
Properties:
VpcId:
Ref: VPC
is equivalent to
VPC:
# ...
IGW:
Type: AWS::EC2::InternetGateway
Properties: {VpcId: {Ref: "VPC"}}
You can also use CloudFormation's various functions to reference previously defined resources using Ref
, GetAtt
, etc
VPC:
# ...
IGW:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: CruddurVPC
AttachIGW:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId:
# Get ID from VPC
Ref: VPC
# Get ID of previously defined Resource "IGW" using CloudFormation function `!Ref`
InternetGatewayId: !Ref IGW
service-backend-flask.json
"serviceConnectConfiguration": {
"enabled": true,
"namespace": "cruddur",
"services": [
{
"portName": "backend-flask",
"discoveryName": "backend-flask",
"clientAliases": [{"port": 4567}]
}
]
}
ServiceConnectConfiguration:
Enabled: true
Namespace: "cruddur"
# TODO - If you want to log
# LogConfiguration
Services:
- DiscoveryName: backend-flask
PortName: backend-flask
ClientAliases:
- Port: !Ref ContainerPort
- Check your Network ACLs have outbound routes if you're having issues
- Update Behavior, Modification vs Replacement, in CloudFormation causes a lot of unexpected issues
- Logical Names for resources have a length limit, so try to keep them short including when using
!Sub
to change them - Dependencies of resources such as networking security groups makes it difficult to reduce coupling in CloudFormation
Delete previously manually configured:
- ALB (under EC2)
- Target Groups (under EC2)
- ECS cluster 'cruddur' and its services
- Cloud Map namespace 'cruddur'
After Deployment:
- update connection url var in parameter store
Delete previously manually configured:
- IAM Role: CruddurServiceExecutionRole
Note: Health check fails if database is not on the same VPC
Configure:
- add load balancer
dualstack.CrdClusterALB
to Route53 "A" records,api.domain
anddomain
Fixes:
- HealthCheckPort in cluster template should be set to 4567, not 80.
Port for health check wasn't updating in target group after update to changeset, so I deleted all the stacks.
Delete previously manually configured:
- log group:
/aws/lambda/cruddur-messaging-stream
sam build \
--use-container \
--config-file $CONFIG_PATH \
--template $TEMPLATE_PATH \
--base-dir $LAMBDA_DIR
Note:
--base-dir
is where the sam command is executed, so in thetemplate.yaml
, theCodeUri
is a folder relative to this path- e.g.) for the folder
./aws/lambdas/cruddur-messaging-stream
in the workspace:--base-dir
$ABS_PATH/aws/lambdas/
CodeUri: cruddur-messaging-stream
after deployment:
- codepipeline > settings > "pending connection" > update connection
Delete previously manually configured:
- Route 53 > Hosted Zone > delete
A
Record forkapingkaping.cloud
After deployment:
- build static site
- upload
build/
contents intokapingkaping.cloud
S3 bucket- make sure the
static/
sub-directory is uploaded in addition to the files
- make sure the