这是一个后续问题,在describe-vpcs中按标签过滤的正确语法是什么?.
使用提供的答案并参考http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-security-groups.html
--filters (list)
One or more filters.
......
vpc-id - The ID of the VPC specified when the security group was created.
Run Code Online (Sandbox Code Playgroud)
我构建了cli请求
aws --profile myProfile --region eu-west-1 ec2 describe-security-groups --group-name MyVpcSecGroup --filters Name=tag:vpc-id,Values=vpc-9xxxxxxx
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误
安全组"MyVpcSecGroup"在默认VPC"vpc-bxxxxxx"中不存在
那么如何使用-filters列表(例如vpc-id)格式化语法以在非默认VPC中搜索安全组?
thx艺术
我已经使用CloudFormation设置了一个新的EC2实例,并使用以下规则设置了网络ACL:
INBOUND
100 HTTP (80) TCP (6) 80 0.0.0.0/0 ALLOW
102 SSH (22) TCP (6) 22 0.0.0.0/0 ALLOW
104 Custom TCP Rule TCP (6) 1024-65535 0.0.0.0/0 ALLOW
* ALL Traffic ALL ALL 0.0.0.0/0 DENY
OUTBOUND
100 HTTP (80) TCP (6) 80 0.0.0.0/0 ALLOW
102 Custom TCP Rule TCP (6) 1024-65535 0.0.0.0/0 ALLOW
* ALL Traffic ALL ALL 0.0.0.0/0 DENY
Run Code Online (Sandbox Code Playgroud)
我已将具有以下策略的IAM角色分配给该实例:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1427889375000",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::my-bucket/*"
]
}
] …Run Code Online (Sandbox Code Playgroud) 如何使用AWS CLI在同一行中列出名称,状态,实例大小和AZ的所有实例?
我已经接近:
aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value[], Placement.AvailabilityZone,InstanceType,State.Name]' --output text
Run Code Online (Sandbox Code Playgroud)
但这会在其余名称下方输出实例名称。我想将它们保持在同一行上,以便可以将其复制到电子表格中。
我还处于boto3的学习阶段,我似乎无法弄清楚如何获得使用boto3为aws配置文件分配给用户的策略列表?
例如:
>> import boto3
>> client=boto3.client('iam')
>> client.get_user()
Run Code Online (Sandbox Code Playgroud)
在这里,client.get_user()没有给我政策属性.
谢谢
我正在尝试使用以下命令(文档)列出Amazon S3存储桶的内容:
aws s3 ls s3://mybucket --recursive
Run Code Online (Sandbox Code Playgroud)
但是,出现以下错误:
Unknown options: --recursive
Run Code Online (Sandbox Code Playgroud)
以下是我的Ubuntu Linux EC2实例的版本信息:
$aws s3 ls --version
aws-cli/1.2.9 Python/3.4.3 Linux/3.13.0-85-generic
Run Code Online (Sandbox Code Playgroud)
如何--recursive在aws-cli上启用该选项?
我想编写一个脚本,以打印出在某个日期之前(或之后)创建的所有AMI。但是,我确实很努力地做到这一点,因此,我们将不胜感激任何帮助。
我现在没有多少,但这是我到目前为止所拥有的:
aws ec2 describe-images > c:\ami_names.txt
Run Code Online (Sandbox Code Playgroud)
关于如何仅针对特定日期之前创建的AMI进行过滤的任何技巧?
有没有办法在特定的VPC中描述安全组?
这是我想要运行的:
aws ec2 describe-security-groups --group-name "<group-name>" --filter Name=vpc-id,Values=<my-vpc-id>
Run Code Online (Sandbox Code Playgroud)
但是它返回了这个错误:
A client error (VPCIdNotSpecified) occurred when calling the DescribeSecurityGroups operation: No default VPC for this user
Run Code Online (Sandbox Code Playgroud)
我感谢您的帮助,
谢谢
amazon-web-services aws-cloudformation aws-cli aws-security-group
安装后awscli.我尝试了文档中提到的help命令,
$ aws help
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我可以全屏看到以下页面.似乎无法摆脱它.
我试过Ctrl+C,它不会回到我的Ubuntu命令行.
AWS() AWS()
NAME
aws -
DESCRIPTION
The AWS Command Line Interface is a unified tool to manage your AWS
services.
SYNOPSIS
aws [options] <command> <subcommand> [parameters]
Use aws command help for information on a specific command. Use aws
help topics to view a list of available help topics. The synopsis for
each command shows its parameters and their usage. Optional parameters
are shown in square brackets.
Run Code Online (Sandbox Code Playgroud) 我们有两个s3存储桶,并且有一个同步cron作业,应将bucket1的更改复制到bucket2。
aws s3 sync s3://bucket1/images/ s3://bucket2/images/
Run Code Online (Sandbox Code Playgroud)
将新映像添加到bucket1时,它会正确地复制到bucket2中。
但是,如果我们将该图像的新版本上载到bucket2,则在下次运行同步作业时,它实际上会将旧版本从bucket1复制到bucket2,从而替换了我们刚才放置的较新版本。
这是迁移过程的一部分,一段时间后,唯一要上传到的位置图像将是bucket2,但是暂时有时它们可以上传到其中一个,我们只希望将bucket1中的更改复制到bucket2中,并非相反。
为什么aws同步作业似乎认为bucket1上的文件已更改?是否不知道bucket2中的文件是较新的文件,因此应该将其保留?
尝试使用下面的cli命令创建一个cloudformation堆栈时出现以下错误.
aws cloudformation create-stack --stack-name subodh-local-stack --template-url s3URL/template.json --parameters s3URL/params.json
Run Code Online (Sandbox Code Playgroud)
错误:awscli.argprocess.ParamError:解析参数'--parameters'时出错:无法检索https://s3.amazonaws.com/ //params.json:收到非200状态代码403 2017-08-18 01: 32:31,309 - MainThread - awscli.clidriver - DEBUG - 以rc 255退出
template.json:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"Type": "AWS::Lambda::Function",
"Properties": {
"FunctionName": {
"Ref": "LambdaFunctionName"
},
"Handler": {
"Ref": "LambdaHandler"
},
"Role": {
"Ref": "LambdaExecutionRoleArn"
},
"Code": {
"S3Bucket": {
"Ref": "LambdaSourceBucket"
},
"S3Key": {
"Ref": "LambdaSourceKey"
}
},
"SubnetID": {
"Ref": "LambdaSubnetID"
},
"Runtime": "nodejs4.3",
"Timeout": "25",
"MemorySize": "128",
"VpcConfig": "vpc-2323454f",
"securityGroupID": "sg-0sdfs17g"
} …Run Code Online (Sandbox Code Playgroud)