Category: Tutorial

HOST API on AWS Lambda 0

Host API using AWS Lambda & API Gateway | Serverless

In this blog, we will discuss how to set up an email sending service in AWS without running any server (EC2 Instance). Many a time its required to run a small script, but just to achieve that, developers often spin up an entire server and load it with Apache using the only fraction of the resources available on the box, this is a big wastage of CPU & RAM. This not only leaves the server vulnerable because of security issues, it also adds up to the cost. AWS Lambda | Serverless Computing AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume – there is no charge when your code is not running. With Lambda, you can run code for virtually any type of application or backend service – all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.   API Gateway Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. With a few clicks in the AWS Management Console, you can create an API that acts as a “front door” for applications to access data, business logic, or functionality from your back-end services, such as workloads running on Amazon Elastic Compute Cloud (Amazon EC2), code running on AWS Lambda, or any web application. Amazon API Gateway handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, authorization and access control, monitoring, and API version management. Amazon API Gateway has no minimum fees or startup costs. You pay only for the API calls you receive and the amount of data transferred out.   SES Amazon Simple Email Service (Amazon SES) is a cloud-based email sending service designed to help digital marketers and application developers send marketing, notification, and transactional emails. It is a reliable, cost-effective service for businesses of all sizes that use email to keep in contact with their customers. You can use our SMTP interface or one of the AWS SDKs to integrate Amazon SES directly into your existing applications. You can also integrate the email sending capabilities of Amazon SES into… Read More

Continuous Integration Pipeline 0

Continuous Integration – Small Story

When a startup starts growing up and have software background, one day or the another there will be a need to build infra for your developers. We at Tagbin are now good in numbers and working on single codebase has become critical.So today I setup a very small continuous integration pipeline.   [If you are interested in more advanced pipeline including Docker & Jenkins that I am currently working on, check this link: ] To start with continuous integration is basically a automated develop-test-build-deploy pipeline.Many tech giants use a complex version of it, but this blog will explain how to get up and running very fast with a small pipeline and trust me this is all you will need to start off. First thing Version Control, there are three alternatives: 1) Git on Github 2) Git on Bitbucket 3) Git on your own server (Try Gitlab, its really amazing with almost all the features of GitHub, I will be shifting to it very soon) I choose Bitbucket, the reason being, free unlimited private repository. Second thing is Test Suite: This depends on whatever technology or platform you are working on, you can either run it on your local machine or make it part of deployment pipeline. Finally Deployment: I used Bitbucket’s Web Hook for it. Pipeline Flow: When you done writing code, push it to remote git account(bitbucket in our case),before pushing it to master a test suite will run to check if you are breaking any body’s code and the a final push is made which in turn will fire a WebHook added earlier. This Webhook is basically a script that receives request from bit bucket regarding different events, if the event is a push to master the script will automatically pull the content from the master and put it on development/stagging server based on your configuration.   The Script There is whole big file I wrote that does lot of housekeeping, but the below lines will be enough: <?php exec(‘git config –global credential.helper “cache –timeout=3600” 2>&1’, $output); echo(‘Setting up Password in cache… ‘.implode(‘ ‘, $output)); exec(‘git reset –hard HEAD 2>&1’, $output); echo(‘Reseting repository… ‘.implode(‘ ‘, $output)); //The URL will changes based on where your code is hosted exec(‘git pull 2>&1’,$output); echo(‘Pulling content… ‘.implode(‘ ‘, $output)); ?>   Put this php script under any http server, that is accesible publically and is on same machine on which you… Read More

Using openCV in c# 0

Using OpenCV in C#

I am writing this blog post to explain how opencv can be used in C# WPF/Windows Form application. Emgucv ( is a wrapper over opencv than can be used in C# application, the steps are: STEP 1: Create x86/x64 directory in Debug/Release folder and copy all the DLLS present in your emgucv installation directory.   STEP 2: After copying these DLLS in   “bin/Debug/x86” or “bin/Debug/x64”  same for Release add these lines in you code: using Emgu.CV; using Emgu.CV.Util; using Emgu.CV.CvEnum; using Emgu.CV.Structure;   Note: Don’t forgot to add reference, by right clicking on project in solution explorer->add refrence. and pointing to those DLLS. You can use Emgu provided toolbox element, by right clicking in toolbox section->choose items and then inside .NET framework tab, browse to emgu installation directory and select EMGU.CV.UI.dll and press OPEN, then you will see IMAGEBOX inside you toolbox components, and you can use it by dragging and dropping in to the UI(only for Windows Form Application). To know more shoot me at


Linux Custom Command

This is very short tutorial to get you started on creating custom command in linux. Lets say you are working on some project, and every time you start, you need to navigate to the directory and manually start the script and extra house keeping task. So how about you just write a command from your terminal “do-this” and every thing is all set-up to get started with, here is what you can do: You are actually setting up aliases. STEP 1: Open your terminal and type following command sudo nano ~/.bashrc STEP 2: What ever your commands are, just add under alias like this alias do-this = ‘python  /var/www/’ and save it. STEP 3: Log in back, and just type do-this and you are done. Now you can use your custom command “do-this” every time you want to get started, also you can chain lot of command by using semicolon  “;”

Setting up XMPP server (ejabberd) on Ubuntu 1

Setting up XMPP server (ejabberd) on Ubuntu

Today i was setting up XMPP server (ejabberd), so i thought i should write what i learnt. First of all you need to decide which XMPP server you want to deploy, in my case “ejabberd”. Here is the process to deploy on Ubuntu: 1) First of all install ejabberd using the command. sudo apt-get install ejabberd This command will set up all the necessary thing for ejabbered in /etc/ejabberd 2) Now you need to register user for your Server, the command is: ejabberdctl register admin localhost password Your password in place of  “password”  in command above. 3) Now you need to change few thing in the configuration file. sudo nano /etc/ejabberd/ejabberd.cfg   and change following thing in the file, here admin is the username and localhost is the server, you should add your own {hosts, [“localhost”,””]}.  %% Admin user {acl, admin, {user, “admin”, “localhost”}}. %% Hostname {hosts, [“localhost”]}. 4) Restart ejabber sudo service ejabberd restart Bravo, the server is all set now you can access its Web panel form: Then you need to enter your credentials user: pass: password  (you changed in STEP 2) Now from this panel you can add/delete/check users, IMPORTANT: if you are setting it up on AMAZON you need to open following ports 5280, 5222   Now you can use XMPP client to chect ex: pigdin   Shoot me at   Regards Ankit Sinha

Install FTP on EC2 Intance 0

Install FTP on EC2 Intance

Step #1: Install VSFTPD sudo apt-get install vsftpd Step #2: Open up the FTP ports on your EC2 instance Log in to AWS management Console, go to EC2 Instance, select Security Group from Dashboard and add a port range 20-21. If FTP is not present just make it a custom rule. Add & Save. Step #3: Make updates to the vsftpd.conf file Edit your vsftpd conf file by typing: > sudo vi /etc/vsftpd/vsftpd.conf or >sudo nano /etc/vsftpd.conf (USE THIS) Disable anonymous FTP by changing this line: anonymous_enable=YES to anonymous_enable=NO Then add the following lines to the bottom of the vsftpd.conf file: pasv_enable=YES pasv_min_port=1024 pasv_max_port=1048 pasv_address=<Public IP of your instance> Your vsftpd.conf file should look something like the following – except make sure to replace the pasv_address with your public facing IP address: Step #4: Restart vsftpd Restart vsftpd by typing: > sudo /etc/init.d/vsftpd restart or >sudo service vsftpd restart You should see a message that looks like: Step #5: Create an FTP user If you take a peek at /etc/vsftpd/user_list, you’ll see the following: # vsftpd userlist # If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a password. # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers # for users that are denied. root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody This is basically saying, “Don’t allow these users FTP access.” vsftpd will allow FTP access to any user not on this list. So, in order to create a new FTP account, you may need to create a new user on your server. (Or, if you already have a user account that’s not listed in /etc/vsftpd/user_list, you can skip to the next step.) Creating a new user on an EC2 instance is pretty simple. For example, to create the user ‘bret’, type: > sudo adduser bret > sudo passwd bret Here’s what it will look like: