최신 글
-
Amazon EKS (k8s) namespace 삭제가 안될 경우 (terminating status)
개요Amazon EKS에서 namespace를 삭제할 때 terminating으로 상태가 멈춰 있을 경우namespace 및 current context 확인 기능 추가 (2024.10.08)지우려는 대상 namespace가 있는 지 확인 기능 추가 (2024.10.15) 스크립트#!/bin/bash# Define the stuck namespace as a variableNAMESPACE=$1# Check if the namespace is providedif [ -z "$NAMESPACE" ]; then echo "Usage: $0 " exit 1fi# Check if the namespace existsif ! kubectl get namespace "$NAMESPACE" > /dev/null..
2024.10.15 19:41 -
k8s worker node runtime 확인하는 방법
개요k8s worker node runtime 확인하는 방법 방법kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeInfo.containerRuntimeVersion}{"\n"}{end}' 참고https://kubernetes.io/docs/tasks/administer-cluster/migrating-from-dockershim/find-out-runtime-you-use/
2024.10.14 18:56 -
eks cluster add-on 버전 호환성 및 버전 확인
개요eks cluster에 따른 사용가능한 add-on 리스트와 버전과 add-on 버전이 확인 가능한 CLI 버전 및 호환성 확인# 특정 EKS Version에서 지원되는 특정 add-on 버전 리스트aws eks describe-addon-versions --kubernetes-version --addon-name --query 'addons[].addonVersions[].{Version: addonVersion, Defaultversion: compatibilities[0].defaultVersion}' --output table# 특정 EKS Version에서 지원되는 add-on 리스트aws eks describe-addon-versions --kubernetes-version --qu..
2024.10.04 17:44 -
k8s에 설치된 argocd 초기 비밀번호 확인하기
개요k8s에 설치된 argocd 초기 비밀번호는 따로 지정하지 않으면 임의로 생성이 된다. 확인 방법kubectl -n get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 --decode
2024.10.04 12:29 -
AWS S3 presigned URLs 생성 및 업로드 테스트
개요presigend url을 통해 업로드하는 테스트 스크립트 스크립트Downloading Object using presigned URLsaws s3 presign s3://DOC-EXAMPLE-BUCKET1/mydoc.txt --expires-in 604800Uploading Object using presigned URLs➜ ~ brew install python3➜ ~ pip3 install boto3 --break-system-packes➜ ~ vim pre.pyimport boto3BUCKET = ‘my-bucket’KEY = 'my-uploaded-file.txt's3 = boto3.client('s3')url = s3.generate_presigned_url( ClientMet..
2024.07.30 14:55 -
EC2 stopped 시간과 이름 출력 (AWS CLI)
스크립트#!/bin/bash# 정지된 인스턴스 목록 가져오기stopped_instances=$(aws ec2 describe-instances \ --filters "Name=instance-state-name,Values=stopped" \ --query "Reservations[*].Instances[*].[InstanceId, Tags[?Key=='Name'].Value | [0]]" \ --output json)# 테이블 헤더 출력printf "%-50s %-50s %-50s\n" "Instance ID" "Instance Name" "Stopped Time"# 각 인스턴스에 대해 정지 시간을 가져와서 출력echo "$stopped_instances" | jq -c '.[][]' ..
2024.07.29 12:31 -
Amazon EC2 종료 시간 확인 (CLI)
개요EC2 인스턴스가 Launch 된 시간은 확인이 가능하지만 Off 된 시간은 콘솔에서 따로 확인 불가하다. 아래는 CLI를 통해 확인하는 방법이다. Amazon EC2 종료 시간 확인 (CLI)aws ec2 describe-instances --filters "Name=instance-state-code,Values=80" --query 'Reservations[].Instances[].[Tags[?Key==`Name`] | [0].Value, InstanceId, PrivateIpAddress, State.Name, StateTransitionReason]' --output table
2024.05.08 10:54 -
AWS CLI 페이저 옵션 끄기
개요AWS CLI의 output이 prompt로 떨어지지 않고 page로 나오면 상황에 따라서 불편할 수 있다. pager option 끄기aws configure set cli_pager "" 참고https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html
2024.04.15 16:49 -
mac에서 날짜 계산하기 (gdate)
개요 mac에서는 date 명령어가 gdate로 사용된다. 설치 brew install coreutils 날짜 계산 (현재 기준 180일 전) gdate --date "180 days ago" +"%Y%m%d" 날짜 계산 (현재 기준 180일 후) gdate --date "180 days" +"%Y%m%d"
2024.04.04 16:32 -
AWS Cloudtrail IAM 관련 변경 이벤트 알림 slack
개요 AWS Cloudtrail에서 IAM 변경 알림이 이벤트로 기록이 된다. 해당 기록을 Slack 으로 받는 방법은 아래와 같다. 구성 (N.virginia Region) Cloudtrail >> Eventbridge Rules >> SNS >> Chatbot >> Slack Cloudtrail IAM 변경 관련 이벤트 { "source": ["aws.iam", "aws.ec2"], "detail-type": ["AWS API Call via CloudTrail"], "detail": { "eventSource": ["iam.amazonaws.com", "ec2.amazonaws.com"], "eventName": ["AttachGroupPolicy", "AttachRolePolicy", "Attac..
2024.04.03 17:18
Security Principal
-
MFA 환경에서 AWS CLI 사용 하기
개요 MFA 환경에서 AWS CLI 사용 하려면, session token과 임시 AWS Access key와 Secret key가 필요하다. 방법 # aws sts get-session-token --duration-seconds 10000 --serial-number "arn:aws:iam::111111111:mfa/mfa_user" --token-code 123456 { "Credentials": { "AccessKeyId": "ABCDQWEQWEQWEQWE", "SecretAccessKey": "YWEesaldkjsadlkgjasgsdgsadgsadgsadgsadg", "SessionToken": "sadfsdfsdfsadf/asdfsadfsdfsadfsadf/v//////////sdfgdsfgd..
2024.02.19 18:22 -
VPC endpoint for dynamodb 사용 하기
개요 VPC endpoint for S3 처럼 VPC endpoint for dynamodb 를 사용하면 DynamoDB를 접근을 AWS 내부 네트워크를 통해 접속하여서 보안에도 강점이 있고, 비용 최적화에도 도움이 된다. 간단한 설정을 통해 사용가능 하지만 간과하는 경우가 많다. 사용 방법 VPC endpoint "com.amazonaws..dynamodb" 를 생성한 후 적절한 VPC의 Routing tables에 추가만 하면 된다. 참고 https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/vpc-endpoints-dynamodb.html
2024.02.19 16:23 -
EBS Snapshots BPA(Block Public Access)
- 개요 EBS Snapshot이 예기치 못하게 Public으로 공개되서 악의적인 접근을 원천 차단 - 방법 AWS Console >> EC2 Settings >> Data protection and security >> Block public access for EBS snapshots >> Manage >> check >> Block all public sharing // Block new public sharing - 비고 Default : off have to set Per Region and Per Orgs(Account) - 참고 https://aws.amazon.com/ko/about-aws/whats-new/2023/11/amazon-elastic-block-store-public-acce..
2023.12.29 15:36 -
AMI BPA(Block Public Access) 설정
- 개요 AMI를 운영할 때 혹시 모를 Public Access 사태를 미연에 방지 - 방법 AWS Console >> EC2 Settings >> Block public access for AMIs >> Manage >> check - 비고 Default : off Per Region, Per Orgs(Account) 따로 설정 기존 AMI는 직접 변경해줘야하며 신규 생성되는 AMI에만 적용됨 The request can take up to 10 minutes to be configured. - Reference https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-updating https://docs.aws.amazon.com/..
2023.09.22 16:24 -
Security Policy (ELB, Cloudfront)
- 개요 기본적인 보안 가이드를 준수하려면 필수 - Cloudfront - Security policy (2023년 10월 기준) TLSv1.2_2021 - ELB - Security policy (2023년 10월 기준) ALB : ELBSecurityPolicy-TLS13-1-2-2021-06 NLB : ELBSecurityPolicy-TLS13-1-2-2021-06* - reference https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html?icmpid=docs_cf_help_panel#DownloadDistValuesOriginSSLProtocols https://d..
2023.05.15 15:57 -
AWSCompromisedKeyQuarantineV2
- 개요 AWS 사용중에 Hacking 의심이나 외부 노출이 된 계정에 AWS에서 자동으로 policy를 할당해서 추가 피해를 막고 고객 대응을 유도하는 권한 - 내용 Denies access to certain actions, applied by the AWS team in the event that an IAM user's credentials have been compromised or exposed publicly. Do NOT remove this policy. Instead, please follow the instructions specified in the support case created for you regarding this event. { "Version": "2012-10-17..
2023.02.14 14:14 -
Cloudfront Origin Access Control
- 개요 CloudFront 접근 제어 및 보안 강화를 위한 방법으로 기존의 OAI 다음으로 나온 OAC에 대해 정리 했다. - Origin Access : Create control setting Signing behavior Sign requests (recommended) Create Bucket Policy -> Copy policy - S3 bucket policy { "Version": "2008-10-17", "Id": "PolicyForCloudFrontPrivateContent", "Statement": [ { "Sid": "AllowCloudFrontServicePrincipal", "Effect": "Allow", "Principal": { "Service": "cloudfront.a..
2022.10.14 10:23 -
Deletion Protection 삭제 방지 (EC2, ELB, RDS)
- 개요 예기치 못한 삭제나 테라폼등으로 삭제가 일어날 경우를 미연에 방지하기 위한 삭제 방지 기능을 적극 활용하는 것을 추천한다. - EC2 termination protection https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingDisableAPITermination https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html - ELB Deletion protection https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-lo..
2022.08.08 16:09 -
개발 리소스, 개발 서버들 접근 제어 (IP Based ACL)
- 개요 클라우드 환경에서 보안을 강화할 수 있는 방법중에 제일 기본은 IP 기반 제어다. 개발관려 리소스는 회사에서만 접근이 가능해여 하는 등 여러 가지 정책을 정하는 방법에 대해 정리 했다. 1. WAF 장점 : 많은 정책과 할 수 있는 것이 다양. 단점 : 유료, NLB 불가. https://docs.aws.amazon.com/waf/latest/developerguide/classic-web-acl-ip-conditions.html 2. Network ACL : VPC 및 Subnet 레벌 제어. 장점 : 설정하기 편하고 직관적이며, 무료. 단점 : VPC와 Subnet 설계가 ENV에 맞게 되어 있어야 하며, IP 갯수 제한. https://docs.aws.amazon.com/vpc/latest..
2022.08.05 17:41 -
AWS 에서 권장하는 보안 관련 링크
- 개요 실제 보안 사고를 경험 후 그걸 해결하는 과정에서 AWS support를 통해 공유 받은 보안 권장 링크 - IAM MFA https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable.html - Trusted Advisor https://docs.aws.amazon.com/awssupport/latest/user/get-started-with-aws-trusted-advisor.html - Billing Alert https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/gs_monitor_estimated_charges_with_cloudwatch.html#gs_c..
2022.07.22 09:21
-
Your account must be verified before you can add new CloudFront resources. To verify your account, please contact AWS Support (https://console.aws.amazon.com/support/home#/) and include this error message.
개요 AWS 계정을 최초 생성 후 CloudFront distribution을 생성할 때 위와 같은 에러가 발생하는 경우가 있다. 해결 AWS Support를 통해 case를 open하고 계정 인증이나 이메일 인증을 진행하면 생성이 가능 하다. 참고 https://repost.aws/questions/QULXHEAzC7Sai6_LTLNYn83Q/your-account-must-be-verified-before-you-can-add-new-cloudfront-resources https://repost.aws/questions/QUdTw0Ch8oQKqSOvHC0r_ORg/accessdenied-your-account-must-be-verified-before-you-can-add-new-cloudfront..
2024.01.19 14:38 -
Athena - No output location provided. An output location is required either through the Workgroup result configuration setting or as an API input.
- 개요 Athena를 처음 사용할 때 아래와 같은 에러가 발생하는 경우가 있다. - 에러 메세지 No output location provided. An output location is required either through the Workgroup result configuration setting or as an API input. - 해결 방법 Amazon Athena -> Settings -> Query result location -> S3 추가
2022.08.24 16:11 -
AWS S3 presigned URLs 생성 및 업로드 테스트
개요presigend url을 통해 업로드하는 테스트 스크립트 스크립트Downloading Object using presigned URLsaws s3 presign s3://DOC-EXAMPLE-BUCKET1/mydoc.txt --expires-in 604800Uploading Object using presigned URLs➜ ~ brew install python3➜ ~ pip3 install boto3 --break-system-packes➜ ~ vim pre.pyimport boto3BUCKET = ‘my-bucket’KEY = 'my-uploaded-file.txt's3 = boto3.client('s3')url = s3.generate_presigned_url( ClientMet..
2024.07.30 14:55