Skip to content

Commit 226dba8

Browse files
committed
Sync master templates with base templates
1 parent 6cb89e3 commit 226dba8

File tree

2 files changed

+82
-400
lines changed

2 files changed

+82
-400
lines changed

aws/templates/asg/autoscale-master.yaml

Lines changed: 42 additions & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
AWSTemplateFormatVersion: 2010-09-09
2-
Description: Create an Auto Scaling group of Check Point gateways into a new VPC (__VERSION__)
2+
Description: |
3+
Create an Auto Scaling group of Check Point gateways into a new VPC (20250821)
4+
See CloudGuard Network for AWS Auto Scale Group deployment guide for detailed deployment and configuration steps.
35
Metadata:
46
AWS::CloudFormation::Interface:
57
ParameterGroups:
@@ -513,19 +515,14 @@ Parameters:
513515
Default: ""
514516
MaxLength: 100
515517
Conditions:
516-
ProvidedAdminEmail: !Not [!Equals [!Ref AdminEmail, '']]
517-
ProvidedTargetGroups: !Not [!Equals [!Ref GatewaysTargetGroups, '']]
518-
EnableCloudWatch: !Equals [!Ref CloudWatch, true]
519-
CreateELB: !Not [!Equals [!Ref ELBType, none]]
520-
EnableMetaDataToken: !Equals [!Ref MetaDataToken, true]
521518
4AZs: !Equals [ !Ref NumberOfAZs, 4 ]
522519
3AZs: !Or [ !Equals [ !Ref NumberOfAZs, 3 ], !Condition 4AZs ]
523-
GenerateAutoScalingName: !Equals [!Ref AutoScaleGroupName, ""]
520+
CreateELB: !Not [!Equals [!Ref ELBType, none]]
524521
Resources:
525522
VPCStack:
526523
Type: AWS::CloudFormation::Stack
527524
Properties:
528-
TemplateURL: __URL__/utils/vpc.yaml
525+
TemplateURL: https://cgi-cfts.s3.amazonaws.com/utils/vpc.yaml
529526
Parameters:
530527
AvailabilityZones: !Join [ ',' , !Ref AvailabilityZones ]
531528
NumberOfAZs: !Ref NumberOfAZs
@@ -538,232 +535,50 @@ Resources:
538535
PrivateSubnet2CIDR: !Ref PrivateSubnet2CIDR
539536
PrivateSubnet3CIDR: !Ref PrivateSubnet3CIDR
540537
PrivateSubnet4CIDR: !Ref PrivateSubnet4CIDR
541-
ChkpGatewayRole:
542-
Type: AWS::IAM::Role
543-
Condition: EnableCloudWatch
544-
Properties:
545-
AssumeRolePolicyDocument:
546-
Version: 2012-10-17
547-
Statement:
548-
- Effect: Allow
549-
Principal:
550-
Service:
551-
- ec2.amazonaws.com
552-
Action:
553-
- sts:AssumeRole
554-
Path: /
555-
CloudwatchPolicy:
556-
Condition: EnableCloudWatch
557-
Type: AWS::CloudFormation::Stack
558-
Properties:
559-
TemplateURL: __URL__/iam/cloudwatch-policy.yaml
560-
Parameters:
561-
PolicyName: ChkpGatewayPolicy
562-
PolicyRole: !Ref ChkpGatewayRole
563-
InstanceProfile:
564-
Type: AWS::IAM::InstanceProfile
565-
Condition: EnableCloudWatch
566-
Properties:
567-
Path: /
568-
Roles:
569-
- !Ref ChkpGatewayRole
570-
AMI:
538+
AutoScaleStack:
571539
Type: AWS::CloudFormation::Stack
572540
Properties:
573-
TemplateURL: __URL__/utils/amis.yaml
541+
TemplateURL: https://cgi-cfts.s3.us-east-1.amazonaws.com/autoscale/autoscale.yaml
574542
Parameters:
575-
Version: !Join ['-', [!Ref GatewayVersion, GW]]
576-
NotificationTopic:
577-
Type: AWS::SNS::Topic
578-
Condition: ProvidedAdminEmail
579-
Properties:
580-
Subscription:
581-
- Endpoint: !Ref AdminEmail
582-
Protocol: email
583-
ElasticLoadBalancer:
584-
Type: AWS::ElasticLoadBalancing::LoadBalancer
585-
Condition: CreateELB
586-
Properties:
587-
CrossZone: true
588-
Listeners:
589-
- LoadBalancerPort: !Ref ELBPort
590-
InstancePort: !Ref ELBPort
591-
Protocol: TCP
592-
HealthCheck:
593-
Target: !Join [':', [TCP, !Ref ELBPort]]
594-
HealthyThreshold: 3
595-
UnhealthyThreshold: 5
596-
Interval: 30
597-
Timeout: 5
598-
Scheme: !Ref ELBType
599-
Subnets:
600-
- !GetAtt VPCStack.Outputs.PublicSubnet1ID
601-
- !GetAtt VPCStack.Outputs.PublicSubnet2ID
602-
- !If [3AZs, !GetAtt VPCStack.Outputs.PublicSubnet3ID, !Ref 'AWS::NoValue']
603-
- !If [4AZs, !GetAtt VPCStack.Outputs.PublicSubnet4ID, !Ref 'AWS::NoValue']
604-
Policies:
605-
- PolicyName: EnableProxyProtocol
606-
PolicyType: ProxyProtocolPolicyType
607-
Attributes:
608-
- Name: ProxyProtocol
609-
Value: true
610-
InstancePorts:
611-
- !Ref ELBPort
612-
SecurityGroups:
613-
- !Ref ELBSecurityGroup
614-
PermissiveSecurityGroup:
615-
Type: AWS::EC2::SecurityGroup
616-
Properties:
617-
Tags:
618-
- Key: Name
619-
Value: !Join ['_', [!Ref 'AWS::StackName', PermissiveSecurityGroup]]
620-
GroupDescription: Permissive security group.
621-
VpcId: !GetAtt VPCStack.Outputs.VPCID
622-
SecurityGroupIngress:
623-
- IpProtocol: -1
624-
CidrIp: 0.0.0.0/0
625-
GatewayGroup:
626-
Type: AWS::AutoScaling::AutoScalingGroup
627-
DependsOn: GatewayLaunchTemplate
628-
Properties:
629-
VPCZoneIdentifier:
630-
- !GetAtt VPCStack.Outputs.PublicSubnet1ID
631-
- !GetAtt VPCStack.Outputs.PublicSubnet2ID
632-
- !If [3AZs, !GetAtt VPCStack.Outputs.PublicSubnet3ID, !Ref 'AWS::NoValue']
633-
- !If [4AZs, !GetAtt VPCStack.Outputs.PublicSubnet4ID, !Ref 'AWS::NoValue']
634-
LaunchTemplate:
635-
LaunchTemplateId: !Ref GatewayLaunchTemplate
636-
Version: !GetAtt GatewayLaunchTemplate.LatestVersionNumber
637-
AutoScalingGroupName: !If [GenerateAutoScalingName, !Join ["-", [!Ref 'AWS::StackName', GatewayGroup]], !Ref AutoScaleGroupName]
638-
MinSize: !Ref GatewaysMinSize
639-
MaxSize: !Ref GatewaysMaxSize
640-
LoadBalancerNames: !If [CreateELB, [!Ref ElasticLoadBalancer], !Ref 'AWS::NoValue']
641-
TargetGroupARNs: !If [ProvidedTargetGroups, !Split [',', !Ref GatewaysTargetGroups], !Ref 'AWS::NoValue']
642-
HealthCheckType: ELB
643-
HealthCheckGracePeriod: 3600
644-
NotificationConfiguration: !If
645-
- ProvidedAdminEmail
646-
- TopicARN: !Ref NotificationTopic
647-
NotificationTypes:
648-
- autoscaling:EC2_INSTANCE_LAUNCH
649-
- autoscaling:EC2_INSTANCE_LAUNCH_ERROR
650-
- autoscaling:EC2_INSTANCE_TERMINATE
651-
- autoscaling:EC2_INSTANCE_TERMINATE_ERROR
652-
- !Ref 'AWS::NoValue'
653-
Tags:
654-
- Key: Name
655-
Value: !Ref GatewayName
656-
PropagateAtLaunch: true
657-
- Key: x-chkp-tags
658-
Value: !Join
659-
- ':'
660-
- - !Join ['=', [management, !Ref ManagementServer]]
661-
- !Join ['=', [template, !Ref ConfigurationTemplate]]
662-
- !Join ['=', [ip-address, !Ref ControlGatewayOverPrivateOrPublicAddress]]
663-
PropagateAtLaunch: true
664-
GatewayLaunchTemplate:
665-
Type: AWS::EC2::LaunchTemplate
666-
Properties:
667-
LaunchTemplateData:
668-
NetworkInterfaces:
669-
- DeviceIndex: 0
670-
AssociatePublicIpAddress: true
671-
Groups:
672-
- !Ref PermissiveSecurityGroup
673-
Monitoring:
674-
Enabled: true
543+
VPC: !GetAtt VPCStack.Outputs.VPCID
544+
GatewaysSubnets: !Join
545+
- ','
546+
- - !GetAtt VPCStack.Outputs.PublicSubnet1ID
547+
- !GetAtt VPCStack.Outputs.PublicSubnet2ID
548+
- !If [3AZs, !GetAtt VPCStack.Outputs.PublicSubnet3ID, !Ref 'AWS::NoValue']
549+
- !If [4AZs, !GetAtt VPCStack.Outputs.PublicSubnet4ID, !Ref 'AWS::NoValue']
550+
GatewayName: !Ref GatewayName
551+
GatewayInstanceType: !Ref GatewayInstanceType
675552
KeyName: !Ref KeyName
676-
ImageId: !GetAtt AMI.Outputs.ImageId
677-
InstanceType: !Ref GatewayInstanceType
678-
MetadataOptions:
679-
HttpTokens: !If [EnableMetaDataToken, required, optional]
680-
BlockDeviceMappings:
681-
- DeviceName: '/dev/xvda'
682-
Ebs:
683-
Encrypted: !Ref EnableVolumeEncryption
684-
VolumeType: !Ref VolumeType
685-
VolumeSize: !Ref VolumeSize
686-
IamInstanceProfile:
687-
Name: !If [EnableCloudWatch, !Ref InstanceProfile, !Ref 'AWS::NoValue']
688-
UserData:
689-
'Fn::Base64':
690-
!Join
691-
- |+
692-
693-
- - '#cloud-config'
694-
- 'runcmd:'
695-
- ' - |'
696-
- ' set -e'
697-
- !Sub ' admin_shell=${Shell} ; allow_info=${AllowUploadDownload} ; cw=${CloudWatch} ; eic=${EnableInstanceConnect}'
698-
- !Join ['', [' sic="$(echo ', 'Fn::Base64': !Ref GatewaySICKey, ')"']]
699-
- !Join ['', [' pwd_hash="$(echo ', 'Fn::Base64': !Ref GatewayPasswordHash, ')"']]
700-
- !Join ['', [' maintenance_pwd_hash="$(echo ', 'Fn::Base64': !Ref GatewayMaintenancePasswordHash, ')"']]
701-
- !Join ['', [' bootstrap="$(echo ', 'Fn::Base64': !Ref GatewayBootstrapScript, ')"']]
702-
- !Sub [' version=${Version}', {Version: !Select [0, !Split ['-', !Ref GatewayVersion]]}]
703-
- ' python3 /etc/cloud_config.py enableCloudWatch=\"${cw}\" sicKey=\"${sic}\" installationType=\"autoscale\" osVersion=\"${version}\" allowUploadDownload=\"${allow_info}\" templateVersion=\"__VERSION__\" templateName=\"autoscale\" shell=\"${admin_shell}\" enableInstanceConnect=\"${eic}\" passwordHash=\"${pwd_hash}\" MaintenanceModePassword=\"${maintenance_pwd_hash}\" bootstrapScript64=\"${bootstrap}\"'
704-
VersionDescription: Initial template version
705-
GatewayScaleUpPolicy:
706-
Type: AWS::AutoScaling::ScalingPolicy
707-
Properties:
708-
AdjustmentType: ChangeInCapacity
709-
AutoScalingGroupName: !Ref GatewayGroup
710-
Cooldown: 300
711-
ScalingAdjustment: 1
712-
GatewayScaleDownPolicy:
713-
Type: AWS::AutoScaling::ScalingPolicy
714-
Properties:
715-
AdjustmentType: ChangeInCapacity
716-
AutoScalingGroupName: !Ref GatewayGroup
717-
Cooldown: 300
718-
ScalingAdjustment: -1
719-
CPUAlarmHigh:
720-
Type: AWS::CloudWatch::Alarm
721-
Properties:
722-
AlarmDescription: Scale-up if CPU > 80% for 10 minutes.
723-
MetricName: CPUUtilization
724-
Namespace: AWS/EC2
725-
Statistic: Average
726-
Period: 300
727-
EvaluationPeriods: 2
728-
Threshold: 80
729-
AlarmActions:
730-
- !Ref GatewayScaleUpPolicy
731-
Dimensions:
732-
- Name: AutoScalingGroupName
733-
Value: !Ref GatewayGroup
734-
ComparisonOperator: GreaterThanThreshold
735-
CPUAlarmLow:
736-
Type: AWS::CloudWatch::Alarm
737-
Properties:
738-
AlarmDescription: Scale-down if CPU < 60% for 10 minutes.
739-
MetricName: CPUUtilization
740-
Namespace: AWS/EC2
741-
Statistic: Average
742-
Period: 300
743-
EvaluationPeriods: 2
744-
Threshold: 60
745-
AlarmActions:
746-
- !Ref GatewayScaleDownPolicy
747-
Dimensions:
748-
- Name: AutoScalingGroupName
749-
Value: !Ref GatewayGroup
750-
ComparisonOperator: LessThanThreshold
751-
ELBSecurityGroup:
752-
Type: AWS::EC2::SecurityGroup
753-
Condition: CreateELB
754-
Properties:
755-
GroupDescription: ELB security group.
756-
VpcId: !GetAtt VPCStack.Outputs.VPCID
757-
SecurityGroupIngress:
758-
- IpProtocol: tcp
759-
CidrIp: !Ref ELBClients
760-
FromPort: !Ref ELBPort
761-
ToPort: !Ref ELBPort
553+
VolumeSize: !Ref VolumeSize
554+
VolumeType: !Ref VolumeType
555+
EnableVolumeEncryption: !Ref EnableVolumeEncryption
556+
EnableInstanceConnect: !Ref EnableInstanceConnect
557+
MetaDataToken: !Ref MetaDataToken
558+
GatewaysMinSize: !Ref GatewaysMinSize
559+
GatewaysMaxSize: !Ref GatewaysMaxSize
560+
AdminEmail: !Ref AdminEmail
561+
GatewaysTargetGroups: !Ref GatewaysTargetGroups
562+
GatewayVersion: !Ref GatewayVersion
563+
Shell: !Ref Shell
564+
GatewayPasswordHash: !Ref GatewayPasswordHash
565+
GatewayMaintenancePasswordHash: !Ref GatewayMaintenancePasswordHash
566+
GatewaySICKey: !Ref GatewaySICKey
567+
AllowUploadDownload: !Ref AllowUploadDownload
568+
CloudWatch: !Ref CloudWatch
569+
GatewayBootstrapScript: !Ref GatewayBootstrapScript
570+
ControlGatewayOverPrivateOrPublicAddress: !Ref ControlGatewayOverPrivateOrPublicAddress
571+
ManagementServer: !Ref ManagementServer
572+
ConfigurationTemplate: !Ref ConfigurationTemplate
573+
ELBType: !Ref ELBType
574+
ELBPort: !Ref ELBPort
575+
ELBClients: !Ref ELBClients
576+
AutoScaleGroupName: !Ref AutoScaleGroupName
762577
Outputs:
763578
URL:
764579
Description: The URL of the Proxy.
765580
Condition: CreateELB
766-
Value: !Join ['', ['http://', !GetAtt ElasticLoadBalancer.DNSName]]
581+
Value: !GetAtt AutoScaleStack.Outputs.URL
767582
SecurityGroup:
768583
Description: The Security Group of the Auto Scaling group.
769-
Value: !GetAtt PermissiveSecurityGroup.GroupId
584+
Value: !GetAtt AutoScaleStack.Outputs.SecurityGroup

0 commit comments

Comments
 (0)