Using Mac Terminal to connect your ECS

1. Find your Internet IP

 Find your Internet IP
You are expected to find your Internet IP in Instances --> IP address

2. Open your Mac Terminal using the following command

  1. Input your username and ip with ssh command

ssh + space+[username] + @+ [Internet IP Address]

  1. Input your password

NB: The process of inputing password is invisible

// An example
Last login: Thu Jul 25 21:26:58 on ttys000
Yao:~ mac$ ssh root@47.277.81.23
root@47.277.81.23's password: 
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-52-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


Welcome to Alibaba Cloud Elastic Compute Service !

Last login: Fri Jul 26 04:22:40 2019 from 171.128.107.223
root@Yao:~# 

3. Now, You have successfully got your ECS connected

To connect to an HTTP endpoint using Java programming, you can use the HttpURLConnection class provided in the Java standard library. Here is an example code snippet: ```java import java.net.HttpURLConnection; import java.net.URL; import java.io.BufferedReader; import java.io.InputStreamReader; public class HttpExample { public static void main(String[] args) { try { // Create a URL object for the endpoint URL url = new URL("http://example.com/api/endpoint"); // Create an HttpURLConnection object HttpURLConnection con = (HttpURLConnection) url.openConnection(); // Set the request method (GET, POST, etc.) con.setRequestMethod("GET"); // Read the response from the endpoint BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); // Print the response to the console System.out.println(response.toString()); } catch (Exception e) { e.printStackTrace(); } } } ``` In this example, we create a URL object for the endpoint we want to connect to, and then create an HttpURLConnection object with that URL. We set the request method to "GET", which is the most common method for retrieving data from an HTTP endpoint. We then read the response from the endpoint using a BufferedReader, and append each line of the response to a StringBuffer. Finally, we print the response to the console. Note that this is just a basic example, and there are many different ways to connect to an HTTP endpoint in Java, depending on your specific requirements.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值