Giter VIP home page Giter VIP logo

aws-cloudformation's Introduction

Note : This repo is no longer maintained, please refer to aws-quickstart/quickstart-aerospike.

aws-cloudformation

AWS CloudFormation scripts used for Amazon's Marketplace

Download a copy of this repo using either the Download link or use git clone.

Note Starting with Aerospike 3.8.1, the Community Edition is configured to transmit anonymous usage statistics. We ask your help in making Aerospike better by leaving this feature enabled. You can learn about our goals, how we use the data, and how to disable the feature here.

Usage

Go to AWS Cloud formation console at https://console.aws.amazon.com/cloudformation/home

Change the region as per your requirement.

Uploading the template

  1. Choose "Create New Stack".

  2. Upload one of the aerospike-*-vpc.json template found in this repo.

  • aerospike-new-vpc.json is for creating a new VPC. This is the all-in-one self contained template.
  • aerospike-existing-json is for utilizing and deploying into an existing VPC. This is quicker due to not having to deploy a VPC.
  1. Click Next

Template Parameters

  1. Give a name to your stack

  2. Choose the Aerospike version you'd like to deploy.

  3. Select if you'd like to publish base statistics to Cloudwatch.

  • Statistics are: Cluster Integrity, Free Memory, Free Disk and Number of Objects
  1. Enter the size of an EBS volume you'd like to use. EBS volumes are always type gp2 and attached under /dev/sdg. Enter 0 to not use EBS volumes. An ephemeral volume is always available (if the instance type has them) under /dev/sdf

  2. Choose an instance type from the ones available at http://aws.amazon.com/ec2/instance-types/
    For more info on which instance to use, refer to Aerospike AWS Capacity Planning.

  3. Choose a valid existing keypair. If you don't have a keypair in AWS already, create one first

  4. (Optional, but suggested) Enter the URL where CloudFormation can download your customized namespace settings. This will be appended to the end of the aerospike.conf file as-is. If this option is defined, the default namespaces will be removed.

  • The simplest method is to upload a file to S3, then making the file public. The direct link is available via the properties tab of the S3 object.
  • Your custom namespace settings should take advantage of the ephemeral storage at /dev/sdf and your provisioned EBS volume at /dev/sdg.
  • Custom namespace file is everything under the namespace section of aerospike.conf file, including the namespace { } declaration.
  • See the included custom_namespace.conf file as an example
  1. Enter number of instances as required.

  2. Enter the CIDR block from which you permit SSH access. You can use many online sites like whatismyip to find out your IP. For single IP addresses appending /32 is required. Only 1 entry is permitted. If you'd like to give access to everyone/anyone, use 0.0.0.0/0

  3. Choose if you'd like dedicated tenancy. There will be additional costs with this option.

  4. Click Next

Options (Optional)

  • Enter additional tags as desired.

Advanced (Optional)

  • Enter advanced configurations as desired.
  • Click Next

Review

  • Check "I acknowledge that this template might cause AWS CloudFormation to create IAM resources." This is required for cluster discovery. See Architecture for details.
  • Review and click Create.

Go to your EC2 console and login to the instances using the IPs listed against the instances.

Fire off some load using the java benchmark client included in the instances and watch the load with AMC

System Access

SSH access is enabled on the instances under the ec2-user user using the key-pair you've selected during stack creation. You are prompted to enter the IP (in CIDR format) from where you permit SSH access also during stack creation.

Cost

  • EC2 instances
  • GP2 EBS volume per instance
  • Cloudwatch metrics per instance
    • 4 metrics x 5 minute polling ~= 35000 API requests/mo = $0.35 + $2 for 4 metrics ~= $2.35
  • SQS queue
    • 1 message on creation, 1 message per instance per scale-in. Fits into free tier. Would require a constant >2.5 scale-in events per second to exceed free tier.
  • Dedicated tenancy. See Dedicated instance pricing on AWS.

Architecture

Cloudformation will create all the VPCs, Subnets, Security Groups, Autoscaling, etc... as separate entities just for the Aerospike cluster.

Upon instance startup, instances will run a userdata script that will query AWS for instances based on the unique StackID tag CloudFormation generates. This functionality requires the ec2-describe instance policy and utilizes IAM roles for this.

This script will then parse out the private IP addresses and modify the clustering section of aerospike configs with said IPs.

This cluster is resiliant to any node being added/dropped. Additional nodes added with autoscaling will be able to automatically join the cluster. Nodes leaving the cluster must be triggered by autoscaling to guarantee data consistency. On scale-in, an SQS message will be sent with information on which node is being terminated. Each node polls SQS for its own message. Once the node finds an SQS message for itself, it first checks for data migrations. If no migrations are occuring, it will stop ASD and continues the autoscaling termination process. If there are data migrations occuring, it will interrupt the scale-in, leaving the instance running and cluster untouched, and wait for the next poll. Only 1 node may scale-in at a time to ensure no data loss. (Technically it's replication factor - 1)

By default ping, Aerospike port 3000 and AMC port 8081 are open globally (0.0.0.0/0). You may want to lock this down to just your own IP range.

Pricing

The Aerospike AMI is a free subscription. You will be prompted to subscribe to the AMI before this CF template can be used. Pricing is dependant on the instance type used. Please see EC2 pricing here. Cost will increase if launching more than 1 instance.

Clients

An AMI pre-loaded with most clients is available for quick development uptake.

Owner: 262212597706

Region AMI
us-east-1 ami-6cf30216
us-east-2 ami-e74b6682
us-west-1 ami-f092a390
us-west-2 ami-f0669888
ca-central-1 ami-3e75cc5a
eu-central-1 ami-d24afabd
eu-west-1 ami-ced911b7
eu-west-2 ami-abbba8cf
ap-northeast-1 ami-1166ac77
ap-northeast-2 ami-51ad773f
ap-south-1 ami-632e6f0c
ap-southeast-1 ami-2d6c1f4e
ap-southeast-2 ami-410aeb23
sa-east-1 ami-1d4e3271

aws-cloudformation's People

Contributors

klaven avatar mtendjou avatar sourabh3b avatar sunilvirus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-cloudformation's Issues

Bar and Test Namespaces show up in addition to custom namespace

The documentation is a little inconsistent here. In this GitHub project, the README.md states that the custom namespace is appended to aerospike.conf, which indeed appears to be happening.

However, the deploy guide states:

Specify the URL of your namespace file. This is usually an S3 URL as recommended above. This step can be skipped, in which case two RAM namespaces test and bar will be defined. They may be incorrectly sized for the instances you choose.

This stated behavior implies that bar and test would be absent if I define a custom namespace. This would be convenient because as it is, the cloudformation template creates instances with 3 namespaces (bar, test, and my custom one). Obviously, bar and test are eating into the resources for the namespace I'm indeed wanting to support.

AMI cannot be described

Trying to run the cloudformation stack with both full vpc and existing vpc yelds the following autoscaling launch configuration error: "AMI cannot be described"
Looking in the list of public Aerospike ami's the latest one that i could see available is ami-2e6dc55d with version 3.7.1 but no 3.7.2 ami available in EU-WEST-1 region.
It seems that the 3.7.2 ami has not been made publicly available but the stack reference it.

Thanks

AMIs used by Existing VPC CloudFormation template don't allow some instance types

The AMIs currently used in the Existing VPC CloudFormation template don't allow certain instance types that are reported as enabled for use in the AWS Marketplace page for Aerospike Database Enterprise Edition.

At least these instance types are not enabled on the AMI, maybe more:

  • c3
  • c4
  • c5
  • i2
  • i3
  • i3en

The problem seems to be that the AWS Marketplace CloudFormation template for "Aerospike Database Enterprise Edition" points to the AMIs for "Aerospike Database" instead of its own AMIs. You can see this in the AMIs in the "Aerospike Database Enterprise Edition" CF template:

Mappings:
  AWSAMIRegionMap:
    AMI:
      AEROSPIKEAMI: aerospike-amazonlinux2-20220508100353
    us-east-1:
      AEROSPIKEAMI: ami-05f5709c7c092d892
    us-east-2:
      AEROSPIKEAMI: ami-0ded916282885082d
    us-west-1:
      AEROSPIKEAMI: ami-0d3b55865039748fd
[...]

us-east-1 mapping uses ami-05f5709c7c092d892 when it should be using ami-021f94397f9b7296a, from what I can tell.

This results in the below error in the ASG that the CloudFormation template creates if the user doesn't happen to choose an instance type that's supported by "Aerospike Database" Marketplace's AMI image.

In this case, I was trying to launch an i3en instance type using the CloudFormation template, and it failed because the Marketplace AMI being used doesn't support it.

Launching a new EC2 instance. Status Reason: The instance configuration for this AWS Marketplace product is not supported. Please see the AWS Marketplace site for more information about supported instance types, regions, and operating systems. Launching EC2 instance failed.

This whole kerfluffle with the Marketplace products also causes a separate but closely related problem in that the ASG can't even attempt to launch the instance until the account subscribes to the "Aerospike Database" Marketplace product, even if they're already subscribed to the "Aerospike Database Enterprise Edition" Marketplace product:

Launching a new EC2 instance. Status Reason: In order to use this AWS Marketplace product you need to accept terms and subscribe. To do so please visit https://aws.amazon.com/marketplace/pp?sku=ekg8c7lctclzvufhp0gzzl8ro. Launching EC2 instance failed.

AMI ids outdated

Hardcoded ami-ids are for an older version of Aerospike and need to be updated.

Also, is there a way to update the config file by means of this cloudformation script?

Existing VPC template fails if a default VPC doesn't exist

If you run the Existing VPC CloudFormation template in an account that doesn't have a default VPC (e.g. the admin is good and removed the default VPC), the PsuedoRandom resource fails to create with the following error:

No default VPC for this user (Service: AmazonEC2; Status Code: 400; Error Code: VPCIdNotSpecified; Request ID: 1a4dcb4e-26a0-47b9-81da-8a7a711c217d; Proxy: null)

This is because the AWS::EC2::SecurityGroup CF resource uses the default VPC in the region if no VpcId parameter value is provided to it. If no default VPC exists, it bombs out.

The correct way to do this would be to specify the VpcId property in the PsuedoRandom resource and assign it the value of the VPCID stack parameter.

Also, you misspelled "pseudo" in the PsuedoRandom resource name!

This whole thing of creating a resource to generate a UID is not a good approach, IMO. If you want a UID for labelling/naming resources in the stack, just use AWS::StackId and grab the ID from the ARN it outputs using a split:

Value: !Select [2, !Split ['/', !Ref AWS::StackId]]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.