aws-cli

How to grep a term from S3 and output object name

谁说我不能喝 提交于 2021-02-20 04:49:07
问题 I need to grep a term over thousands of files in S3, and list those file names in some output file. I'm quite new using cli, so I've been testing both on my local, and in a small subset in s3. So far I've got this: aws s3 cp s3://mybucket/path/to/file.csv - | grep -iln searchterm > output.txt The problem with this is with the hyphen. Since I'm copying over to standard output, the -l switch in grep returns (standard input) instead of file.csv My desired output is file.csv Eventually, I'll need

How do I determine what a given AWS Security Group is associated with?

瘦欲@ 提交于 2021-02-19 02:18:16
问题 The AWS EC2 Security Groups documentation mentions that "Security groups for EC2-VPC have additional capabilities that aren't supported by security groups for EC2-Classic" but the Security Groups dashboard does not provide any information on the "capabilities" of attributes of Security Groups that allow me to distinguish what kind of Security Group I'm looking at or what it is attached to, so that, for example I can't figure out whether I can consolidate Security Groups and share them across

How do I determine what a given AWS Security Group is associated with?

核能气质少年 提交于 2021-02-19 02:14:39
问题 The AWS EC2 Security Groups documentation mentions that "Security groups for EC2-VPC have additional capabilities that aren't supported by security groups for EC2-Classic" but the Security Groups dashboard does not provide any information on the "capabilities" of attributes of Security Groups that allow me to distinguish what kind of Security Group I'm looking at or what it is attached to, so that, for example I can't figure out whether I can consolidate Security Groups and share them across

AWS SQS not receiving SNS messages

旧巷老猫 提交于 2021-02-18 20:48:05
问题 I created a SNS topic that publishes all the information coming out of Cloudformation via the cli. However, when I check the queue, it is not receiving any of the SNS messages. I verified the SNS is working by subscribing my email to it, so the issue seems to be in the connection between the queue and the SNS. However, I cannot find any problems with my syntax. I, as far as I know, have followed amazon's documentation precisely. Bash: #SNS parameters SNS_NAME="${NAME}_SNS" SQS_NAME="${NAME}

AWS was not able to validate the provided access credentials. AuthFailed only at SPECIFIC regions

回眸只為那壹抹淺笑 提交于 2021-02-18 16:55:24
问题 I am trying to perform some actions via linux aws CLI. My credentials file is 100% correct. User has EC2FullAccess and Amdinistrative(highest rank) permissions. I am able to execute all commands. The problem is that following regions produce AuthFailed error, rest regions work fine: Ohio Central Frankfurt Seoul London. Those regions are all available to my account via web interface, and also aws ec2 describe-regions prints all of regions. Creating instances, for example, via web interface in

How to I loop through AWS CLI output?

无人久伴 提交于 2021-02-11 14:44:13
问题 I am trying to pass a list of values from a aws cli query to another command. Even though I have seen plenty of examples in AWS, when I try all the values come together: policy_versions=`aws iam list-policy-versions --query "Versions[].VersionId" --policy-arn $POLICY_ARN --output text` echo "policy_versions=$policy_versions" for ver in $policy_versions; do echo "first version: $ver" done Which then prints out: policy_versions=v3 v2 v1 first version: v3 v2 v1 My value of ver is the entire

aws cli s3 sync: how to exclude multiple files

為{幸葍}努か 提交于 2021-02-10 18:48:55
问题 So I have a bash script which deletes all contents from an AWS S3 bucket and then uploads the contents of a local folder to that same bucket. #!/bin/bash # deploy to s3 function deploy(){ aws s3 rm s3://bucketname --profile Administrator --recursive aws s3 sync ./ s3://bucketname --profile Administrator --exclude='node_modules/*' --exclude='.git/*' --exclude='clickCounter.py' --exclude='package-lock.json' --exclude='bundle.js.map' --exclude='package.json' --exclude='webpack_dev_server.js' -

Adding SQS Permissions with conditions using AWS CLI Command

﹥>﹥吖頭↗ 提交于 2021-02-10 18:43:03
问题 How can I add the below listed SQS permission using AWS CLI command? "Statement": [ { "Sid": "Sid8390000202", "Effect": "Allow", "Principal": "*", "Action": "SQS:*", "Resource": "arn:aws:sqs:us-east-1:12345678:example-queue", "Condition": { "ArnEquals": { "aws:SourceArn": "arn:aws:sns:us-east-1:73628827939:MySNS" } } } ] 回答1: You can save the file locally as set-queue-attributes.json with the following policy. { "Id": "Policy1564523767951", "Version": "2012-10-17", "Statement": [ { "Sid":

How to get list of instances attached to ELB in form of comma separated list

瘦欲@ 提交于 2021-02-10 06:58:17
问题 I want to get list of all instances attached to an ELB (need to use them in further processing). Here is what I have done so far : aws elb describe-load-balancers --load-balancer-name 'my-elb' --output json --query "LoadBalancerDescriptions[*].Instances[*].InstanceId" However, above command gives me the list in JSON format. [ [ "i-05676776d8cd4ab5344b0d", "i-05676776" ] ] How can I do? Thanks! 回答1: --output text and pipe it to paste aws elb describe-load-balancers --load-balancer-name 'my-elb