After suffering through a prolonged low-rate environment, short-term bond ETFs are finally showing some attractive yields.

“Short-term bonds are now allowing you to pick up yield that you’re still generally not getting in any savings account, unless you hunt around for it,” Dan Egan, director of behavioral finance and investments with online investment company Betterment, told CNBC. “And that yield is likely to go up over the next two to four years as interest rates in the U.S. continue to rise.”

Interest rates have steadily pushed higher in recent months, and the Federal Reserve has signaled its intent to raise interest rates at least two more times before the end of the year to head off an overheating economy with high inflation.

“There’s been a sea change in the markets,” Matt Diczok, fixed-income strategist for Merrill Lynch and U.S. Trust, told CNBC. “The era of financial repression is over. For years the Fed funds rate had been well below inflation, so short-dated bond funds — any short-dated instruments —were losing money to inflation.”

Related: 3 Short-Term Bond ETFs for Income Hunters

While rising interest rates can drag on bond fund returns, they have less of an impact on bond funds with shorter durations. Additionally, given the flattening yield curve in the debt market, there is less incentive to chase after later-dated debt exposure.

“From post-crisis through 2017, investors in fixed income have had to move out along the curve to generate some yield, extending some duration risk, or taking a dip in quality,” Alfonzo Bruno, a research analyst for fixed-income strategies with Morningstar, told CNBC. “Now, we’re seeing investors re-allocate and revisit their risk tolerance.”

Safety In Short-Term Bonds

Consequently, short-term bonds are becoming a relatively safe investment with attractive yields as this fixed-income category may withstand both rising interest rates and inflationary risks, especially when compared to the longer-dated bond funds, whose yields are likely to dip in a rising rate environment.

Fixed-income investors can gain exposure to the short-end of the yield curve through targeted ETF plays. For example, the iShares 1-3 Year Treasury Bond ETF (NYSEArca: SHY), which has a 1.87 year effective duration, has a 2.53% 30-day SEC yield. The Schwab Short-Term U.S. Treasury ETF (NYSEArca: SCHO), which has a 1.9 year duration, comes with a 2.61% 30-day SEC yield. The Vanguard Short-Term Government Bond ETF (NYSEArca: VGSH), which has a 1.9 year average duration, shows a 2.6% yield. The SPDR Portfolio Short Term Treasury ETF (NYSEArca: SPTS) has a 1.83 year duration and a 2.63% 30-day SEC yield.

For more information on U.S. government debt, visit our Treasury Bonds category.