我可以使用我的凭据通过S3cmd工具将一些内容推送到S3存储桶,使用s3cmd put contentfile S3:// test_bucket/test_file
问题是,我需要在没有安装s3cmd的其他计算机上从这个桶下载内容,但是他们已经安装了wget.
当我尝试用wget从我的桶中下载一些内容时,我得到了这个:
https://s3.amazonaws.com/test_bucket/test_file
--2013-08-14 18:17:40-- `https`://s3.amazonaws.com/test_bucket/test_file
Resolving s3.amazonaws.com (s3.amazonaws.com)... [ip_here]
Connecting to s3.amazonaws.com (s3.amazonaws.com)|ip_here|:port... connected.
HTTP request sent, awaiting response... 403 Forbidden
`2013`-08-14 18:17:40 ERROR 403: Forbidden.
Run Code Online (Sandbox Code Playgroud)
我已通过Amazon AWS Web控制台手动将此存储桶公开.
问题是:如何使用wget从S3存储桶下载内容?进入txt本地文件?
当我想安装 ruamel.yaml 包时收到错误
\n\n这是命令:
\n\npython --version;pip --version;pip install ruamel.yaml\n
Run Code Online (Sandbox Code Playgroud)\n\n和输出:
\n\nPython 2.7.10\npip 10.0.0 from /Library/Python/2.7/site-packages/pip (python 2.7)\nCollecting ruamel.yaml\n Downloading https://files.pythonhosted.org/packages/c1/ad/9557a78f1b61951623c56225e05dacdd81f80519f13fc39a926a5793edfa/ruamel.yaml-0.15.37.tar.gz (280kB)\n 100% |\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88| 286kB 4.4MB/s\n Complete output from command python setup.py egg_info:\n sys.argv [\'-c\', \'egg_info\', \'--egg-base\', \'pip-egg-info\']\n Traceback (most recent call last):\n File "<string>", line 1, in <module>\n File "/private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/setup.py", line 917, in <module>\n main()\n File "/private/var/folders/8j/69k5q3yn4y51g5nt2g7g9b9n24s68p/T/pip-install-htyM8C/ruamel.yaml/setup.py", line 905, in main\n setup(**kw)\n File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup\n _setup_distribution = dist = klass(attrs)\n File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py", line …
Run Code Online (Sandbox Code Playgroud) 我正在寻找一种以编程方式终止长时间运行的 AWS EC2 实例的方法。
我做了一些谷歌搜索,但我似乎没有找到一种方法来查找实例运行了多长时间,以便我可以编写一个脚本来删除运行时间超过特定时间段的实例。 。
以前有人处理过这个吗?
简单的问题在这里?...
如何使用boto检查AWS 存储桶是否存在?...最好通过提供路径?...
这是我想采取的方法:
def bucket_exists(self, bucket_name):
connection = boto.s3.connection.S3Connection('<aws access key>', '<aws secret key>')
buckets = connection.get_all_buckets()
for bucket in buckets:
bucket_name = bucket.name
# Bucket existence logic here
# submit boto request
ie:. exists = boto.get_bucket(bucket_name, validate=True)
if exists:
return True
else:
return False
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我很想知道这个 AWS 账户拥有的存储桶中是否存在一个存储桶......
有没有更好的方法来确定存储桶是否存在?我将如何实施更好的方法?
谢谢
我正在从 Jenkins 管道内的 docker 文件旋转一个 docker 容器(alpine base)。容器安装:
ruby-rake and ruby-bundler
并且我能够毫无问题地进行捆绑
我在此 jenkins 管道中的工作目录有 Gemfile 和 Gemfile.lock 我尝试在此工作目录中运行捆绑安装
当我尝试时:
bundle install #running as a shell command in jenkins
Run Code Online (Sandbox Code Playgroud)
我得到:
`/` is not writable.
Bundler will use `/tmp/bundler/home/unknown' as your home directory temporarily.
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.............
Fetching rake 10.3.2
Retrying download gem from https://rubygems.org/ due to error (2/4): Errno::ENOENT No such file or directory @ rb_sysopen - /.gem/ruby/2.4.0/cache/rake-10.3.2.gem
Retrying download gem …
Run Code Online (Sandbox Code Playgroud) 如果该用户未在 aws 帐户中使用用户名和密码登录,我想强制执行用户锁定。
我如何轮询用户活动,当他/她上次在他/她的帐户上处于活动状态时?
我在本地运行 Terraform 0.12.24
我正在尝试部署与 Lambda 的 API 网关集成
我正在尝试使用 Terraform 启用 AWS API GW CORS。
对于 OPTIONS 方法响应,我有以下资源:
resource "aws_api_gateway_method_response" "options_200" {
rest_api_id = aws_api_gateway_rest_api.scout-approve-api-gateway.id
resource_id = aws_api_gateway_resource.proxy.id
http_method = aws_api_gateway_method.options_method.http_method
status_code = "200"
response_models {
"application/json" = "Empty"
}
response_parameters {
"method.response.header.Access-Control-Allow-Headers" = true,
"method.response.header.Access-Control-Allow-Methods" = true,
"method.response.header.Access-Control-Allow-Origin" = true
}
depends_on = [aws_api_gateway_method.options_method]
}
Run Code Online (Sandbox Code Playgroud)
我得到:
Error: Invalid argument name
on main.tf line 48, in resource "aws_api_gateway_method_response" "options_200":
48: "application/json" = "Empty"
Argument names must not be quoted.
Run Code Online (Sandbox Code Playgroud)
是什么赋予了?
amazon-web-services terraform aws-api-gateway terraform-provider-aws terraform0.12+
我已成功使用 boto3 生成 Amazon S3 签名 URL。
import logging
import boto3
from botocore.exceptions import ClientError
def create_presigned_url(bucket_name, object_name, expiration=3600):
"""Generate a presigned URL to share an S3 object
:param bucket_name: string
:param object_name: string
:param expiration: Time in seconds for the presigned URL to remain valid - 1 hour in this case
:return: Presigned URL as string. If error, returns None.
"""
# Generate a presigned URL for the S3 object
s3_client = boto3.client('s3')
try:
response = s3_client.generate_presigned_url('get_object', Params={'Bucket': bucket_name, …
Run Code Online (Sandbox Code Playgroud) 我在 Amazon AWS S3 中有一个存储桶,其中有一个名为users.csv
.
如何使用 Ruby 将该文件的内容从 S3 存储桶加载到内存中以便解析它?
这是我的代码:
require 'aws-sdk'
s3 = Aws::S3::Resource.new(region: 'us-west-1')
resp = s3.list_objects(bucket: 'bucket-name', max_keys: 1)
resp.contents.each do |object|
puts #{object.value}
end
Run Code Online (Sandbox Code Playgroud)
当我在 IRB 中尝试这个时,我得到:
struct Aws::S3::Types::Object key="users.csv", last_modified=2017-11-15 19:10:28 UTC, etag="\"9a3d50c07aa4aa6976037ce774294a26\"", size=101, storage_class="STANDARD", owner=struct Aws::S3::Types::Owner display_name="owner-name", id="42093cfa4ccb23a8156cdab8500a41a10bdbf90deebb0ee8a3b340dd1e0c3622"
Run Code Online (Sandbox Code Playgroud)
如何解析 的内容users.csv
?
from jira.client import JIRA
import requests
import jira.exceptions
import json
import re
class MyJira(JIRA):
def _create_http_basic_session(self, username, password):
url = self._options['server'] + '/rest/auth/1/session'
payload = {
'username': username,
'password': password
}
verify = False
self._session = requests.session(verify=verify,
hooks={'args': self._add_content_type})
r = self._session.post(url, data=json.dumps(payload))
jira.exceptions.raise_on_error(r)
options = {'server':'http://localhost:8080',
'verify': False}
username = 'usrName'
password = 'passWord'
basic_auth =(username,password)
jira = MyJira(options, basic_auth)
issue_dict = {
'project':{'key':'PROJKEY'},
'summary': 'New Issue from jira-python',
'description': 'Test Description for new issue created from jira-python',
'issueType': …
Run Code Online (Sandbox Code Playgroud) 我已经从docker hub提取了jenkins容器,如下所示:
docker pull jenkins
Run Code Online (Sandbox Code Playgroud)
容器运行,我可以在中访问Jenkins UI:
http://localhost:8080
Run Code Online (Sandbox Code Playgroud)
我的问题是:
如果我想能够创建一个从github存储库提取的jenkins作业,并且希望从该存储库的测试文件之一运行一些python测试,我该如何安装诸如virtualenvwrapper, pip, pytest, nose, selenium
etc之类的额外软件包?
似乎Docker容器未与本地主机文件系统共享任何引用。
如何在正在运行的容器中安装此类软件包?
谢谢
红宝石和捆扎机的新产品。我正在使用此docker文件将它们安装在docker映像中:
FROM alpine:3.5
# Install Ruby, Ruby Bundler and other ruby dependencies
RUN apk add --update \
ruby ruby-bigdecimal ruby-bundler \
ca-certificates libressl \
libressl-dev build-base ruby-dev \
ruby-rdoc ruby-io-console ruby-irb; \
\
&& bundle config build.nokogiri --use-system-libraries; \
&& bundle config git.allow_insecure true; \
\
&& gem install json foreman --no-rdoc --no-ri; \
&& gem cleanup; \
&& rm -rf /usr/lib/ruby/gems/*/cache/*; \
&& apk del libressl-dev build-base ruby-dev; \
&& rm -rf /var/cache/apk/* /tmp;
CMD ["bundle"]
Run Code Online (Sandbox Code Playgroud)
当我运行一个docker run时,我得到:
Don't …
Run Code Online (Sandbox Code Playgroud) python ×7
amazon-s3 ×4
ruby ×3
aws-sdk ×2
boto3 ×2
bucket ×2
bundler ×2
docker ×2
amazon ×1
amazon-ec2 ×1
amazon-iam ×1
api ×1
aws-cli ×1
boto ×1
containers ×1
cron ×1
dockerfile ×1
gemfile ×1
gemfile.lock ×1
https ×1
installation ×1
jenkins ×1
jira ×1
pip ×1
pycharm ×1
rest ×1
root ×1
ruamel.yaml ×1
s3cmd ×1
selenium ×1
terraform ×1
wget ×1
yaml ×1