Close

Request a demo

CliQr's groundbreaking technology makes it fast and efficient for businesses to move, manage and secure applications onto any private, public or hybrid cloud environment.

CliQr is now part of Cisco Learn More About Cisco
Request a Demo

Blog

Extending CloudCenter Service for DynamoDB

One of the biggest trends in cloud is using cloud provided services rather than creating and managing your own VM-based services. Extending CloudCenter’s services library through the new External Services functionality lets you use these services along side any other service you application might need.

In my last post, I talked about the new types of services available and examples of services each can be used to supply.

In my rant this week, the focus will be on the External Service type and connecting to Amazon Web Services to create a DynamoDB instance. DyanmoDB provides a NoSQL database and is an example of what we at CliQr consider a platform service because it’s:

  1. Hosted by a cloud platform and therefore cloud specific
  2. Requires no creation of virtual infrastructure
  3. Requires no installation of software
  4. Requires no ongoing service maintenance

This is a good time to make note that generally our application profiles are cloud agnostic so that they can be deployed to any cloud, but because DynamoDB is a platform specific service, modeling a CloudCenter application profile with this service will limit your target cloud options for deploying. If flexibility is important for your organization, I would recommend one of the following solutions:

  1. Automating the deployment of a similar service through CloudCenter to deliver the value of speed and agility for users while maintaining cloud portability. An example would be to use MongoDB rather than then AWS specific DynamoDB
  2. Use multi-cloud deployment functionality (available in CloudCenter 4.4 and above) which allows users to deploy specific application tiers to different clouds. In this case, DynamoDB could be in AWS, and the rest of the services in another cloud

This walkthrough will use Python to run a script to call AWS. Along the way, we’ll install Boto3 and other tools to help make our lives easier. The end result will be a DynamoDB table called “users” with only two columns—“username” and “last_name”. The script came from an example that AWS has published here.

Preparation

  1. Download the service start and stop scripts, bundled together here
  2. Ensure that you have an AWS user account with a valid access key (both key and secret key)
  3. Have the target AWS region name ready (ex: us-east-1)

Once you have downloaded the scripts you’ll see 3 pieces of information in each script that you need to fill in: **YOUR_KEY**, **YOUR_SECRET_KEY**, and **YOUR_AWS_REGION**. This information is required to connect to the AWS API via Boto3 SDK. In later articles, we’ll show you how to let users provide credentials at deploy time rather than hard coding them to the script.

Steps

  1. Upload the start and stop scripts that you modified to a CloudCenter accessible URL or repository
  2. Logged in as a tenant owner or co-admin, navigate to Admin> Infrastructure heading> Services
  3. Create a new service
  4. Select a Service Type: External Service
  5. Fill in required fields like name, service ID, category (to make it easier to find later on), and a cost per hour.
  6. Enter the location of the service scripts
    1. Start field: Choose either URL or repository (based on where you uploaded the “dynamodemo.sh” script to)
    2. Start field value: relative location on repository or URL to the script
    3. Stop field: Choose either URL or repository (based on where you uploaded the “dynamodemodelete.sh” script to)
    4. Stop field value: relative location on repository or URL to the script
  7. Save the service
  8. Model a new N-Tier application profile, drag in the newly created DynamoDB service from the services library
    Screen Shot 2016-01-18 at 1.56.39 PM
  9. Fill in all required fields and save the application profile

Test your work

  1. Deploy the DynamoDB application profile
  2. Log into AWS console
  3. Make sure you’re in the region you specified in the scripts
  4. Navigate to the DynamoDB area and there should be a new table called “users”
  5. In CloudCenter, go into the deployments area and terminate the DynamoDB deployment
  6. The DynamoDB instance should be removed from AWS

Note that regardless of the cloud you choose from the dropdown list in the deployment screen, the service will be deployed in the AWS region you speficied in the scripts. In later articles, we will talk more about how you can parameterize these and other variables to not be static.

Extra Credit

As I mentioned in the previous blog article, for security, CloudCenter External Services use an ephemeral Docker container that’s destroyed after every use to run these scripts and commands. That means that regardless of what you’re connecting to, there will be work that has to happen each time. In the case of connecting to AWs, regardless of which AWS service you want to use, you have to install the Python SDK (Boto3) and supporting tools each time.

The scripts I’ve provided do a lot of this work for you. If you wanted to use these scripts for any other AWS service, all you would have to do is put your Python commands into the highlighted area here:

#Building Python Script
echo “[default]
aws_access_key_id = **YOUR_KEY**
aws_secret_access_key = **YOUR_SECRET_KEY**
region=**YOUR_AWS_REGION**” > ~/.aws/credentials

echo “
import boto3
dynamodb = boto3.resource(‘dynamodb’)
table = dynamodb.Table(‘users’)
table.delete()
” > dynamodb.py

Comments are closed

Stay Informed

Subscribe to our email list for company updates.

CliQr Technologies, CliQr CloudCenter and CloudBlades are trademarks of CliQr Technologies, Inc. All other registered or unregistered trademarks are the sole property of their respective owners.