0% found this document useful (0 votes)
31 views

Meta Data Fetch From Linux

linux

Uploaded by

dadoppubg
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Meta Data Fetch From Linux

linux

Uploaded by

dadoppubg
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Using username "ec2-user".

Authenticating with public key "MyMumbaiKey"


, #_
~\_ ####_ Amazon Linux 2023
~~ \_#####\
~~ \###|
~~ \#/ ___ https://aws.amazon.com/linux/amazon-linux-2023
~~ V~' '->
~~~ /
~~._. _/
_/ _/
_/m/'
Last login: Wed Aug 16 04:33:47 2023 from 152.58.71.204
[ec2-user@ip-172-31-38-42 ~]$ sudo su -
Last login: Wed Aug 16 04:33:53 UTC 2023 on pts/1
[root@ip-172-31-38-42 ~]# aws s3 ls
2023-08-16 04:06:13 mybkt191001
2023-08-03 04:26:22 mylifecycle19
2023-08-01 07:01:33 myprojectbucket1910
2023-08-02 04:27:00 mysystembucket321
2023-08-02 04:03:26 mysystum123
2023-08-03 09:14:09 mytestbkt1910
[root@ip-172-31-38-42 ~]# cd
[root@ip-172-31-38-42 ~]# ls -a
. .. .bash_history .bash_logout .bash_profile .bashrc .cshrc .ssh .tcshrc
[root@ip-172-31-38-42 ~]# curl http://169.254.169.254/latest/meta-data/
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>401 - Unauthorized</title>
</head>
<body>
<h1>401 - Unauthorized</h1>
</body>
</html>
[root@ip-172-31-38-42 ~]# TOKEN=`curl -X PUT
"http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds:
21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v
http://169.254.169.254/latest/meta-data/
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 56 100 56 0 0 7713 0 --:--:-- --:--:-- --:--:-- 8000
* Trying 169.254.169.254:80...
* Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
> GET /latest/meta-data/ HTTP/1.1
> Host: 169.254.169.254
> User-Agent: curl/8.0.1
> Accept: */*
> X-aws-ec2-metadata-token:
AQAAAASiZczrWVr4Wqw5UAK7PSs9Mdy8uG78mOjXx0Bao5gki7avOQ==
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Accept-Ranges: bytes
< Content-Length: 325
< Content-Type: text/plain
< Date: Wed, 16 Aug 2023 04:52:03 GMT
< Last-Modified: Wed, 16 Aug 2023 04:39:09 GMT
< X-Aws-Ec2-Metadata-Token-Ttl-Seconds: 21600
< Connection: close
< Server: EC2ws
<
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hostname
iam/
identity-credentials/
instance-action
instance-id
instance-life-cycle
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups
services/
* Closing connection 0
system[root@ip-172-31-38-42 ~]# TOKEN=`curl -X PUT
"http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds:
21600"` && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v
http://169.254.169.254/latest/meta-data/public-ipv4
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 56 100 56 0 0 8682 0 --:--:-- --:--:-- --:--:-- 9333
* Trying 169.254.169.254:80...
* Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
> GET /latest/meta-data/public-ipv4 HTTP/1.1
> Host: 169.254.169.254
> User-Agent: curl/8.0.1
> Accept: */*
> X-aws-ec2-metadata-token:
AQAAAASiZcxRVE9c3LI7sN6ejj3e2wLOu7NDqau4dnHhc4LBNFw0zw==
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Accept-Ranges: bytes
< Content-Length: 14
< Content-Type: text/plain
< Date: Wed, 16 Aug 2023 04:52:59 GMT
< Last-Modified: Wed, 16 Aug 2023 04:25:18 GMT
< X-Aws-Ec2-Metadata-Token-Ttl-Seconds: 21600
< Connection: close
< Server: EC2ws
<
* Closing connection 0
13.234.226.105[root@ip-172-31-38-42 ~]# TOKEN=`curl -X PUT
"http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds:
21600"` && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v
http://169.254.169.254/latest/meta-data/instance-id
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 56 100 56 0 0 9247 0 --:--:-- --:--:-- --:--:-- 9333
* Trying 169.254.169.254:80...
* Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
> GET /latest/meta-data/instance-id HTTP/1.1
> Host: 169.254.169.254
> User-Agent: curl/8.0.1
> Accept: */*
> X-aws-ec2-metadata-token:
AQAAAASiZcyMjoLxTvbjhfotHPCrDklO0VwpCwChVXKRVm4N45y42g==
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Accept-Ranges: bytes
< Content-Length: 19
< Content-Type: text/plain
< Date: Wed, 16 Aug 2023 04:56:54 GMT
< Last-Modified: Wed, 16 Aug 2023 04:25:18 GMT
< X-Aws-Ec2-Metadata-Token-Ttl-Seconds: 21600
< Connection: close
< Server: EC2ws
<
* Closing connection 0
i-08d46909fb7ff63a6[root@ip-172-31-38-42 ~]#

You might also like