분류 전체보기
-
[ AWS ] EC2 인스턴스 Type 변경후 재시작AWS Infra 2022. 3. 16. 20:45
import boto3 client = boto3.client('ec2') # 인스턴스 ID instance = 'i-id' # 인스턴스 중지 client.stop_instances(InstanceIds=[instance]) waiter=client.get_waiter('instance_stopped') waiter.wait(InstanceIds=[instance]) # 인스턴스 타입변경 (=> t2.small) client.modify_instance_attribute(InstanceId=instance, Attribute='instanceType', Value='t2.small') # 인스턴스 스타트 client.start_instances(InstanceIds=[instance]) 동작변화상태 ↓ ..
-
[ Prometheus ] Install jmx_exporter on Amazon Linux 2Open Source 2022. 3. 5. 01:20
- 운영체제 : Amazon Linux2 1. jmx_prometheus_javaagent-0.16.1.jar 다운로드 및 config (openJDK 1.8이고, 현재버전은 0.16.1) https://github.com/prometheus/jmx_exporter GitHub - prometheus/jmx_exporter: A process for exposing JMX Beans via HTTP for Prometheus consumption A process for exposing JMX Beans via HTTP for Prometheus consumption - GitHub - prometheus/jmx_exporter: A process for exposing JMX Beans via HTTP..
-
[ Python ] pandas를 이용한 bar graph (stacked)Python/Python For Analytics 2022. 3. 1. 12:33
1. 기본 bar 그래프 그리기 import pandas as pd month = [ 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' ] data = { "Banana":[52, 83, 82, 53, 99, 94, 83, 74, 87, 70, 63, 74], "Orange":[99, 71, 77, 57, 87, 50, 59, 58, 63, 76, 51, 88], "mango":[50, 71, 93, 82, 70, 58, 55, 97, 76, 52, 97, 83], } df = pd.DataFrame(data,index=month) df.plot(kind="bar",figsize=(15,10)) 2. 스택그래프를 그리려면, s..
-
[ AWS ] S3 전송시 성능 조정 옵션 (max_concurrent_requests - CPU 스레드 조정)AWS Infra 2022. 2. 28. 02:22
S3 고용량 파일을 전송할 때, 리소스를 사용하게 되는데, CPU를 과도하게 점유하게 되면, 옵션을 통해 조정이 가능하다. 테스트 환경은 t2.small로 해본다. 우선 테스트용 고용량 파일 준비 (fallocate 명령어를 활용) $ fallocate -l 25g test_file .... .... 26843545600 Feb 27 16:09 test_file 옵션설정을 하지 않고, 기본적으로 전송해본다. 약 14분 소요되었고, CPU의 경우 특정구간에서 100%를 사용하였다. max_concurrent_requests (CPU 스레드 조정) - 기본값 : 10 - 이 값을 낮추면 S3 전송 명령이 리소스를 덜 사용하지만, S3 전송을 완료하는 데 시간이 오래 걸릴 수 있다. - 설정방법 # 기본프로필..
-
[ Linux ] fallocate 명령어 (임의크기 파일 만들기 명령어)Linux/RedHat, CentOS, ubuntu 2022. 2. 28. 00:46
백업 등 특정 파일을 가지고 테스트를 해볼 때, fallocate 명령어는 유용하게 사용할 수 있다. 생성된 파일내용은 없으며, 크기만 할당된다. 1. 10Byte 크기의 파일을 생성하기 $ fallocate -l 10 file # -l : 지정한 크기만큼의 용량의 파일 만들기 (Byte) $ ls -l file .... .... 10 Feb 27 15:30 file $ fallocate -l 10k file # 10 kilo Bytes $ fallocate -l 10m file # 10 Mega Bytes $ fallocate -l 10g file # 10 Giga Bytes
-
[ AWS ] boto3를 이용한 S3 Bucket File 삭제카테고리 없음 2022. 2. 26. 04:39
1. S3 my-bucket 파일 삭제 import boto3 s3 = boto3.resource('s3') bucket = s3.Bucket('my-bucket') s3.Object('my-bucket', i.key).delete() 2. S3 my-bucket 파일명 'A'를 포함하는 파일 삭제 import boto3 s3 = boto3.resource('s3') bucket = s3.Bucket('my-bucket') for i in bucket.objects.all(): if 'A' in i.key: s3.Object('my-bucket', i.key).delete()