Close

AWS

Give EC2 instance access to a specific S3 bucket using IAM

Here’s the policy you need to attach to your instance’s IAM: { “Version”: “2012-10-17”, “Statement”: [ { “Effect”: “Allow”, “Action”: “s3:*”, “Resource”: [ “arn:aws:s3:::bucket-name”, “arn:aws:s3:::bucket-name/*” ] } ] } You can replace the ‘*’ above with more restrictive permissions (e.g. read only) where necessary. This approach means you don’t need […]

Read More

AWS Cost Explorer CLI demo – filtering costs by cost allocation tags

Here’s a quick example: $ cat filter.json { “Tags”: { “Key”: “role”, “Values”: [“webserver”] } } $ aws ce get-cost-and-usage –time-period Start=$(date +”%Y-%m-%d” –date=”-24 hours”),End=$(date +”%Y-%m-%d”) –granularity=DAILY –metrics BlendedCost –filter file://filter.json RESULTSBYTIME True TIMEPERIOD 2018-08-09 2018-08-08 BLENDEDCOST 22.30 USD References: http://blog.xi-group.com/2015/01/small-tip-how-to-use-aws-cli-filter-parameter/ https://medium.com/@nachomillangarcia/prometheus-alerts-for-aws-daily-costs-3374137d1371

Read More