TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do I find why my AWS VPC is costing $34?

2 点作者 manishsharan4 个月前
This is for my personal lab. I am at my wits end trying to hunt down this cost. I do not have an EIP or public IP address or a NAT gateway. I do have ipv6 egress only gateway and EIPs for SQS, ECR and S3. I am mostly using my AWS for batch processing where I upload data to S3 and triggers a job by placing a message in a SQS queue. My VPC has subnets in different AZ.

4 条评论

PaulHoule4 个月前
I had a $5 a month VPS that cost $300 a month to run because it didn&#x27;t have enough RAM and was swap-happy and running up incredible I&#x2F;O costs against EBS. The $10 a month VPS was a lot cheaper.<p>In your case a Lambda could be cheaper still.
brodouevencode4 个月前
Cost explorer will help you dig into the usage type and resources used.
评论 #42699087 未加载
QuinnyPig4 个月前
$34 screams “NAT Gateway.” Are you SURE you don’t have one? I’d bet a beer on it.
评论 #42700004 未加载
manishsharan4 个月前
I did cloudformation stack deployments in December to my account. I am pretty sure that it is the ipv6 egress , which is supposed to be serverless and hence cheaper that NAT, that is responsible.<p>Here is my cloudformation template for VPC:<p>Resources: # VPC with IPv4 CIDR block BatchVpc: Type: AWS::EC2::VPC Properties: CidrBlock: 10.0.0.0&#x2F;16 EnableDnsHostnames: true EnableDnsSupport: true InstanceTenancy: default Tags: - Key: Name Value: !Sub &#x27;${AWS::StackName}-BatchVpc&#x27; - Key: stack Value: !Sub &#x27;${AWS::StackName}&#x27;<p><pre><code> # IPv6 CIDR Block for the VPC BatchVpcIpv6CidrBlock: Type: AWS::EC2::VPCCidrBlock Properties: VpcId: !Ref BatchVpc AmazonProvidedIpv6CidrBlock: true # Egress Only Internet Gateway for IPv6 traffic BatchEgressIgw: Type: AWS::EC2::EgressOnlyInternetGateway Properties: VpcId: !Ref BatchVpc # Security Group for SQS access BatchSgSqs: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: Security group for SQS access VpcId: !Ref BatchVpc SecurityGroupIngress: - IpProtocol: tcp FromPort: 443 ToPort: 443 CidrIp: 10.0.0.0&#x2F;16 Tags: # Added tags - Key: Name Value: !Sub &#x27;${AWS::StackName}-BatchSgSqs&#x27; - Key: stack Value: !Sub &#x27;${AWS::StackName}&#x27; # Subnet for Batch instances (public subnet with IPv6) BatchSubnetPublicA: Type: AWS::EC2::Subnet Properties: VpcId: !Ref BatchVpc AvailabilityZone: !Select [ 0, !GetAZs ] CidrBlock: 10.0.1.0&#x2F;24 Ipv6CidrBlock: !Select [ 0, !Cidr [ !Select [ 0, !GetAtt BatchVpc.Ipv6CidrBlocks ], 1, 64 ] ] AssignIpv6AddressOnCreation: true Tags: - Key: Name Value: !Sub &#x27;${AWS::StackName}-BatchSubnetPublicA&#x27; - Key: stack Value: !Sub &#x27;${AWS::StackName}&#x27; # Route table for the subnet BatchRtbPublicA: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref BatchVpc Tags: - Key: Name Value: !Sub &#x27;${AWS::StackName}-BatchRtbPublicA&#x27; - Key: stack Value: !Sub &#x27;${AWS::StackName}&#x27; # Associate subnet with route table BatchSubnetRtbAssocA: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: !Ref BatchSubnetPublicA RouteTableId: !Ref BatchRtbPublicA # Route for IPv6 internet traffic BatchRouteIpv6Internet: Type: AWS::EC2::Route Properties: RouteTableId: !Ref BatchRtbPublicA DestinationIpv6CidrBlock: ::&#x2F;0 EgressOnlyInternetGatewayId: !Ref BatchEgressIgw # VPC Endpoint for S3 BatchEpS3: Type: AWS::EC2::VPCEndpoint Properties: VpcId: !Ref BatchVpc ServiceName: !Sub &#x27;com.amazonaws.${AWS::Region}.s3&#x27; RouteTableIds: - !Ref BatchRtbPublicA PolicyDocument: Version: &quot;2012-10-17&quot; Statement: - Effect: Allow Principal: &#x27;*&#x27; Action: - &#x27;s3:*&#x27; Resource: &#x27;*&#x27; # VPC Endpoint for SQS BatchEpSqs: Type: AWS::EC2::VPCEndpoint Properties: VpcId: !Ref BatchVpc VpcEndpointType: Interface ServiceName: !Sub &#x27;com.amazonaws.${AWS::Region}.sqs&#x27; SubnetIds: - !Ref BatchSubnetPublicA SecurityGroupIds: - !Ref BatchSgSqs PrivateDnsEnabled: true PolicyDocument: Version: &quot;2012-10-17&quot; Statement: - Effect: Allow Principal: &#x27;*&#x27; Action: - &#x27;sqs:*&#x27; Resource: &#x27;*&#x27; </code></pre> # for ECS BatchEpEcs: Type: AWS::EC2::VPCEndpoint Properties: VpcId: !Ref BatchVpc VpcEndpointType: Interface ServiceName: !Sub &#x27;com.amazonaws.${AWS::Region}.ecs&#x27; SubnetIds: - !Ref BatchSubnetPublicA SecurityGroupIds: - !Ref BatchSgSqs PrivateDnsEnabled: true PolicyDocument: Version: &#x27;2012-10-17&#x27; Statement: - Effect: Allow Principal: &#x27;<i>&#x27; Action: &#x27;ecs:</i>&#x27; Resource: &#x27;<i>&#x27;<p><pre><code> BatchEpEcsAgent: Type: AWS::EC2::VPCEndpoint Properties: VpcId: !Ref BatchVpc VpcEndpointType: Interface ServiceName: !Sub &#x27;com.amazonaws.${AWS::Region}.ecs-agent&#x27; SubnetIds: - !Ref BatchSubnetPublicA SecurityGroupIds: - !Ref BatchSgSqs PrivateDnsEnabled: true PolicyDocument: Version: &#x27;2012-10-17&#x27; Statement: - Effect: Allow Principal: &#x27;*&#x27; Action: &#x27;ecs:*&#x27; Resource: &#x27;*&#x27; BatchEpEcrApi: Type: AWS::EC2::VPCEndpoint Properties: VpcId: !Ref BatchVpc VpcEndpointType: Interface ServiceName: !Sub &#x27;com.amazonaws.${AWS::Region}.ecr.api&#x27; SubnetIds: - !Ref BatchSubnetPublicA SecurityGroupIds: - !Ref BatchSgSqs PrivateDnsEnabled: true PolicyDocument: Version: &#x27;2012-10-17&#x27; Statement: - Effect: Allow Principal: &#x27;*&#x27; Action: - ecr:GetAuthorizationToken - ecr:BatchCheckLayerAvailability - ecr:GetDownloadUrlForLayer - ecr:BatchGetImage Resource: &#x27;*&#x27; BatchEpEcrDkr: Type: AWS::EC2::VPCEndpoint Properties: VpcId: !Ref BatchVpc VpcEndpointType: Interface ServiceName: !Sub &#x27;com.amazonaws.${AWS::Region}.ecr.dkr&#x27; SubnetIds: - !Ref BatchSubnetPublicA SecurityGroupIds: - !Ref BatchSgSqs PrivateDnsEnabled: true PolicyDocument: Version: &#x27;2012-10-17&#x27; Statement: - Effect: Allow Principal: &#x27;*&#x27; Action: - ecr:GetAuthorizationToken - ecr:BatchCheckLayerAvailability - ecr:GetDownloadUrlForLayer - ecr:BatchGetImage Resource: &#x27;*&#x27; # VPC Endpoint for CloudWatch Logs BatchEpCloudWatchLogs: Type: AWS::EC2::VPCEndpoint Properties: VpcId: !Ref BatchVpc VpcEndpointType: Interface ServiceName: !Sub &#x27;com.amazonaws.${AWS::Region}.logs&#x27; SubnetIds: - !Ref BatchSubnetPublicA SecurityGroupIds: - !Ref BatchSgSqs PrivateDnsEnabled: true PolicyDocument: Version: &quot;2012-10-17&quot; Statement: - Effect: Allow Principal: &#x27;*&#x27; Action: - &#x27;logs:CreateLogGroup&#x27; - &#x27;logs:CreateLogStream&#x27; - &#x27;logs:PutLogEvents&#x27; - &#x27;logs:DescribeLogGroups&#x27; - &#x27;logs:DescribeLogStreams&#x27; Resource: &#x27;*&#x27; </code></pre> Outputs: BatchVpcId: Value: !Ref BatchVpc Export: Name: sandbox-infra-lite-CustomJob-batch-network:VpcId<p><pre><code> BatchSubnetId: Value: !Ref BatchSubnetPublicA Export: Name: sandbox-infra-lite-CustomJob-batch-network:BatchSubnetId BatchSgId: Value: !Ref BatchSgSqs Export: Name: sandbox-infra-lite-CustomJob-batch-network:BatchSgId</code></pre></i>
评论 #42707763 未加载