AWS EC2 Instance Metadata
- κ°λ°μλ€μκ² μμ§ μ μλ €μ§μ§λ μμμ§λ§, λ§€μ° κ°λ ₯νλ©° μ’μ κΈ°λ₯μ΄λ€.
- μ΄ κΈ°λ₯μ EC2 μΈμ€ν΄μ€κ° μ€μ€λ‘ νμ΅νλλ‘ ν΄μ κ·Έ λͺ©μ μΌλ‘ IAM μν μ΄ νμνμ§ μμ΅λλ€.
- URL μ
http://169.254.169.254/latest/meta-data
μ΄λ€.- ν΄λΉ μμ΄νΌλ AWSμ λ΄λΆ IPλ‘ λ΄μ»΄ν¨ν°μμλ μ μμ΄μλκ³ , EC2 μΈμ€ν΄μ€μμλ§ μ€νλ©λλ€.
- λ©νλ°μ΄ν°λ‘λΆν° IAM Role μ κ²μν μλ μμ§λ§, IAM policy λ κ²μν μ μλ€.
- Metadata = EC2 μΈμ€ν΄μ€μ κ΄ν μ 보
- Userdata = EC2 μΈμ€ν΄μ€κ° μμν λμ launch script μ΄λ€.
[ec2-user@ip-192.xxx.xxx.xxx]$ curl http://169.254.169.254
# 1.0
# 2007-01-19
# 2007-03-01
# ...
# 2018-03-28
# latest
[ec2-user@ip-192.xxx.xxx.xxx]$ curl http://169.254.169.254/latest/
# dynamic
# meta-data
# user-data
[ec2-user@ip-192.xxx.xxx.xxx]$ curl http://169.254.169.254/latest/meta-data/
# ami-id
# ami-launch-index
# ami-manifest-path
# hostname
# iam/
# instance-id
# ...
# security-groups
# services
[ec2-user@ip-192.xxx.xxx.xxx]$ curl http://169.254.169.254/latest/meta-data/instance-id
# i-05adcce6993809eda
[ec2-user@ip-192.xxx.xxx.xxx]$ curl http://169.254.169.254/latest/meta-data/local-ipv4
# 172.31.3.136
μμ μ½λμμ λ³Ό μ μλ―μ΄, EC2 μΈμ€ν΄μ€ λ΄μ μ§μ μ μν΄μ http://169.254.169.254/latest/meta-data λ‘ curl μμ²μ 보λ΄λ©΄ ν΄λΉ EC2 μΈμ€ν΄μ€μ λ€μν μ€μ λ€μ κ°μ Έμ¬ μ μκ³ , μ΄κ²μ κΈ°λ°μΌλ‘ λ§μ κ²λ€μ μλν ν μ μκ² λλ€.
λκΈλ¨κΈ°κΈ°