- CapEx (Capital Expenses)
- OpEx (Operational Expenses)
- Total Cost of Ownership (TCO)
- A comprehensive look at the entire cost model of a given decision or option often including both hard costs and soft costs.
- Return on Investment (ROI)
- The amount an entity can expect to receive back within a certain amount of time given an investment.
CapEx vs OpEx
- Assets purchased with a useful life beyond the currently year
- Lump sum paid up front
- Accounted for over 3-10 year lifespan while asset depreciates
- Listed as property or equipment
- Tax treatment is deducted over time as asset depreciates
- Ongoing costs to run a business
- Paid monthly or annual recurring
- Account for in the current month or year
- Listed as operating cost
- Tax is deducted in the current tax year
Cost Optimization Strategies
- Provision the resources you need and nothing more
- Consolidate where possible for greater density and lower complexity (multi-database RDS, containers)
- CloudWatch can help by monitoring utilization
- Using lowest-cost resource that still meets the technical specifications.
- Architecting for the most consistent use of resources is best versus spikes and valleys.
- Loosely coupled architectures using SNS, SQS, Lambda and DynamoDB can smooth demand and create more predictability and conistency.
- For permanent applications or needs, Reserved Instances provide the best cost advantage.
- Spot instances are best for temporary horizontal scaling.
- EC2 fleet lets you define target mix of On-Demand, Reserved and Spot instances to meet your needs.
- AWS Pricing can vary from region to region
- Consider potential savings by location resources in a remote region if local access is not required.
- Route53 and CloudFront can be used to reduce latency of a remote region.
- Leverage managed services such as MySQL RDS over self-managed options such as MySQL on EC2
- Cost savings gained through lower complexity and manual intervention (saving on soft costs)
Optimized Data Transfer
- Data going out and between AWS regions can become a significant cost component.
- Direct Connect can be a more cost-effective option given data volume and speed.
Tagging and Resource Groups
- Tags are arbitrary name/value pairs that you can assign to virtually all AWS assets to serve as metadata.
- Tagging strategies can be used for Cost Allocation, Security, Automation, and many other uses.
- Example: tag used in IAM policy to implement access controls to certain resources.
- Enforcing standardized tagging can be done via AWS Config Rules or custom scripts
- Most resources can have up to 50 tags.
- Resource Groups are grouping of AWS assets defined by tags.
- Create custom consoles to consolidated metrics, alarms and config details around given tags.
Common Resource Groupings:
- Environments - DEV,QA,PRD
- Project Resources
- Collection of resources supporting key business processes
- Resources allocated to various departments or cost centers
Spot Instances and Reserved Instances
- Purchase usage of EC2 instance in advance for a significant discount over On-Demand pricing
- Provides capacity reservation when used in a specific AZ
- AWS Billing automatically applies discounted rates when you launcgh an instance that matches your purchased RI.
- EC2 has three RI types: Standard, Convertible and Scheduled.
- RIs can be shared across multiple accounts within Consolidated Billing.
- If you find you don’t need your RI’s, you can try to sell them on the Reserved Instance Marketplace.
Standard vs. Convertiable Reserved Instances
- Terms: 1 / 3 year(s)
- Average Discount: Standard - 40%-60%, Convertible - 31%-54%
- Change AZ, Instance Size, Networking Type: yes
- Change instance family, OS, Tenancy, Payment Options: Standard - no, Convertible - yes
- Benefit from Price Reductions: Standard - no, Convertible - yes
- Sellable on RI Marketplace: Standard - yes, Convertible - coming soon
- Instance type
- Tenancy - Defaul / shared
- Availability Zone (optional)
- if zone is selected, discount applies to AZ - Zonal RI
- if no zone is specified, no reservation is created but the discount is applied to any instance in the family in any AZ in the region - Regional RI
- Zonal RI can be changed to Regional RI via console or AWS API
- Instance size flexibility is only available for Linux/Unix Regional RIs with default tenancy. Not available for Windows, RHEL, or SLES.
- Excess EC2 capacity that AWS tries to sell on a market exchange basis
- Customer creates a Spot Request and specifies AMI, desired instance types, and other key information
- Customer defines highest price willing to pay for instance. If capacity is constrained and others are willing to pay more, your instance might get terminated or stopped.
- Spot request can be a “fill and kill”, “maintain” or “duration-based”
- For “One-Time Request”, instance is terminated and ephemeral data is lost.
- For “Request and Maintain”, instance can be configured to Terminate, Stop or Hivernate until price point can be met again.
- Price and demand fluctuate between AZs
Dedicated Instances and Hosts
- Dedicated instance is virtualized instances on hardware just for your AWS account
- May share hardware with other non-dedicated instances in the same account
- Available as On-Demand, Reserved Instances and Spot Instances
- Cost additional 2# per hour per region
- Physical serveres dedicated to just your use
- You then have control over which instances anre deployed on that host.
- Available as On-Demand or with Dedicated Host Reservation
- Useful if you have server-bound software licenses that use metrics like per-core, per-socket or per-VM
- Each dedicated host can only run one EC2 instances size and type
- AWS Budgets
- Set predefined limits and notifications
- Can be based on Cost, Usage, Reserved Instance Utilization or RI Coverage
- Useful as a method to distribute cost and usage awareness and responsibility to platform users
- Consolidated Billing
- Enable a single Payer account that’s locked down to only those who need access.
- Economies of scale by bringing together resource consumption across accounts.
- Trusted Advisor
- Run a series of checks on your resources and proposes suggested improvements
- Can help recommend cost optimization adjustments like RIs or scaling adjustments
- Core checks are available to all customers
- Full Trusted Advisor benefits require a Business or Enterprise support plan