AWSTemplateFormatVersion: '2010-09-09' Description: This template is used for setting up a single meta node.(qs-1t9ums4na) Metadata: QSLint: Exclusions: [ W9002, W9003, W9004, W9006 ] Parameters: IAMRoleName: Description: Name of the NebulaGraph IAM Role. Type: String IAMProfileID: Description: ID of the NebulaGraph IAM Profile. Type: String KeyPairName: Description: Name of an existing EC2 key pair. All instances will launch with this key pair. Type: AWS::EC2::KeyPair::KeyName InstanceType: Description: Type of EC2 instance for the graphd instances. Type: String Default: c5.large AllowedValues: - c5.large - c5.xlarge - c5.2xlarge - c5.4xlarge - c5.9xlarge - c5.12xlarge - c5a.large - c5a.xlarge - c5a.2xlarge - c5a.4xlarge - c5a.8xlarge - c5a.12xlarge - c5a.16xlarge - c6a.large - c6a.xlarge - c6a.2xlarge - c6a.4xlarge - c6a.8xlarge - c6a.12xlarge - c6a.16xlarge - c6i.large - c6i.xlarge - c6i.2xlarge - c6i.4xlarge - c6i.8xlarge - c6i.12xlarge - c6i.16xlarge VolumeSize: Description: EBS Volume Size (data) to be attached to node in GBs. Type: Number Default: 20 MinValue: 20 MaxValue: 40 VolumeType: Description: EBS Volume Type (data) to be attached to node in GBs [gp2,gp3,io1,io2]. Type: String Default: gp2 AllowedValues: - gp2 - gp3 - io1 - io2 MetaEndpoints: Description: The endpoints of Meta nodes, separated by comma ','. Type: String MetaNodeIndex: Description: Meta node index. Type: String NetworkInterfaceID: Description: ID of the primary ENI. Type: String NebulaGraphVersion: Description: NebulaGraph version. Type: String Default: 3.1.3 QSS3BucketName: AllowedPattern: ^[0-9a-zA-Z]+([0-9a-zA-Z-]*[0-9a-zA-Z])*$ ConstraintDescription: Quick Start bucket name can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-). Default: aws-quickstart Description: S3 bucket name for the Quick Start assets. This string can include numbers, lowercase letters, uppercase letters, and hyphens (-). It cannot start or end with a hyphen (-). Type: String QSS3KeyPrefix: AllowedPattern: ^[0-9a-zA-Z-/.]*$ ConstraintDescription: Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slashes (/). Default: quickstart-nebulagraph-cluster/ Description: S3 key prefix for the Quick Start assets. Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slashes (/). Type: String QSS3BucketRegion: Default: 'us-east-1' Description: Amazon Region where the Quick Start S3 bucket (QSS3BucketName) is hosted. If you use your own bucket, you must specify this value. Type: String Rules: KeyPairsNotEmpty: Assertions: - Assert: Fn::Not: - Fn::EachMemberEquals: - Fn::RefAll: AWS::EC2::KeyPair::KeyName - '' AssertDescription: All key pair parameters must not be empty Mappings: AWSRegionArch2AMI: ap-northeast-1: HVM64: ami-0f8048fa3e3b9e8ff ap-northeast-2: HVM64: ami-0ea5eb4b05645aa8a ap-northeast-3: HVM64: ami-0ba140397329ef9ae ap-east-1: HVM64: ami-0d11fee2d69126ec1 ap-south-1: HVM64: ami-0ecd7c3947c3e5de8 ap-southeast-1: HVM64: ami-04ff9e9b51c1f62ca ap-southeast-2: HVM64: ami-0300dc03c13eb7660 ap-southeast-3: HVM64: ami-00c5331644ad576ad ca-central-1: HVM64: ami-0665ce57d172e712e eu-central-1: HVM64: ami-0c9354388bb36c088 eu-west-1: HVM64: ami-0d2a4a5d69e46ea0b eu-west-2: HVM64: ami-0bd2099338bc55e6d eu-west-3: HVM64: ami-0f7559f51d3a22167 eu-south-1: HVM64: ami-0fbb3ea579c01e50b eu-north-1: HVM64: ami-012ae45a4a2d92750 sa-east-1: HVM64: ami-0edc92075724775f7 us-east-1: HVM64: ami-08d4ac5b634553e16 us-east-2: HVM64: ami-0960ab670c8bb45f3 us-west-1: HVM64: ami-01154c8b2e9a14885 us-west-2: HVM64: ami-0ddf424f81ddb0720 me-south-1: HVM64: ami-0b35873acba1a6ec3 af-south-1: HVM64: ami-0ecd7c3947c3e5de8 Resources: MetaInstance: Type: AWS::EC2::Instance Metadata: AWS::CloudFormation::Authentication: S3AccessCreds: type: S3 roleName: !Ref IAMRoleName buckets: !Ref QSS3BucketName AWS::CloudFormation::Init: config: files: /tmp/nebula-install.sh: source: !Sub 'https://${QSS3BucketName}.s3.${QSS3BucketRegion}.${AWS::URLSuffix}/${QSS3KeyPrefix}scripts/nebula-install.sh' mode: '000550' owner: root group: root /tmp/vm-disk-utils.sh: source: !Sub 'https://${QSS3BucketName}.s3.${QSS3BucketRegion}.${AWS::URLSuffix}/${QSS3KeyPrefix}scripts/vm-disk-utils.sh' mode: '000550' owner: root group: root /tmp/nebula-download: source: !Sub 'https://${QSS3BucketName}.s3.${QSS3BucketRegion}.${AWS::URLSuffix}/${QSS3KeyPrefix}scripts/nebula-download' mode: '000550' owner: root group: root commands: 01-install-nebula: cwd: '/tmp/' command: !Sub 'cd /tmp; sudo dos2unix *.sh; sudo bash nebula-install.sh -c metad -m ${MetaEndpoints} -v ${NebulaGraphVersion}' Properties: NetworkInterfaces: - NetworkInterfaceId: !Ref NetworkInterfaceID DeviceIndex: '0' KeyName: !Ref KeyPairName ImageId: !FindInMap - AWSRegionArch2AMI - !Ref 'AWS::Region' - HVM64 IamInstanceProfile: !Ref IAMProfileID InstanceType: !Ref InstanceType BlockDeviceMappings: - DeviceName: /dev/sda1 Ebs: VolumeSize: 40 VolumeType: gp2 DeleteOnTermination: true Encrypted: true - DeviceName: /dev/sdf Ebs: VolumeSize: !Ref 'VolumeSize' VolumeType: !Ref 'VolumeType' DeleteOnTermination: true Encrypted: true Tags: - Key: Name Value: !Sub 'Meta-${MetaNodeIndex}' - Key: MetaNodeIndex Value: !Ref MetaNodeIndex UserData: Fn::Base64: !Sub | #!/bin/bash -xe export PATH=$PATH:/usr/local/bin cfn_fail() { cfn-signal -e 1 --stack ${AWS::StackId} --region ${AWS::Region} --resource MetaInstance exit 1 } cfn_success() { cfn-signal -e 0 --stack ${AWS::StackId} --region ${AWS::Region} --resource MetaInstance exit 0 } apt update -y apt -y install git dos2unix until git clone https://github.com/aws-quickstart/quickstart-linux-utilities.git ; do echo "Retrying"; done cd quickstart-linux-utilities source quickstart-cfn-tools.source qs_update-os || qs_err qs_bootstrap_pip || qs_err " pip bootstrap failed " qs_aws-cfn-bootstrap || qs_err " cfn bootstrap failed " cfn-init -v --stack ${AWS::StackId} --resource MetaInstance --region ${AWS::Region} || cfn_fail [ $(qs_status) == 0 ] && cfn_success || cfn_fail CreationPolicy: ResourceSignal: Count: 1 Timeout: "PT5M" Outputs: PrivateIp: Description: Private IP Address of Meta Instance Value: !GetAtt MetaInstance.PrivateIp InstanceID: Description: ID of Meta Instance Value: !Ref MetaInstance