The incident in Fredericton, the capital of the Canadian province of New Brunswick, is ongoing but police say they have one suspect in custody.
Authorities urged the public to avoid the area of the "active incident" and to "stay in their homes with doors locked".
MacCoubrey said three gunshots woke him up, and as many as 17 more were fired between that time and around 8:30 a.m. He was hiding on his kitchen floor.
David MacCoubrey says he awoke in his apartment on Brookside Drive around 7:07 a.m.
One image he reposted said: "If you think it's OK to kill or attack police officers, unfollow me now".
"He loved being a police officer and he lived for being a police officer", she said.
"Our hearts are broken by the murder of our two fearless police officers", Fredericton Mayor Mike O'Brien said in a tweet.
Fredericton Police Force Chief Leanne Fitch released the identities of the slain officers during an afternoon news conference.
The town of Fredericton is located about 70 miles from the USA border.
International Olympic Committee signs up United States crude in 1st ever term-tender deal
Energy Information Administration reported a surprise build of 3.8 million barrels in commercial crude oil inventories. Brent for October settlement traded at $74.53 a barrel on the London-based ICE Futures Europe exchange, down 12 cents.
No names have been released and condolences to the victims and families are coming from all over the country, including Victoria Police in a tweet that said, "Our hearts go out to you".
The circumstances of the shooting were not immediately known.
Three blocks of Brookside Drive have been blocked off, with emergency vehicles at both ends and curious neighbours gathered.
The area he's called home for a year, which features houses, a school and other hallmarks of a peaceful residential community, is the last place Hrubeniuk said he expected to encounter a risky situation.
Marlene Weaver, who was in bed yesterday morning when she heard shots, said: "It was scary".
Police found a man and a woman shot at the scene and set up a perimeter and a lockdown of the area, he said. While staff said they kept the doors locked, the kids carried on with normal life, playing with toys or watching a movie as the police investigation unfolded. "I called 911 and they came and checked on them and they were shot", he said.
Const. Sara Burns grew up in Fredericton and joined the local police force in 2015, soon after graduating from the Atlantic Police Academy.
"But it started before then", she said.
Jeff Gamon, co-owner of Scandimodern, a furniture store in downtown Fredericton, said he was surprised when he learned of the shooting, but not shocked.