2
2
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
* SPDX-License-Identifier: Apache-2.0
4
4
*/
5
- import * as vscode from 'vscode'
6
5
import { InstanceStateManager , getStateManagerForSelection } from './instanceStateManager'
7
6
import { Ec2InstanceNode } from './explorer/ec2InstanceNode'
8
7
import { Ec2Node } from './explorer/ec2ParentNode'
@@ -11,6 +10,8 @@ import { Ec2Prompter, instanceFilter } from './prompter'
11
10
import { Ec2Selection } from './utils'
12
11
import { Ec2Instance } from '../shared/clients/ec2Client'
13
12
import { openUrl } from '../shared/utilities/vsCodeUtils'
13
+ import { getAwsConsoleUrl } from '../shared/awsConsole'
14
+ import globals from '../shared/extensionGlobals'
14
15
15
16
export async function refreshExplorer ( node ?: Ec2Node ) {
16
17
await node ?. refreshNode ( )
@@ -47,8 +48,10 @@ export async function rebootInstance(node?: Ec2Node) {
47
48
await stateManager . rebootInstanceWithCancel ( )
48
49
}
49
50
50
- export async function linkToLaunchInstance ( ) {
51
- const url = vscode . Uri . parse ( 'https://google.com' )
51
+ export async function linkToLaunchInstance ( node ?: Ec2Node ) {
52
+ // Ex. https://us-west-2.console.aws.amazon.com/ec2/home?region=us-west-2#LaunchInstances:
53
+ const region = node ? node . regionCode : globals . regionProvider . guessDefaultRegion ( )
54
+ const url = getAwsConsoleUrl ( 'ec2' , region )
52
55
await openUrl ( url )
53
56
}
54
57
0 commit comments