AWS 서비스 중단
C:\Users\Sangjin>aws ec2 describe-instances --region ap-northeast-2 --profile zypher
{
"Reservations": [
{
"ReservationId": "r-08131d12e87b1051c",
"OwnerId": "727646465101",
"Groups": [],
"Instances": [
{
"Architecture": "x86_64",
"BlockDeviceMappings": [
{
"DeviceName": "/dev/xvda",
"Ebs": {
"AttachTime": "2025-02-23T05:59:07+00:00",
"DeleteOnTermination": true,
"Status": "attached",
"VolumeId": "vol-0db2d7bdefc66d8e3"
}
}
],
"ClientToken": "46b436a4-9c32-44a7-8a23-8176ed6f6a94",
"EbsOptimized": true,
"EnaSupport": true,
"Hypervisor": "xen",
"NetworkInterfaces": [
{
"Association": {
"IpOwnerId": "727646465101",
"PublicDnsName": "",
"PublicIp": "43.203.75.205"
},
"Attachment": {
"AttachTime": "2025-02-23T05:59:06+00:00",
"AttachmentId": "eni-attach-090843ee226c10dff",
"DeleteOnTermination": true,
"DeviceIndex": 0,
"Status": "attached",
"NetworkCardIndex": 0
},
"Description": "",
"Groups": [
{
"GroupId": "sg-0ebfdd1ff4301b34e",
"GroupName": "launch-wizard"
}
],
"Ipv6Addresses": [],
"MacAddress": "02:ca:64:6a:c7:27",
"NetworkInterfaceId": "eni-0b1e25c99ad415f19",
"OwnerId": "727646465101",
"PrivateIpAddress": "10.0.0.9",
"PrivateIpAddresses": [
{
"Association": {
"IpOwnerId": "727646465101",
"PublicDnsName": "",
"PublicIp": "43.203.75.205"
},
"Primary": true,
"PrivateIpAddress": "10.0.0.9"
}
],
"SourceDestCheck": true,
"Status": "in-use",
"SubnetId": "subnet-0d8e2ed617c190631",
"VpcId": "vpc-05ea07cb0f7bb4893",
"InterfaceType": "interface",
"Operator": {
"Managed": false
}
}
],
"RootDeviceName": "/dev/xvda",
"RootDeviceType": "ebs",
"SecurityGroups": [
{
"GroupId": "sg-0ebfdd1ff4301b34e",
"GroupName": "launch-wizard"
}
],
"SourceDestCheck": true,
"Tags": [
{
"Key": "Name",
"Value": "Woorinara_dev"
}
],
"VirtualizationType": "hvm",
"CpuOptions": {
"CoreCount": 1,
"ThreadsPerCore": 2
},
"CapacityReservationSpecification": {
"CapacityReservationPreference": "open"
},
"HibernationOptions": {
"Configured": false
},
"MetadataOptions": {
"State": "applied",
"HttpTokens": "required",
"HttpPutResponseHopLimit": 2,
"HttpEndpoint": "enabled",
"HttpProtocolIpv6": "disabled",
"InstanceMetadataTags": "disabled"
},
"EnclaveOptions": {
"Enabled": false
},
"BootMode": "uefi-preferred",
"PlatformDetails": "Linux/UNIX",
"UsageOperation": "RunInstances",
"UsageOperationUpdateTime": "2025-02-23T05:59:06+00:00",
"PrivateDnsNameOptions": {
"HostnameType": "ip-name",
"EnableResourceNameDnsARecord": false,
"EnableResourceNameDnsAAAARecord": false
},
"MaintenanceOptions": {
"AutoRecovery": "default",
"RebootMigration": "default"
},
"CurrentInstanceBootMode": "uefi",
"NetworkPerformanceOptions": {
"BandwidthWeighting": "default"
},
"Operator": {
"Managed": false
},
"InstanceId": "i-079dc598d5b4090f0",
"ImageId": "ami-075e056c0f3d02523",
"State": {
"Code": 16,
"Name": "running"
},
"PrivateDnsName": "ip-10-0-0-9.ap-northeast-2.compute.internal",
"PublicDnsName": "",
"StateTransitionReason": "",
"KeyName": "dev",
"AmiLaunchIndex": 0,
"ProductCodes": [],
"InstanceType": "t3a.small",
"LaunchTime": "2025-06-24T11:57:09+00:00",
"Placement": {
"GroupName": "",
"Tenancy": "default",
"AvailabilityZone": "ap-northeast-2a"
},
"Monitoring": {
"State": "disabled"
},
"SubnetId": "subnet-0d8e2ed617c190631",
"VpcId": "vpc-05ea07cb0f7bb4893",
"PrivateIpAddress": "10.0.0.9",
"PublicIpAddress": "43.203.75.205"
}
]
}
]
}C:\Users\Sangjin>aws ec2 create-image --instance-id i-079dc598d5b4090f0 --name "backup-Woorinara_dev-20250807" --no-reboot --profile zypher --region ap-northeast-2
{
"ImageId": "ami-0c8a1eb9da0c3937d"
}C:\Users\Sangjin>aws ec2 create-snapshot --volume-id vol-0db2d7bdefc66d8e3 --description "snapshot-woorinara-volume-20250807" --profile zypher --region ap-northeast-2
{
"Tags": [],
"SnapshotId": "snap-0cc0e2718cb2b7e98",
"VolumeId": "vol-0db2d7bdefc66d8e3",
"State": "pending",
"StartTime": "2025-08-07T09:54:32.620000+00:00",
"Progress": "",
"OwnerId": "727646465101",
"Description": "snapshot-woorinara-volume-20250807",
"VolumeSize": 8,
"Encrypted": false
}C:\Users\Sangjin>aws ec2 terminate-instances --instance-ids i-079dc598d5b4090f0 --profile zypher --region ap-northeast-2
{
"TerminatingInstances": [
{
"InstanceId": "i-079dc598d5b4090f0",
"CurrentState": {
"Code": 32,
"Name": "shutting-down"
},
"PreviousState": {
"Code": 16,
"Name": "running"
}
}
]
}C:\Users\Sangjin>aws ec2 describe-addresses --query "Addresses[*].{PublicIp:PublicIp, AllocationId:AllocationId}" --output table --profile zypher --region ap-northeast-2
-------------------------------------------------
| DescribeAddresses |
+-----------------------------+-----------------+
| AllocationId | PublicIp |
+-----------------------------+-----------------+
| eipalloc-0a0c9cf9fb530e73f | 43.203.75.205 |
+-----------------------------+-----------------+
C:\Users\Sangjin>aws ec2 release-address --allocation-id eipalloc-0a0c9cf9fb530e73f --profile zypher --region ap-northeast-2C:\Users\Sangjin>aws ec2 delete-volume --volume-id vol-0db2d7bdefc66d8e3 --profile zypher --region ap-northeast-2C:\Users\Sangjin>aws ec2 delete-security-group --group-id sg-0ebfdd1ff4301b34e --profile zypher --region ap-northeast-2
{
"Return": true,
"GroupId": "sg-0ebfdd1ff4301b34e"
}C:\Users\Sangjin>aws ec2 describe-internet-gateways --filters Name=attachment.vpc-id,Values=vpc-05ea07cb0f7bb4893 --query "InternetGateways[*].InternetGatewayId" --profile zypher --region ap-northeast-2
[
"igw-0fd5fdc5e053382fc"
]
C:\Users\Sangjin>aws ec2 detach-internet-gateway --internet-gateway-id igw-0fd5fdc5e053382fc --vpc-id vpc-05ea07cb0f7bb4893 --profile zypher --region ap-northeast-2
C:\Users\Sangjin>aws ec2 delete-internet-gateway --internet-gateway-id igw-0fd5fdc5e053382fc --profile zypher --region ap-northeast-2
C:\Users\Sangjin>aws ec2 describe-route-tables --route-table-ids rtb-05d3193a585867a57 --query "RouteTables[0].Associations" --profile zypher --region ap-northeast-2
[
{
"Main": false,
"RouteTableAssociationId": "rtbassoc-0a71f123e889aa9d9",
"RouteTableId": "rtb-05d3193a585867a57",
"SubnetId": "subnet-008abd64da0a26772",
"AssociationState": {
"State": "associated"
}
}
]
C:\Users\Sangjin>aws ec2 disassociate-route-table --association-id rtbassoc-0a71f123e889aa9d9 --profile zypher --region ap-northeast-2
C:\Users\Sangjin>aws ec2 delete-route-table --route-table-id rtb-05d3193a585867a57 --profile zypher --region ap-northeast-2C:\Users\Sangjin>aws ec2 describe-network-acls --filters Name=vpc-id,Values=vpc-05ea07cb0f7bb4893 --profile zypher --region ap-northeast-2
{
"NetworkAcls": [
{
"Associations": [
{
"NetworkAclAssociationId": "aclassoc-05795fe3e8a45e5ce",
"NetworkAclId": "acl-0e7fc7c739985bd46",
"SubnetId": "subnet-008abd64da0a26772"
}
],
"Entries": [
{
"CidrBlock": "0.0.0.0/0",
"Egress": true,
"Protocol": "-1",
"RuleAction": "allow",
"RuleNumber": 100
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": true,
"Protocol": "-1",
"RuleAction": "deny",
"RuleNumber": 32767
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"Protocol": "-1",
"RuleAction": "allow",
"RuleNumber": 100
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"Protocol": "-1",
"RuleAction": "deny",
"RuleNumber": 32767
}
],
"IsDefault": true,
"NetworkAclId": "acl-0e7fc7c739985bd46",
"Tags": [],
"VpcId": "vpc-05ea07cb0f7bb4893",
"OwnerId": "727646465101"
}
]
}EC2
지금 우리가 EC2 서버를 완전히 끈 상태라서, 컴퓨터를 돌리는 비용은 안 나옵니다. 그런데 이전에 쓰던 써버의 상태를 그대로 복구할 수 있게 백업(AMI, 스냅샷) 을 만들어 둔 게 있습니다.
- EC2 인스턴스 실행 요금은 전기세처럼, 서버를 켜놔야만 나옴 지금은 안 나옴(월 요금의 90% 가량)
- 하지만, 서버를 다시 켤 수 있도록 하드디스크 내용을 사진 찍듯이 저장해 둔 것이 있음
- 이 저장해 둔 것은 클라우드의 창고(S3) 에 계속 보관되는 거라, 창고 보관료(스토리지 요금) 가 계속 청구
따라서, 우리가 백업을 해둔 이상 ‘완전히 0원’은 불가능하고, 최소한의 보관 비용(스토리지 요금) 은 계속 나오는 구조입니다.
C:\Users\Sangjin>aws ec2 describe-snapshots --owner-ids self --query "sum(Snapshots[].VolumeSize)" --output text --profile zypher
16sum(VolumeSize) = 16 Gib라면, 다음과 같이 계산할 수 있다.
16 x 0.80/월. 매달 약 1,108 원
하지만, 이를 장기보관으로 돌리면 청구 요금을을 내릴 수 있는 것으로 확인했다.
스냅샷 두 개 중 하나는 아래 명령어로 장기보관으로 돌렸다.
C:\Users\Sangjin>aws ec2 modify-snapshot-tier --snapshot-id snap-0cc0e2718cb2b7e98 --storage-tier archive --region ap-northeast-2 --profile zypher
{
"SnapshotId": "snap-0cc0e2718cb2b7e98",
"TieringStartTime": "2025-08-18T09:08:30.564000+00:00"
}하지만, 나머지 1개의 스냅샷은 AMI에서 사용 중이라 아카이브 전환이 막혔다. 이를 아카이브 티어로 전환하려면 AMI 등록 해제 후 전환을 하면 된다. 하지만, 나중에 복구하려면 스탠다드 티어로 전환한 후 해당 스냅샷을 새 AMI 등록 또는 볼륨 생성을 하고 인스턴스에 Attach를 해야 하는 과정을 거쳐야 한다.
복구할 때는 다음 명령어로 표준 스탠다드로 전환하면 된다.
aws ec2 modify-snapshot-tier --snapshot-id <SNAP_ID> --storage-tier standard --region ap-northeast-2 --profile zypher위와 같은 결과로 스냅샷은 총 2개로 1개는 스탠다드 티어, 나머지 하나는 아카이브 티어이다. 이에 대한 요금으로는 아래와 같이 산정할 수 있다.
8 x 0.0125/GB-월 = $0.50/월, (대략 693 원).
결론: 매월 693원원
VPC
지금 계정에서 보유 중인 VPC 리소스
- VPC (2) → 무료
- 서브넷 (4) → 무료
- 라우팅 테이블 (3) → 무료
- 인터넷 게이트웨이 (1) → 무료 (단, 연결된 NAT 게이트웨이가 있어야만 요금이 발생함 → 현재 목록에는 없음)
- DHCP 옵션 세트 (1) → 무료
- 네트워크 ACL (2) → 무료
- 보안 그룹 (3) → 무료
따라서 VPC에서는 청구되는 요금 없을 것으로 판단
ECR
현재 5개의 리포지토리가 있고 각 리포지토리에는 여러 이미지들이 들어 있는데, 어떤 것들이 실사용 리포지토리(chatbotv2175e9598/fastapifunctionead79d0drepo)의 이미지인지 확인이 안 되는 상황이었다. samconfig.toml 파일에서 참조하는 리포지토리의 URI가 있어서 해당 리포지토리가 실사용 리포지토리인 것으로 판단을 하였으며, 가장 마지막 이미지만을 살려둔 채 나머지를 삭제할 것을 결정했다.
C:\Users\Sangjin>aws ecr describe-images --region ap-northeast-2 --repository-name chatbotv2175e9598/fastapifunctionead79d0drepo --query "sort_by(imageDetails,& imagePushedAt)[-1].{Tag:(imageTags)[0],Pushed:imagePushedAt,LastPull:lastRecordedPullTime}" --profile zypher --output table
--------------------------------------------------
| DescribeImages |
+----------+-------------------------------------+
| LastPull| 2025-08-17T16:19:12.659000+09:00 |
| Pushed | 2025-08-07T16:16:28.782000+09:00 |
| Tag | fastapifunction-ae82cb8e96ab-v1 |
+----------+-------------------------------------+실사용 리포지토리(chatbotv2175e9598/fastapifunctionead79d0drepo)를 제외한 나머지 하나의 리포지토리가 남았는데, 이 리포지토리에는 하나의 이미지가 있었으며 다른 리포지토리의 이미지에 비해 용량이 유난히 컸다. 그래서 해당 태그가 멀티아키텍처(다중 플랫폼) 태그인지 확인을 해보았다.
aws ecr describe-images --region ap-northeast-2 --repository-name bom1215/chatbot-api --query "imageDetails[].{Tag:(imageTags)[0],Digest:imageDigest,Media:imageManifestMediaType,imageSize:imageSizeInBytes,LastPull:lastRecordedPullTime}" --output table --profile zypher그 결과, application/vnd.docker.distribution.manifest.v2+json 으로 단일 아키텍처 이미지로 확인할 수 있었다.
다음으로는 해당 이미지를 누가 pull 해서 사용했는지, 즉 운영 워크로드에서 사용한 것인지 확인해 보았다.
C:\Users\Sangjin>aws cloudtrail lookup-events --region ap-northeast-2 --profile zypher --lookup-attributes AttributeKey=EventName,AttributeValue=GetDownloadUrlForLayer --max-results 50 --query "Events[?contains(CloudTrailEvent, 'bom1215/chatbot-api')].[EventTime,Username]" --output table
---------------------------------------
| LookupEvents |
+-----------------------------+-------+
| 2025-08-07T19:39:23+09:00 | root |
| 2025-08-07T19:39:23+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:22+09:00 | root |
| 2025-08-07T19:39:21+09:00 | root |
+-----------------------------+-------+결과창에서 볼 수 있듯, root 주체로 연속 찍혀있다. 이는 보통 사용자가 테스트로 docker pull 했을 때 남는 로그이다.
마지막으로 운영 서비스가 참조 중인지 최종 확인하기 위해 다음을 확인했다.
:: 컨테이너 이미지 기반 Lambda만 필터링
aws lambda list-functions --region ap-northeast-2 --profile zypher ^
--query "Functions[?PackageType=='Image' && ImageConfig.ImageUri!=null && contains(ImageConfig.ImageUri, 'bom1215/chatbot-api')].[FunctionName, Code.ImageUri]" --output table
:: ECS 태스크 정의에서 이미지 문자열 검색
for /f "tokens=*" %t in ('aws ecs list-task-definitions --region ap-northeast-2 --profile zypher --query "taskDefinitionArns[]" --output text') do (
aws ecs describe-task-definition --task-definition %t --region ap-northeast-2 --profile zypher ^
--query "taskDefinition.containerDefinitions[?contains(image, 'bom1215/chatbot-api')].[name,image]" --output table
)위 명령어로 Lambda/ECS 모두 참조 없음을 확인했으며, 이는 운영 워크로드가 이 이미지를 사용하고 있지 않다는 뜻이다. 그래서 삭제를 결정했다.
남은 이미지의 용량은 1055.58 MB ≈ 1.03 GB로, 월 요금을 계산해보면 1.03 GB x 0.103 (약 140원/월), 즉 매달 140원 정도가 나올 것으로 예상된다.
결론: 매달 140원
결론
EC2에서 발생하는 693원 + ECR에서 발생하는 140원 = 833 원 정도.