该目录/data/files/
有数千个文件,例如:
1test
2test
3test
[...]
60000test
60001test
Run Code Online (Sandbox Code Playgroud)
我还将它们发送到 S3 存储桶 (AWS),使用AWS CLI
. 但是,有时 S3 存储桶可能处于脱机状态,因此会跳过该文件。
如何检查存在的文件/data/files/
是否也在 S3 存储桶中?如果没有将丢失的文件复制到 S3?
我更愿意使用 BASH 来做到这一点。此外,如果我需要为另一个更改 AWS CLI,也可以。
我有 aws 访问密钥和秘密密钥。我希望在 aws 凭证文件 (~/.aws/credentials) 中更新会话令牌,我将如何获取它?
我希望它们在命令行中生成。
是否可以在命令行(CLI)中仅使用 aws 访问密钥和密钥获取 aws 帐户 ID
我有访问密钥和秘密密钥。是否可以使用命令行中的帐户 ID 获取帐户 ID。
如何在 Amazon S3 存储桶子文件夹中的大量 .gz 文件中搜索字符串?我试图通过 s3fs 和 zgrep 安装它,但它太慢了。你使用任何其他方法吗?
也许有任何亚马逊服务可以用来快速 zgrep 它们?
自从我上次进行 Duplicity 备份 [到 Amazon S3] 已经有几个月了,与此同时,由于我对 Amazon 存储桶的自动 30 天规则,我的 S3 备份已从“正常”减少Amazon Glacier 的冗余存储。
现在,当我运行时,duply <backupname> verify -v9
我看到输出在最后被挂断,如下[这是在让它运行一夜之后,因为每次从 Glacier 恢复需要几个小时]:
-------------------------
Chain start time: Sun Dec 1 14:49:39 2013
Chain end time: Fri May 1 20:18:38 2015
Number of contained backup sets: 16
Total number of contained volumes: 1438
Type of backup set: Time: Num volumes:
Full Sun Dec 1 14:49:39 2013 318
Incremental Wed Dec 11 13:21:16 2013 1
Incremental Wed Dec 18 19:48:07 2013 15 …
Run Code Online (Sandbox Code Playgroud) 出于某种原因,我无法$FOLDER
在以下代码中将 bash 变量作为 python 参数传递。python 脚本从亚马逊 s3 下载一些文件。
bash脚本:
#!/bin/bash
FOLDER=$(./aws get $BUCKET"/location.txt")
python /data/pythonscript.py $FOLDER
#
Run Code Online (Sandbox Code Playgroud)
的输出$FOLDER
是重新生成的日期,例如。2014/07/31/14-16-34
用作路径。
这是python脚本:
#!/usr/bin/python
import boto, sys
from boto.s3.connection import S3Connection
access_key = 'accesskey'
secret_key = 'secretkey'
bucket_name = 'a name'
folder_path = str(sys.argv[1]) if len(sys.argv) > 1 else ''
print("Forwarded folder path " + folder_path)
conn = S3Connection(access_key, secret_key)
bucket = conn.get_bucket(bucket_name)
print("Bucket Location:" + bucket.get_location())
for key in bucket.list(prefix=folder_path, delimiter=''):
if '.' in key.name:
file_name = …
Run Code Online (Sandbox Code Playgroud) 我有这组命令:
s3ls="aws s3 ls $ssyss3/ --recursive --human-readable --summarize"
egrepCommand="egrep '$currentDate|Total'"
totalSize=$(echo $s3ls|$egrepCommand| awk -F 'Total Size:' '{print $2}'|sed '/^$/d')
echo $totalSize
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
egrep '2019-05-11|Total': command not found
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
amazon-s3 ×7
aws ×4
bash ×2
command-line ×2
grep ×2
alias ×1
amazon ×1
amazon-ec2 ×1
amazon-linux ×1
backup ×1
duplicity ×1
files ×1
python ×1
s3fs ×1
shell-script ×1