9 月
26
2015
26
2015
如何快速知道S3 bucket的大小
只需要執行以下的指令,就可以知道特定S3 bucket的容量大小和裡面的檔案數量
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"
只需要執行以下的指令,就可以知道特定S3 bucket的容量大小和裡面的檔案數量
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"
#!/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin # Please use env | grep EC2_HOME to find out your system's setting EC2_HOME=/opt/aws/apitools/ec2 # Please use env | grep JAVA_HOME to find out your system's setting JAVA_HOME=/usr/lib/jvm/jre export EC2_HOME JAVA_HOME # Regions reference: http://docs.aws.amazon.com/general/latest/gr/rande.html region="ap-northeast-1" # You can find your instance ID at AWS Manage Console instanceID="YOUR-INSTANCE-ID" # Your prefer AMI Name prefix amiNamePrefix="AMI_" # Your prefer AMI Description amiDescription="Daily AMI backup" # If you want to keep 7 days AMI backups, please set routine true otherwise set it false routine=true # Variable for routine is true weekday=$(date +%a) if [ $routine = true ]; then # Setup AMI Name amiName=$amiNamePrefix$weekday # Get AMI ID amiIDs=$(ec2-describe-images --region $region | grep 'ami-[a-z0-9]' | grep "$amiName" |cut -f 2) # Get Snapshot ID if [[ ! -z $amiIDs ]]; then snapshotIDs=$(ec2-describe-snapshots --region $region | grep $amiIDs | cut -f 2) fi else # Setup AMI Name amiName=$amiNamePrefix # Get AMI ID amiIDs=$(ec2-describe-images --region $region | grep 'ami-[a-z0-9]' | cut -f 2) # Get Snapshot ID if [[ ! -z $amiIDs ]]; then snapshotIDs=$(ec2-describe-snapshots --region $region | cut -f 2) fi fi if [[ ! -z $amiIDs ]]; then # Deregister AMI for amiID in $amiIDs do ec2-deregister --region $region $amiID done # Delete snapshot for snapshotID in $snapshotIDs do ec2-delete-snapshot --region $region $snapshotID done fi # Create AMI ec2-create-image $instanceID --region $region --name "$amiName" -d "$amiDescription" --no-reboot
AWS某些instance有提供SSD,下面是使用m3.medium,並且將MySQL安裝在SSD上面的測試數據
[[email protected] ssd]# time sysbench --test=oltp --mysql-table-engine=innodb --mysql-user=$dbUser --mysql-password=$dbPassword --db-driver=mysql --mysql-db=test --oltp-table-size=1000000 --oltp-table-name=t1 --oltp-nontrx-mode=insert --mysql-socket=/mnt/ssd/mysql/mysql.sock run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing OLTP test. Running mixed OLTP test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "BEGIN" for starting transactions Using auto_inc on the id column Maximum number of requests for OLTP test is limited to 10000 Threads started! Done. OLTP test statistics: queries performed: read: 140000 write: 50000 other: 20000 total: 210000 transactions: 10000 (169.49 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 190000 (3220.29 per sec.) other operations: 20000 (338.98 per sec.) Test execution summary: total time: 59.0009s total number of events: 10000 total time taken by event execution: 58.8980 per-request statistics: min: 2.65ms avg: 5.89ms max: 111.90ms approx. 95 percentile: 15.02ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 58.8980/0.00 real 0m59.107s user 0m4.027s sys 0m9.246s
AWS推出30天免費雲端資安軟體試用,總共有六項雲端資安產品可以試用,相關資訊網址在Security Software Free Trials,這裡幫大家整理一下這次試用的重點
難得看到的AWS錯誤,AWS的t1.micro規格變得爆威,r3.large都快要被巴假的了 (應該是資料誤植),不知道政府會不會要AWS出來說明??