TortoiseGit – Key Generator

Here is a little gotcha that I have encountered before.  When creating public\private keys for use with Git and TortoiseGit, I seem to have no problem using PuttyGen.  (How To Link)

However, when I use SSH-KeyGen, I seem to encounter the following error while connecting to Git.

  • Couldn’t load this key (OpenSSH SSH-2 private key)

So here is the deal.  My install of TortoiseGit uses Pageant to store private key for use.  This program only really recognizes private keys in the .ppk format, which is the Putty format.

So what you can do with the KeyGen private key is, convert it to .ppk using PuttyGen.  Its pretty easy to do, just click the Load button from PuttyGen, select your file, enter your phrase, and then save the file (.ppk) back to disk.  Now update Tortoise (remote) to use this new .ppk file.

tortoise

EC2 – Run Instances – InstanceId

So you are creating EC2 instances from the AWS CLI and\or Python using BOTO 3 and you want to get the InstanceId afterwards.  Below are the method(s) I use in each scenario.

Create 1 EC2 Instance with AWS CLI:

Example Command:

aws ec2 run-instances --profile <value> --image-id <value> --security-group-ids <value> --count 1 --instance-type <value> --subnet-id <value> --query 'Instances[0].InstanceID'

Create multiple EC2 Instances with Python\Boto3:

Example Command:

ec2_session_client = session.client('ec2')
response = ec2_session_client.run_instances(ImageID="value",SecurityGroupIds=["value"],MaxCount=value,MinCount=value,InstanceType="value",SubnetId="value")
for instance in response["Instances"]:
   if 'InstanceId' in instance"
      print (instance['InstanceId'])

So these are just a couple ways to grab the InstanceId for use later in your script.

aws_instanceid.png

CapitalOne – Cloud Custodian

This free Open Source tool, Cloud Custodian, is an interesting program that can be used help manage your AWS environment(s), ensuring compliance via policies written using YAML.

Thinking about this more, it seems like you could execute the polices via Lambda, or even a local Jenkins instance via a reoccurring schedule.

I would suggest storing your YAML policy files in Git and pulling them from there as needed.

Useful Links:

  • Python Home Instance – https://pypi.python.org/pypi/c7n
  • Capital One Custodian Home – https://developer.capitalone.com/opensource-projects/cloud-custodian/
  • Capital One Custodian Docs – http://www.capitalone.io/cloud-custodian/docs/overview/index.html
  • Git Location – https://github.com/capitalone/cloud-custodian/blob/master/README.rst

github-octocat.png

AWS S3 Storage Classes – Tech Talk Notes

I listened to a Tech Talk on AWS S3 recently.  They covered some high-level stuff, and then some low-level stuff.

High-Level (S3 Storage Classes)

  • Amazon S3 Standard – Active Data (S)
  • Amazon S3 Standard-Infrequent Access Data (SIA)
  • Amazon Glacier – Archive Data

Low-Level (Storage Class Analysis)

s3_image

Slack – Notification – PowerShell

I recently started using Slack more, specifically with custom notifications sent from outside Slack to my Slack channel.

There are many different ways to do this.  For this blog post, I will show you how I setup message sending with PowerShell.

PowerShell (Super Easy!)

  1. Use the PSSlack module to make things easy.
  2. Install this module on your server\workstation.
  3. Obtain your legacy token from here for your Slack instance.
  4. Setup your VS PowerShell project.  (Unreliable VS 2015 PS add-in)
  5. Write some easy code and have a tool like Jenkins run the program as needed!
    • Note, you will need to set the Token variable yourself.
    • You can select your message emoji from this list.
New-SlackMessageAttachment -Color $_PSSlackColorMap.green `
 -Title 'The Flask Build Deployment Passed' `
 -TitleLink https://www.devopsunleashed.com `
 -Text 'Great job!' `
 -Pretext 'Build Deployment Alert' `
 -AuthorName 'DevOpsUnleashed' `
 -AuthorIcon 'IMAGE_PATH_HERE' `
 -Fallback 'Your client is bad' |
New-SlackMessage -Channel '#build-results-flask' -Username "Build Notifier" `
 -IconEmoji :checkered_flag: |
Send-SlackMessage -Token $Token

You should get a nice message to your Slack channel!

Slack1

One of my main attributes of a good DevOps team is collaboration, the other being automation.  Slack is a great tool to assist in improving collaboration, and even allows for some cool automation!

slack-2014

AWS CLI and Output Filtering

I love the AWS CLI –query option.  It allows you to pull out the relevant data you are looking for and display it in a nice table format.

There are a couple different ways to determine what the correct query parameters are.

#1 – Run your command and parse through the JSON that is returned.  The JSON will show you exactly what element(s) you can query on.

Example: aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId, Monitoring.State]’ –output table

#2 – Review the AWS CLI documentation. (e.g. describe-instance-status)  On this page you will want to examine the “Output” section, which gives you the same information as #1, but with a different view.

awscli.png

Example: aws describe-instance-status –query ‘InstanceStatuses[*].AvailabilityZone’ –output table

Overall using the query option is pretty easy and at the same time pretty powerful!

AmazonWebservices_Logo.svg_

Scrum Retro – Forgetful – Mailbox

So you are on a Scrum team that performs retro’s at the end of an iteration\sprint.  And during the beginning of these retro’s, everyone ponders (or tries to remember) what went well and what didn’t go so well.  Pretty common issue for many Scrum teams.

Possible Solution – Setup a Scrum mailbox that team members can drop notes into during the iteration.  Place the mailbox by the morning Scrum location for easy access.

CSM_Logo_626_561_Clear

AWS Chalice – I must try it!

Traditional REST API Setup in AWS

  • Multiple EC2 instances
  • Part of an Auto Scaling group
  • Setup with an Elastic Load Balancer
  • Code is manually deployed with your tool of choice (e.g. Ansible)
  • CloudWatch for monitoring

Serverless REST API Setup in AWS

  • Amazon API Gateway (front door)
  • API Gateway handles monitoring, access, and authorization
  • AWS Lamda is configured as the back-end (Pay compute time only)
  • No EC2 servers to manage, AWS handles it
  • Manually setup or extensive SDK scripting needed

Chalice Serverless REST API Setup in AWS

  • Chalice is a Python package with syntax similar to Flask.
  • Main Chalice components
    • App object, routes, and app.py file
  • Chalice allows you to “quicky” deploy your Python API via the Chalice CLI to AWS
  • Auto generated IAM policy
  • API Gateway and Lamda are used “behind” the scenes and automatically configured

AmazonWebservices_Logo.svg_.png

VSTS – New User Email Address

I just created a new Visual Studio Team Services account and wanted to add some colleagues to the account.  However, my colleagues do not have Outlook or Hotmail user accounts.  What to do?

After some quick research, it turns out that because this new VSTS account is not backed by Azure AD (I didn’t expect it to be), they would need to create new Microsoft accounts.

vstsad.png

The following is directly from the VSTS docs.

  • If new users don’t have Microsoft accounts, have them sign up.

I assume this would mean have them get a new (@Hotmail, @Outlook) account.

VSTS-2015

Oracle Coherence – VisualVM Plugin

If you are doing any work with Oracle Coherence clusters and caches, you MUST download the VisualVM Coherence plugin.  It gives a great view of the cluster, members, state, and statistics.

jvisualvm_members_small

Information and download – https://blogs.oracle.com/oraclecoherence/new:-visualvm-plugin-for-coherence-released-through-the-coherence-incubator

For a full view of the cluster, you will want to connect to the “monitor” JMX instance with the following properties set below.  This role has visibility to all members in the cluster.

  • tangosol.coherence.management=all
  • tangosol.coherence.management.remote=true