Monday, September 29, 2014

Amazon AWS Cloud: Change RDP default port number in order to connect to Windows instance

While this doesn't make the security unbreakable, it is a good practice as default 3389 port is most often a target to be attacked.

Here are the steps to modify the default port and use another one:

1. Make sure the Security Group assigned to the Amazon instance has proper Inbound rule defined for the new port.

2. Set up Windows firewall to allow Inbound Traffic on the new port.

3. Change default port from registry:
- Start->Run-> regedit
- Go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TerminalServer\WinStations\RDP-Tcp\PortNumber
- Change default decimal value(3389) with the new port.


Please be careful when applying this kind of changes as you may end up without being able to access your machine at all.

Thursday, September 25, 2014

Amazon AWS Cloud: Create Security Policy for IAM user to Start/Stop only specific instance

{
   "Version": "2012-10-17",
   "Statement": [
   {
   "Effect": "Allow",
      "Action": "ec2:DescribeInstance*",
      "Resource": "*"
   },
   {
      "Effect": "Allow",
      "Action": [
        "ec2:StopInstances", 
        "ec2:StartInstances"
      ],
      "Resource": [
      "arn:aws:ec2:us-west-1:account_ID:instance/i-c58ff64a"
      ]
    }
   ]
}

Sunday, September 21, 2014

Saturday, September 20, 2014

Apex Code to insert a row into a Salesforce Object

Assuming that AWS Cost is an Object with two custom Fields (Cost and Date), here is the Apex code that inserts a new row:

AWS_Cost__c ml;
ml = new AWS_Cost__c(Cost__c=12, Date__c = '8 Sep' );
insert ml;

Permission denied message from MAC command line

When getting the "Permission denied" message when trying to execute a certain file or script, here is the fix:

1. Run ls -l to see if you have execute permissions on the file

2. Run "chmod 755 file.ext" to assign proper execute permissions

3. Run "./file.ext" . It should work fine now.