Canada Work Permit: Firts year tax return in Canada

All about your tax return
Unless you resided in Canada all year, you also need one or more of the following publications
Newcomers to Canada 2012 – I assume this document doesn’t apply for you if you are staying in Canada by using Work Permit.

This pamphlet is for you if you left another country to settle in Canada in 2012.
This pamphlet will introduce you to the Canadian tax system and help you to complete your first income tax and benefit return as a resident of Canada.
If you are in Canada temporarily in 2012, this pamphlet does not apply to you. Instead, see Guide T4058, Non Residents and Income Tax

Non-Residents and Income Tax 2012

Were you a non-resident in 2012?

You were a non-resident of Canada for tax purposes in 2012 if one of the following situations applies to you:

you did not have significant residential ties in Canada and you lived outside Canada throughout the year, except if you were a deemed resident of Canada. For example, you could be a deemed resident of Canada if you were an employee of the Government of Canada posted abroad. For more information, go to International and non-resident taxes;
you did not have significant residential ties in Canada and you stayed in Canada for less than 183 days in the year. Any day or part of a day spent in Canada counts as a day. If you lived in the United States and commuted to work in Canada, do not include commuting days in the calculation; or
you were deemed not to be resident in Canada under the Income Tax Act because of the provisions of a tax treaty Canada has with another country.

NR7-R Application for Refund Part XIII Tax Withheld
General Income Tax and Benefit Guide for Non-Residents and Deemed Residents of Canada – 2012

Terminate EC2 Spot/On-Demand instance by name

Declare function to terminate instance by Id

function ec2-terminate-instance($instid){
$ec2.TerminateInstances((new-object Amazon.EC2.Model.TerminateInstancesRequest).WithInstanceId($instid)).TerminateInstancesResult.TerminatingInstance[0]
}

Get instance by name and terminate it

$filter = (new-object Amazon.EC2.Model.Filter).WithName('tag:Name').WithValue('YourInstanceName')
(Get-EC2Instance -Filter $filter -Region 'us-east-1').RunningInstance | % { ec2-terminate-instance $_.InstanceId }

Schedule your Amazon EC2 spot instance startup time

Here I want to explain how to start your Amazon EC2 instance recurrently by scheduling.


I have used the AWS Tools for Windows PowerShell. You can use java command line or python library. The main goal is to explain the idea:

I am going to automate the starting of my Fitnesse server.

Create launch configuration

New-ASLaunchConfiguration Fitnesse -ImageId ami-00000000 -SecurityGroups Fitnesse -InstanceType t1.micro -SpotPrice 0.011

Create Auto Scaling group with MinSize=MaxSize=0

New-ASAutoScalingGroup Fitnesse-AS -LaunchConfigurationName Fitnesse -AvailabilityZones us-east-1a -MinSize 0 -MaxSize 0

Set the Start scheduling action
The core thing is the MinSize=MaxSize=1 and the -Recurrence argument which is in the cron scheduler time format

Write-ASScheduledUpdateGroupAction -AutoScalingGroupName Fitnesse-AS -ScheduledActionName Start -MinSize 1 -MaxSize 1 -Recurrence '15 13 * * *'

Optionl (stop event)

Write-ASScheduledUpdateGroupAction -AutoScalingGroupName Fitnesse-AS -ScheduledActionName Stop -MinSize 0 -MaxSize 0 -Recurrence '59 23 * * *'