forked from awslabs/aws-saas-boost
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Launch AWS ElasticSearch Service per tenant #2
Merged
tieujason330
merged 2 commits into
TachyonNexus:main
from
tieujason330:add-elasticsearch
Dec 9, 2021
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# Copyright 2020 Daniel Cortez Stevenson | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Original: https://gist.github.com/daniel-cortez-stevenson/ | ||
# modified: https://github.com/AffiTheCreator | ||
# | ||
--- | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: SaaS Boost Tenant Onboarding AWS Elasticsearch Service (ES) | ||
Parameters: | ||
TenantId: | ||
Description: The GUID for the tenant | ||
Type: String | ||
TenantSubDomain: | ||
Description: The subdomain for this tenant | ||
Type: String | ||
DomainName: | ||
Description: The hosted zone domain name | ||
Type: String | ||
ECSSecurityGroup: | ||
Description: Source security group for ECS to access EFS | ||
Type: AWS::EC2::SecurityGroup::Id | ||
CustomEndpointEnabled: | ||
Type: String | ||
AllowedValues: ['true', 'false'] | ||
Default: 'false' | ||
EnforceHTTPS: | ||
Type: String | ||
AllowedValues: ['true', 'false'] | ||
Default: 'false' | ||
ESPortHTTP: | ||
Type: String | ||
Default: '80' | ||
ESPortHTTPS: | ||
Type: String | ||
Default: '443' | ||
TLSSecurityPolicy: | ||
Type: String | ||
AllowedValues: ['true', 'false'] | ||
Default: 'false' | ||
ElasticsearchName: | ||
Description: The name of the AWS Elasticsearch Service deployment. | ||
Type: String | ||
ConstraintDescription: Must be a valid AWS ES domain name prefix. The name must start with a | ||
lowercase letter and must be between 3 and 28 characters. Valid characters | ||
are a-z (lowercase only), 0-9, and - (hyphen). | ||
AllowedPattern: '[a-z][a-z0-9\\-]+' | ||
ElasticsearchVersion: | ||
Default: '6.2' | ||
Type: String | ||
ConstraintDescription: Must be an allowed AWS ES version (Major.Minor) | ||
AllowedValues: ['7.10', '7.9', '7.8', '7.7', '7.4', '7.1', '6.8', '6.7', '6.5', '6.4', '6.3', '6.2', '6.0', '5.6', '5.5'] # aws es list-elasticsearch-versions --query "ElasticsearchVersions[]" | ||
ElasticsearchDataInstanceType: | ||
Description: Instance type for data nodes. | ||
Type: String | ||
Default: 'r5.2xlarge.elasticsearch' | ||
NumberOfMasterNodes: | ||
Description: How many dedicated master nodes you want to have. 3 is recommended. | ||
Type: Number | ||
Default: 3 | ||
NumberOfDataNodes: | ||
Description: How many data nodes you want to have. Multiples of your number of availability zones (2) is recommended. | ||
Type: Number | ||
Default: '2' | ||
MinValue: '1' | ||
MaxValue: '20' | ||
EBSEnabled: | ||
Description: 'Specifies whether Amazon EBS volumes are attached to data nodes in the Amazon ES domain (some instance types come with instance store that you can use instead).' | ||
Type: String | ||
AllowedValues: ['true', 'false'] | ||
Default: 'true' | ||
EBSVolumeSize: | ||
Description: 'The size of the EBS volume for each data node. The minimum and maximum size of an EBS volume depends on the EBS volume type and the instance type to which it is attached.' | ||
Type: Number | ||
Default: '10' | ||
Username: | ||
Description: Master username for ElasticSearch | ||
Type: String | ||
Password: | ||
Description: Master user password for ElasticSearch | ||
Type: String | ||
Conditions: | ||
ShouldEnforceHTTPS: !Equals [ !Ref "EnforceHTTPS", "true" ] | ||
Resources: | ||
ElasticsearchDomain: | ||
Type: AWS::Elasticsearch::Domain | ||
Properties: | ||
ElasticsearchVersion: !Ref ElasticsearchVersion | ||
DomainName: !Ref ElasticsearchName | ||
DomainEndpointOptions: | ||
EnforceHTTPS: !Ref EnforceHTTPS | ||
EBSOptions: | ||
EBSEnabled: !Ref EBSEnabled | ||
Iops: 0 | ||
VolumeSize: !Ref EBSVolumeSize | ||
VolumeType: standard | ||
ElasticsearchClusterConfig: | ||
InstanceCount: !Ref NumberOfDataNodes | ||
InstanceType: !Ref ElasticsearchDataInstanceType | ||
ZoneAwarenessEnabled: false | ||
AdvancedOptions: | ||
rest.action.multi.allow_explicit_index: "true" | ||
AdvancedSecurityOptions: | ||
Enabled: true | ||
InternalUserDatabaseEnabled: true | ||
MasterUserOptions: | ||
MasterUserName: !Ref Username | ||
MasterUserPassword: !Ref Password | ||
EncryptionAtRestOptions: | ||
Enabled: true | ||
NodeToNodeEncryptionOptions: | ||
Enabled: true | ||
SnapshotOptions: | ||
AutomatedSnapshotStartHour: 0 | ||
AccessPolicies: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
AWS: '*' | ||
Action: "es:*" | ||
Resource: !Sub "arn:aws:es:${AWS::Region}:${AWS::AccountId}:domain/${ElasticsearchName}/*" | ||
Tags: | ||
- Key: Tenant | ||
Value: !Ref TenantId | ||
Outputs: | ||
Arn: | ||
Value: !GetAtt ElasticsearchDomain.Arn | ||
ESDomainArn: | ||
Value: !GetAtt ElasticsearchDomain.DomainArn | ||
ESDomainEndpoint: | ||
Description: Elasticsearch endpoint | ||
Value: !GetAtt ElasticsearchDomain.DomainEndpoint | ||
ESClusterName: | ||
Description: The Elasticsearch Cluster | ||
Value: !Ref ElasticsearchName | ||
ESClusterPort: | ||
Description: Listening Port of Elasticsearch cluster | ||
Value: !Ref ESPortHTTPS | ||
ESUsername: | ||
Description: Elasticsearch login username | ||
Value: !Ref Username | ||
ESPassword: | ||
Description: Elasticsearch login password | ||
Value: !Ref Password | ||
... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tieujason330 I assume this is auto-scaled based on demand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no this is a fixed amount of nodes being used, there's no auto-scaling option for aws elasticsearch. or we'd need to handle it ourselves