Scale canvas to maximum width/height, keeping aspect ratio

I’m working on a game for phones and tablets. The main menu consist of a beautiful 3:2 background image (2048x1365px) with some buttons on it. I’ve put it all on a canvas.

I want the canvas to scale to maximum width/height, keeping the aspect ratio.

If screen is 4:3 I want letterboxing (640x480px screen -> 640x427px canvas)
If screen is 3:2 I just want pure scale (960x640px screen -> 960x640px canvas)
If screen is 16:9 I want pillarboxing (1920x1080px screen -> 1620x1080px canvas)

The background image + buttons should scale and hold their position relative to the canvas.

Is this possible? I think I’ve tried everything! Any help or hint in the right direction is most welcome!

I’ve solved it myself - key was not modify the Canvas, but use the Aspect Ratio Fitter component. Here is my solution:

Setup Background Picture:
1) Choose: GameObject -> UI -> Image
2) (This also creates a Canvas and an EventSystem - leave them unchanged)
3) On the Image Component -> Source Image: Choose your background pic
4) Component -> Add...: Aspect Ratio Fitter
5) On the Aspect Ratio Fitter Component -> Set Aspect Mode: Fit In Parent
6) On the Aspect Ratio Fitter Component -> Set Aspect Ratio: 1.5 (in my case)

Setup Buttons:
1) Choose: GameObject -> UI -> Button
2) Drag the Button onto the Image so it becomes a child
3) Choose the Rect Tool (press t)
4) Drag both the rectangle corners (blue balls) and the anchers of the buttons to the right place.
   Start by snapping them and shift-drag to move both at the same time