Tejprakash Sharma

AWS, DevOps

Dynamic Port Mapping in ECS with Application Load Balancer

AWS recently launched a new Application Load Balancer (ALB) that supports Dynamic Port Mapping with ECS. It allows you to run two containers of a service on a single server on dynamic ports which ALB automatically detects and reconfigures itself. Amazon EC2 Container Service ECS is a managed container service that allows you to run...


AWS, DevOps

How to Integrate Nagios with PagerDuty

Nagios is an open-source infrastructure monitoring tool. It monitors your Hosts & Services that are defined and alerts you if any of the hosts or services go down by the different alert mechanism like email, SMS, etc. PagerDuty is an enterprise incident resolution service that gives you an alert on email, SMS & call. By...


AWS, DevOps

Attach IAM Role to an AWS Elastic Container Service Task

If you are hosting some micro websites on the AWS ECS, where every task is a separate application, and each task has running multiple containers on a Cluster. If we have a scenario where we want each of our application should upload its data to a separate AWS S3 bucket, we create a single role giving access to all S3 buckets and attach...


AWS, DevOps

Using AWS Lambda Function for AutoScaling of ECS Containers

AWS Lambda is an event-driven compute service using which you can perform actions by executing some set of code on any event. We are using a lambda function to trigger AWS ECS container auto-scaling that is executed on the SNS event. Below is the AWS Lambda code in node.js that will get Cluster Name, Service Name & Operator...


AWS, DevOps

Migrate Subdomain without Migrating Parent Domain

I had a use-case where I needed to use a subdomain and its Parent Domain already had a lot of DNS entries. So, it was very hard to manage 100+ DNS entries in a single account where you need to play with a single Subdomain. I found a solution wherein we could migrate a single Subdomain to another Domain Control (AWS) and thereby control...



AWS CodeCommit

Amazon has come up with loads of eye-popping services that reduces our workload in re:invent 2014, one such astounding service that it has launched on Day 1 of re:invent is CodeCommit. We've been investing loads of our time in managing our own source control system,  which can be reduced by using CodeCommit. It's a secured service...



Migrate from External MySQL to AWS RDS

To import data from a MySQL database that is running external to Amazon RDS, you can configure replication from that database to a MySQL RDS instance. The external MySQL database you are importing from can be running either on-premises in your data center, or in an Amazon EC2 instance. The MySQL RDS instance must be running either MySQL...


AWS, Grails

Change MySQL Timezone on Amazon RDS

Amazon RDS doesn't allow you to change timezone, It keeps same UTC time zone across all regions. time_zone variable in the parameter group is read only.You can change the time zone on each connection or session by making a procedure in default mysql database and call this function on each init connection.1.    Create a procedure for...



Amazon S3 Bucket Lifecycle

Amazon S3 offers a highly durable, scalable, and secure solution for backing up and archiving your critical data. You can set the lifecycle of the objects stored on the buckets, that will automatically delete or move these objects to the Glacier according to the set rules. Follow these steps to add the lifecycle of an bucket: ...



Allow/Reject IP at Varnish Level

I am using Varnish with Apache in one of my projects and i had a use case to allow admin panel only from few IPs. If you are using only Apache, You can easily do this by adding few rules in Apache and limit the access control, but in the case of Varnish, Apache will get only localhost IP instead of real client IP. You need to block these...



Blocking IP Addresses with False Intentions using Fail2ban

Fail2ban is a service that scans log files and ban IPs that shows malicious signs of multiple password failures, seeking for exploits, etc. It updates firewall rules to reject the IP addresses for a specified amount of time, although any arbitrary action (e.g. sending an email) can also be configured. Fail2Ban also comes with some out of...



HTTP Authentication using Nginx

I got a requirement from one of my clients to setup a staging server that has a HTTP authentication, behind an ELB. but because of authentication it fails in the ELB health check. I did the following steps to configure it with HTTP authentication. Create a single PHP or HTML file and disable HTTP authentication for this file. In the...