Thursday, August 14, 2014

Amazon EC2: enable ICMP ping request

Amazon EC2 and its installed Windows doesn't allow ICMP ping requests by default. But you can enable this easily via the following steps:

1. Allow ICMP ping request in Windows Firewall

Open Windows Firewall and enable ALL ICMP V4 inbound rule, blow is an example from Windows Server 2012r2:
If you don't see it there, can add it by the command line:
netsh advfirewall firewall add rule name="ALL ICMP V4" protocol=icmpv4:8,any dir=in action=allow

2. Add inbound rule to Security Group of EC2

Let open the Secuirty Group of your instance on EC2, then add new inbound rules (Custom ICMP Rule / Echo Request) for your specific IP addresses (not recommend to allow all IP addresses), see below for example:

Now you can ping to your instance.
Welcome any comments and questions.
Best regards.

Thursday, August 7, 2014

MySQL: swap valĂșes of 2 columns

If you want to swap values of 2 columns (e.g. col1 and col2) in a table (e.g. a_table), you can use below SQL:

UPDATE a_table SET col1=(@temp:=col1), col1 = col2, col2 = @temp;

Do you have another ways? Pls post comment here. Thanks!
Subscribe to RSS Feed Follow me on Twitter!