November 27, 2015

Automated cross account DNS management through CFN and API access through API gateway

It’s a general best practice to manage all DNS entries in Route53 in a centralized AWS account. In that case it is difficult to automate the DNS record creation/deletion based on resources created in another AWS account using CloudFormation. CloudFormation doesn’t yet have the capability to create resources in a different AWS account. Combining IAM role delegation, AWS Lambda & CFN Custom resources provides us a solution. I have extended the same solution by exposing the Lambda function through API gateway which provides a powerful mechanism. The illustration give below explains the solution. Read more

November 22, 2015

Obtain AMI Id from name to be used in CFN

In most cases we create custom AMI’s for various reasons like OS hardening, installing and configuring additional software, etc. If you use single AWS account to create the AMI’s and share it with other AWS accounts and use that as part of CloudFormation template, it is required to pass the new AMI Id every time. AWS Lambda comes handy for easy and elegant solution to get the latest AMI Id based on the AMI name and owner. Read more

November 15, 2015

Save AWS costs by scheduled start and stop of EC2 instances

Most of the AWS resources are billed on per-hour basis which provides us an opportunity to save cost based on the usage pattern. Especially in case of Dev/Test environment, we need them only during the working days and working hours. By using AWS Lambda function (python) in combination with EC2 instance tags, scheduled start or stop can be achieved with few lines of code. Advantages of using AWS Lambda: For 128MB memory we get 3,200,000 seconds free tier usage per month in AWS Lambda which will be more than enough for this function. IAM role will be associated with the Lambda function which will be used to perform the required task and no separate keys need to be configured. I used a tag with name as schedule & JSON string for tag value using which I could define the day and time when it needs to be started or stopped. Read more

November 6, 2015

Best editor for AWS CloudFormation template (JSON)

AWS CloudFormation template is a way to describe the AWS resources that can be created/updated/deleted and it’s in JSON format. Like many other programming languages most of the editors/IDE don’t have proper syntax highlighting for JSON. For a long time I was using notepad++ and the built-in Javascript syntax highlighting which doesn’t provide much granular highlighting. I was looking for a much better editor and finally found Atom, the most powerful editor by GitHub. It provides the ability to customize almost everything in it. It also can be extended using huge list of packages and themes. Read more

© Prakash P 2015 - 2023

Powered by Hugo & Kiss.