Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit a0c503a

Browse files
author
Irving Popovetsky
authored
Version 5.0.3 (#56)
* Version bump and update AMIs to be worldwide Signed-off-by: Irving Popovetsky <[email protected]> * Reduce unhealthy threshold from 10 minutes to 2 and double the check frequency Signed-off-by: Irving Popovetsky <[email protected]> * upload files to S3 bucket on tags automatically. Update python version to latest. test marketplace.yaml Signed-off-by: Irving Popovetsky <[email protected]> * speedup and smartify travis Signed-off-by: Irving Popovetsky <[email protected]> * Some JMESPath magic in order to ensure we get the latest AMI Signed-off-by: Irving Popovetsky <[email protected]> * Major reliability improvement: Make the Chef Server frontend ASG automatically rebuild instances that go unhealthy, but not bootstrap instances. Add cloudwatch alerts for all unhealthy hosts. Add clarity about the email address to the PREREQS.md doc Signed-off-by: Irving Popovetsky <[email protected]> * bump AMIs again to pick up Automate 20190722 release Signed-off-by: Irving Popovetsky <[email protected]>
1 parent f638394 commit a0c503a

12 files changed

+200
-50
lines changed

.travis.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
language: python
2+
cache: pip
23
python:
3-
- '3.6'
4+
- '3.7'
45
install:
56
- pip install awscli cfn-lint
67
script:
7-
- cfn-lint -f json *.yaml
8-
- aws cloudformation validate-template --template-body file://main.yaml
9-
- aws cloudformation validate-template --template-body file://chef_elasticsearch.yaml
10-
- aws cloudformation validate-template --template-body file://chef_rds.yaml
11-
- aws cloudformation validate-template --template-body file://automate.yaml
12-
- aws cloudformation validate-template --template-body file://chef_server_ha.yaml
13-
- aws cloudformation validate-template --template-body file://chef_server_ops_dashboard.yaml
14-
- aws cloudformation validate-template --template-body file://supermarket.yaml
8+
- cfn-lint -I -f parseable *.yaml
9+
- |
10+
for template in $(ls *.yaml); do
11+
echo "Validating template: ${template}"
12+
aws cloudformation validate-template --template-body file://${template} > /dev/null
13+
done
1514
env:
1615
global:
1716
- AWS_DEFAULT_REGION=us-east-1
@@ -20,8 +19,13 @@ env:
2019
# AWS_SECRET_ACCESS_KEY
2120
- secure: UgSuLr08ONqGJ5W5BLfVGC47P8AHh8/4u89GQEaR36Z1UdEo2e1buFOdMjZuBccsidB721LRCgn4yn+QafswTD7PvF7K/KoybUmseu3yR8LTf1HXInvYhqDnzI463i79B9A99GHFfjl/gZe4rNWYjCaJwIrAPkpsc11YOZU59BErL8RVwP8mCLXVlH4bEMUQFXHIddmDBBVV4M7+Dc1UBWc+ntHJPPoMpuzYJl7Lq32c5JPKs9Q3eEJuSnS3mAKCISobAG84Ck2VvcCxMfYJ/OARMl5eNmBZkLTAV3alSlrhhbwRzpAKc4YnmaWz6WJ49tNhZSwABPl+Om6LYiMVJg2a35Ocg7ru/5nz5VhaNUPCQeSOMmV2cM49MIdL4ZH/1hoB4StST4/vjcWQ5+HSIQEuEpEJx43J+oklIu8mgac9TpblgeoI50kryadFwgTqiAqMepsEvG9JKTIgcTOhb1ijAl+IVoKWLns04t2+oHuTFbqUrC6IlEi+5nATXUng65e1yiySZVgWuLwQyLa1Sajmgi9TiAKiUlTxt2eIzT7ok5SRSJxFZX3yGKXSw1SYi0knazQ2BUvcWsDbwLrp/SkQkzDh9ALjdT2027vtdIJviR+nyfzpKgx2PAmY5/JhzGK5pEZtE25XmOs1QLLC/XVKeDOp9t7Atgpl0QVW5x8=
2221
deploy:
23-
provider: script
22+
- provider: script
2423
script: aws s3 sync . s3://aws-native-chef-server/ --exclude "*" --include "*.yaml" --include "files/*" --acl public-read
2524
skip_cleanup: true
2625
on:
2726
branch: master
27+
- provider: script
28+
script: aws s3 sync . s3://aws-native-chef-server/${TRAVIS_TAG#v}/ --exclude "*" --include "*.yaml" --include "files/*" --acl public-read
29+
skip_cleanup: true
30+
on:
31+
tags: true

PREREQS.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,27 @@ You must create or upload at least one SSL certficate to AWS Certificate Manager
1414
In the parameters, fill in the `ChefSSLCertificateARN`, `AutomateSSLCertificateARN` and `SupermarketSSLCertificateARN` values with the ARNs for the certificates. The ARNs are always viewable in the ACM console, an example ACM ARN looks like: `arn:aws:acm:us-west-2:446539779517:certificate/82d30a13-b420-4f43-80de-9e7872f70b96`
1515

1616

17-
## Network
17+
### Network
1818

1919
You must already have a VPC setup properly before continuing setting up the stack, it should;
2020

2121
* Have enough IP's available to assign to nodes
2222
* Be split up into 3 subnets, each in different Availability Zones (AZ's)
2323
* Provide the VPC ID and associated subnets to the `VPC` and `ServerSubnets` parameters
2424

25-
## Security
25+
### Contact Email Adress
26+
27+
Supply a valid email address or team/DL alias here. Cloudwatch alerts will be sent to this address!
28+
29+
* At stack launch time you will receive an email titled `AWS Notification - Subscription Confirmation`
30+
* It's important you click the `Confirm subscription` button in this email or else you will not receive notifications
31+
32+
### Security
2633

2734
* You should already have created/uploaded an SSH key to AWS. Provide the keypair name to the `KeyName` parameter
2835
* If you're using the `main.yaml` stack, you must also create a security group in the referenced VPC to define your administrative access. Provide sg ID to the `InboundAdminSecurityGroupId` parameter
2936

30-
## Amazon Elasticsearch and Service Linked Role (SLR)
37+
### Amazon Elasticsearch and Service Linked Role (SLR)
3138

3239
Amazon Elasticsearch requires a specific SLR to be created prior to running this CloudFormation template, specifically one called `AWSServiceRoleForAmazonElasticsearchService`. This role cannot be created programmatically as it is created automatically when setting up a VPC access domain in the AWS console. For more information on this [please see this doc from AWS](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/slr-es.html), at this time, even though the doc points to a way to create this manually via the CLI, it still only works via console setup, however AWS adds new features all the time, and by the time you do this, it may work programmatically, please follow their documentation. Once you've created the VPC access domain for AWS ElasticSearch, you can then delete this domain, the role will still be there and you should be able to continue.
3340

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ A complete Chef Stack including:
2424
## Requirements
2525
* A working knowledge and comfort level with CloudFormation so that you can read and understand this template for your self
2626
* Permissions to create all of the types of resources specified in this template (IAM roles, Database subnets, etc)
27-
* A valid SSL certificate ARN (from the AWS Certificate Manager service)
28-
* A Route53 hosted zone (optional but strongly recommended)
2927

3028
## Prerequisites
3129

@@ -39,8 +37,8 @@ You can launch this stack with the push of a button:
3937

4038
| Edition | Version | Est Monthly cost | Launch button |
4139
| ------- | ------- | ---------------- | ------------- |
42-
| High Performance | 5.0.2 | [$1500*](https://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-E9251374-D80C-45B7-BED7-C9C9778B1D6C) | <p><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/new?templateURL=https:%2F%2Fs3.amazonaws.com%2Faws-native-chef-server%2F5.0.2%2Fmain.yaml&amp;stackName=my-chef-stack" target="_blank"><img src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png" alt="Launch Stack" /></a></p> |
43-
| Lowest Cost | 5.0.2 | [$320*](https://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=files/calc-165638db8e331664846c0d6654d743377bd3eac6&v=ver20190604sQ) | <p><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/new?templateURL=https:%2F%2Fs3.amazonaws.com%2Faws-native-chef-server%2F5.0.2%2Fmarketplace.yaml&amp;stackName=my-chef-stack" target="_blank"><img src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png" alt="Launch Stack" /></a></p> |
40+
| High Performance | 5.0.3 | [$1500*](https://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=calc-E9251374-D80C-45B7-BED7-C9C9778B1D6C) | <p><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/new?templateURL=https:%2F%2Fs3.amazonaws.com%2Faws-native-chef-server%2F5.0.3%2Fmain.yaml&amp;stackName=my-chef-stack" target="_blank"><img src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png" alt="Launch Stack" /></a></p> |
41+
| Lowest Cost | 5.0.3 | [$320*](https://calculator.s3.amazonaws.com/index.html#r=IAD&s=EC2&key=files/calc-165638db8e331664846c0d6654d743377bd3eac6&v=ver20190604sQ) | <p><a href="https://console.aws.amazon.com/cloudformation/home#/stacks/new?templateURL=https:%2F%2Fs3.amazonaws.com%2Faws-native-chef-server%2F5.0.3%2Fmarketplace.yaml&amp;stackName=my-chef-stack" target="_blank"><img src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png" alt="Launch Stack" /></a></p> |
4442

4543
_*NOTE: Estimated costs are just that, your mileage will vary. Use reserved instances to greatly reduce costs for long-running clusters._
4644

@@ -50,7 +48,7 @@ However, the most repeatable and least error-prone way to launch this stack is t
5048
```bash
5149
MYBUCKET=aws-native-chef-server
5250
MYID=mycompany
53-
VERSION=5.0.2
51+
VERSION=5.0.3
5452
EDITION=main # main or marketplace
5553
# Configure the automate_stack_parameters.json and then launch the cloudformation stack:
5654
# If you're using your own bucket, uncomment the next line:
@@ -71,7 +69,7 @@ If you've made changes to the template content or parameters and you wish to upd
7169
```bash
7270
MYBUCKET=aws-native-chef-server
7371
MYID=mycompany
74-
VERSION=5.0.2
72+
VERSION=5.0.3
7573
EDITION=main # main or marketplace
7674
# If you're using your own bucket, uncomment the next line:
7775
# aws s3 sync . s3://$MYBUCKET/$VERSION/ --exclude "*" --include "*.yaml" --include "files/*" && \

automate.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: AWS Native Automate 2 (auto-recovering standalone) v5.0.2
2+
Description: AWS Native Automate 2 (auto-recovering standalone) v5.0.3
33

44
Parameters:
55
# Required Parameters
@@ -139,8 +139,9 @@ Resources:
139139
ChefTargetGroup:
140140
Type: "AWS::ElasticLoadBalancingV2::TargetGroup"
141141
Properties:
142-
HealthCheckIntervalSeconds: 60
143-
UnhealthyThresholdCount: 10
142+
HealthCheckIntervalSeconds: 30
143+
UnhealthyThresholdCount: 2
144+
HealthyThresholdCount: 5
144145
HealthCheckPath: /
145146
VpcId: !Ref VPC
146147
Port: 443
@@ -537,14 +538,33 @@ Resources:
537538
MetricName: HTTPCode_ELB_5XX_Count
538539
Namespace: AWS/ApplicationELB
539540
ComparisonOperator: GreaterThanOrEqualToThreshold
540-
EvaluationPeriods: 5
541+
EvaluationPeriods: 2
541542
Period: 60
542543
Statistic: Sum
543544
Threshold: 10
544545
Dimensions:
545546
- Name: LoadBalancer
546547
Value: !GetAtt ChefALB.LoadBalancerFullName
547548

549+
TargetGroupUnHealthyHostsAlarm:
550+
Type: AWS::CloudWatch::Alarm
551+
Properties:
552+
AlarmName: !Sub Automate-TG-Unhealthy-Hosts-${AWS::StackName}
553+
AlarmDescription: Alarms when UnHealthyHostCount is greater than threshold.
554+
AlarmActions: [!Ref AlertNotificationTopic]
555+
MetricName: UnHealthyHostCount
556+
Namespace: AWS/ApplicationELB
557+
ComparisonOperator: GreaterThanOrEqualToThreshold
558+
EvaluationPeriods: 2
559+
Period: 60
560+
Statistic: Sum
561+
Threshold: 1
562+
Dimensions:
563+
- Name: LoadBalancer
564+
Value: !GetAtt ChefALB.LoadBalancerFullName
565+
- Name: TargetGroup
566+
Value: !GetAtt ChefTargetGroup.TargetGroupFullName
567+
548568
Outputs:
549569
DNSName:
550570
Description: The DNS name of the load balancer

chef_elasticsearch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: Chef Server Elasticsearch 5.0.2
2+
Description: Chef Server Elasticsearch 5.0.3
33

44
Parameters:
55
# Required Parameters

chef_rds.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: Chef Server PostgreSQL v5.0.2
2+
Description: Chef Server PostgreSQL v5.0.3
33

44
Parameters:
55
# Required Parameters

chef_server_ha.yaml

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: AWS Native Chef Server (auto-scaling HA) v5.0.2
2+
Description: AWS Native Chef Server (auto-scaling HA) v5.0.3
33

44
Parameters:
55
# Required Parameters
@@ -185,7 +185,7 @@ Parameters:
185185
Type: String
186186
TemplateVersion:
187187
Type: String
188-
Default: "5.0.2"
188+
Default: "5.0.3"
189189

190190
Metadata:
191191
cfn-lint:
@@ -246,6 +246,8 @@ Resources:
246246
- !Ref ChefTargetGroup
247247
MaxSize: !Sub '${MaxFrontendInstances}'
248248
MinSize: !Sub '${MinFrontendInstances}'
249+
HealthCheckGracePeriod: 900
250+
HealthCheckType: ELB
249251
NotificationConfigurations:
250252
- TopicARN: !Ref AlertNotificationTopic
251253
NotificationTypes:
@@ -365,8 +367,9 @@ Resources:
365367
ChefTargetGroup:
366368
Type: "AWS::ElasticLoadBalancingV2::TargetGroup"
367369
Properties:
368-
HealthCheckIntervalSeconds: 60
369-
UnhealthyThresholdCount: 10
370+
HealthCheckIntervalSeconds: 30
371+
UnhealthyThresholdCount: 2
372+
HealthyThresholdCount: 5
370373
HealthCheckPath: /_status
371374
VpcId: !Ref VPC
372375
Port: 443
@@ -385,8 +388,9 @@ Resources:
385388
ChefBootstrapTargetGroup:
386389
Type: "AWS::ElasticLoadBalancingV2::TargetGroup"
387390
Properties:
388-
HealthCheckIntervalSeconds: 60
389-
UnhealthyThresholdCount: 10
391+
HealthCheckIntervalSeconds: 30
392+
UnhealthyThresholdCount: 2
393+
HealthyThresholdCount: 5
390394
HealthCheckPath: /_status
391395
VpcId: !Ref VPC
392396
Port: 443
@@ -840,14 +844,52 @@ Resources:
840844
MetricName: HTTPCode_ELB_5XX_Count
841845
Namespace: AWS/ApplicationELB
842846
ComparisonOperator: GreaterThanOrEqualToThreshold
843-
EvaluationPeriods: 5
847+
EvaluationPeriods: 2
844848
Period: 60
845849
Statistic: Sum
846850
Threshold: 10
847851
Dimensions:
848852
- Name: LoadBalancer
849853
Value: !GetAtt ChefALB.LoadBalancerFullName
850854

855+
BootstrapTGUnhealthyHosts:
856+
Type: AWS::CloudWatch::Alarm
857+
Properties:
858+
AlarmName: !Sub Chef-Bootstrap-TG-Unhealthy-Hosts-${AWS::StackName}
859+
AlarmDescription: Alarms when UnHealthyHostCount is greater than threshold.
860+
AlarmActions: [!Ref AlertNotificationTopic]
861+
MetricName: UnHealthyHostCount
862+
Namespace: AWS/ApplicationELB
863+
ComparisonOperator: GreaterThanOrEqualToThreshold
864+
EvaluationPeriods: 2
865+
Period: 60
866+
Statistic: Sum
867+
Threshold: 1
868+
Dimensions:
869+
- Name: LoadBalancer
870+
Value: !GetAtt ChefALB.LoadBalancerFullName
871+
- Name: TargetGroup
872+
Value: !GetAtt ChefBootstrapTargetGroup.TargetGroupFullName
873+
874+
FETGUnhealthyHosts:
875+
Type: AWS::CloudWatch::Alarm
876+
Properties:
877+
AlarmName: !Sub Chef-FE-TG-Unhealthy-Hosts-${AWS::StackName}
878+
AlarmDescription: Alarms when UnHealthyHostCount is greater than threshold.
879+
AlarmActions: [!Ref AlertNotificationTopic]
880+
MetricName: UnHealthyHostCount
881+
Namespace: AWS/ApplicationELB
882+
ComparisonOperator: GreaterThanOrEqualToThreshold
883+
EvaluationPeriods: 2
884+
Period: 60
885+
Statistic: Sum
886+
Threshold: 1
887+
Dimensions:
888+
- Name: LoadBalancer
889+
Value: !GetAtt ChefALB.LoadBalancerFullName
890+
- Name: TargetGroup
891+
Value: !GetAtt ChefTargetGroup.TargetGroupFullName
892+
851893
CPUAlarmHigh:
852894
Type: AWS::CloudWatch::Alarm
853895
Properties:

chef_server_ops_dashboard.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: AWS Native OpsDashboard for Chef Server v5.0.2
2+
Description: AWS Native OpsDashboard for Chef Server v5.0.3
33

44
Parameters:
55
# Required Parameters

generate_os_mappings.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
CENTOS_RELEASE='aws-native-chef-server-5.0.*'
4-
IMAGE_OWNERID="406084061336"
4+
IMAGE_OWNERID="446539779517"
55

66
printf "Mappings:\n AMI:\n"
77

@@ -10,7 +10,7 @@ for region in $regions; do
1010
centos_ami=$(aws --region $region ec2 describe-images \
1111
--owners $IMAGE_OWNERID \
1212
--filters "Name=name,Values=${CENTOS_RELEASE}" \
13-
--query "Images[0].ImageId" \
13+
--query "sort_by(Images, &CreationDate)[*].ImageId | [-1]" \
1414
--output "text")
1515

1616
printf " $region:\n centos: $centos_ami\n"

main.yaml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: '2010-09-09'
2-
Description: AWS Native Chef Stack v5.0.2
2+
Description: AWS Native Chef Stack v5.0.3
33

44
Parameters:
55
# Required Parameters
@@ -43,8 +43,9 @@ Parameters:
4343
MaxLength: 64
4444
ConstraintDescription: Must be 64 alphanumeric characters
4545
AutomateSSLCertificateARN:
46-
Description: SSL Certficate ARN for SSL Certficate (must begin with arn:aws:iam::)
46+
Description: ARN for SSL Certficate, pre-create this in AWS Certificate Manager
4747
Type: String
48+
AllowedPattern: "arn:aws:acm:.*"
4849
AutomateDnsRecordName:
4950
Description: The DNS A-record name to automatically create in the Route53 zone (if enabled)
5051
Type: String
@@ -65,8 +66,9 @@ Parameters:
6566
###############################################################################
6667
# Chef Server Stack Settings
6768
ChefSSLCertificateARN:
68-
Description: SSL Certficate ARN for SSL Certficate (must begin with arn:aws:iam::)
69+
Description: ARN for SSL Certficate, pre-create this in AWS Certificate Manager
6970
Type: String
71+
AllowedPattern: "arn:aws:acm:.*"
7072
ChefServerDnsRecordName:
7173
Description: The DNS A-record name to automatically create in the Route53 zone (if enabled)
7274
Type: String
@@ -137,8 +139,9 @@ Parameters:
137139
###############################################################################
138140
# Automate Stack Settings
139141
SupermarketSSLCertificateARN:
140-
Description: SSL Certficate ARN for SSL Certficate (must begin with arn:aws:iam::)
142+
Description: ARN for SSL Certficate, pre-create this in AWS Certificate Manager
141143
Type: String
144+
AllowedPattern: "arn:aws:acm:.*"
142145
SupermarketDnsRecordName:
143146
Description: The DNS A-record name to automatically create in the Route53 zone (if enabled)
144147
Type: String
@@ -191,7 +194,7 @@ Parameters:
191194
TemplateVersion:
192195
Description: The version of this template to use (do not change this unless directed by support)
193196
Type: String
194-
Default: "5.0.2"
197+
Default: "5.0.3"
195198
Route53HostedZone:
196199
Type: String
197200
Default: ''
@@ -271,10 +274,38 @@ Conditions:
271274
# on AMIs that are pre-baked with all needed packages and scripts.
272275
Mappings:
273276
AMI:
277+
eu-north-1:
278+
centos: ami-0768c8ad843f26cbb
279+
ap-south-1:
280+
centos: ami-098dad5e1e61c8693
281+
eu-west-3:
282+
centos: ami-01e9cfbd4a3d29f04
283+
eu-west-2:
284+
centos: ami-0b107e0d9819e9282
285+
eu-west-1:
286+
centos: ami-02fccd4149ee6792a
287+
ap-northeast-2:
288+
centos: ami-03a176d0e576e5d36
289+
ap-northeast-1:
290+
centos: ami-0c6a211faced0a6b9
291+
sa-east-1:
292+
centos: ami-0b36d7af9bd43808a
293+
ca-central-1:
294+
centos: ami-0699076e5a3573ba0
295+
ap-southeast-1:
296+
centos: ami-03118dc2d58fe9031
297+
ap-southeast-2:
298+
centos: ami-0979abde4cc2545d3
299+
eu-central-1:
300+
centos: ami-0b6717e5a3e152845
274301
us-east-1:
275-
centos: ami-08d306e6de29d5cc1
302+
centos: ami-0f7f03419a9d3acfe
303+
us-east-2:
304+
centos: ami-0c31bba08ffd888ca
305+
us-west-1:
306+
centos: ami-0d3a8f9b7321fd2bb
276307
us-west-2:
277-
centos: ami-06fbb1e0ba7c99cfd
308+
centos: ami-0cc579c65b77193d4
278309

279310
Resources:
280311
ChefRole:

0 commit comments

Comments
 (0)