'전체 글'에 해당되는 글 68건

[Python] 중지되거나 종료된 EC2 인스턴스 ID 와 타입 출력

필터를 이용하여 중지되거나, 종료된 EC2 인스턴스 ID와 타입을 출력 import boto3 ec2 = boto3.resource('ec2', region_name='ap-northeast-2') instances = ec2.instances.filter(Filters=[{'Name': 'instance-state-name', 'Values': ['stopped', 'terminated']}]) for instance in instances: print(instance.id, instance.instance_type) ## 결과 예시 ## i-0fe63429076e32630 m5.large i-0dfa1ab52da76ce92 r5.large i-08aa947cb86193c2d t2.xlarge

AWS | 2019. 7. 15. 15:48

Pod 재시작 하기

아래의 명령으로 pod 를 재시작할 수 있다. # kubectl get pod -n -o yaml | kubectl replace --force -f- # 예) # kubectl get pod heapster-c84bf57d9-j5p5q -n kube-system -o yaml | kubectl replace --force -f-

Kubernetes | 2019. 7. 15. 12:15

재부팅시 docker 컨테이너를 자동으로 시작되도록 설정하는 방법

만들때 --restart-always 옵션을 넣어주면 되는데, 빼고 컨테이너를 실행했을 때에는 아래의 명령으로 변경할 수 있다. # docker update --restart=always # 예) # docker update --restart=always d3af8191dca8

Docker | 2019. 7. 15. 10:24

[Python] AWS EC2 인스턴스에서 사용하는 EBS 볼륨 출력

EC2 인스턴스에서 사용하는 EBS 볼륨 ID 출력 import boto3 ec2 = boto3.resource('ec2', region_name='ap-southeast-1') instance = ec2.Instance('i-062807af2ec003bb6') for device in instance.block_device_mappings: volume = device.get('Ebs') print(volume.get('VolumeId')) root 볼륨의 TYPE 출력 print(instance.root_device_type) root 볼륨 디바이스네임 출력 print(instance.root_device_name)

AWS | 2019. 7. 14. 21:52

[Python] AWS EC2 인스턴스의 TYPE 출력

인스턴스 타입을 출력 import boto3 ec2 = boto3.resource('ec2', region_name='ap-southeast-1') instance = ec2.Instance('i-04785a6d8530134b1') print(instance.instance_type)

AWS | 2019. 7. 14. 21:22

[Python] AWS EC2 인스턴스 ID 출력

python 으로 EC2 인스턴스 ID를 출력하는 방법이다. > boto3 모듈이 설치되어 있어야 한다. > aws credentials 설정이 되어 있어야 한다. (aws configure 로 설정 가능) import boto3 ec2 = boto3.resource('ec2') for instance in ec2.instances.all(): print(instance.id) 다른 리전의 정보를 가지고 오기 위해서는 region_name 을 설정하면 된다. ec2 = boto3.resource('ec2', region_name='ap-southeast-1') 정지된 인스턴스의 정보를 출력할 수도 있다. for instance in ec2.instances.all(): if instance.state['..

AWS | 2019. 7. 13. 21:21