aws-cli

ECR Task definition: Container links should not have a cycle?

穿精又带淫゛_ 提交于 2019-12-11 05:59:33
问题 I'm using AWS-CLI to register an ECR task definition. My task definition is like follows: { "family": "", "taskRoleArn": "", "executionRoleArn": "", "networkMode": "none", "containerDefinitions": [ { "name": "", "image": "", "cpu": 0, "memory": 0, "memoryReservation": 0, "links": [ "" ], "portMappings": [ { "hostPort": 80, "protocol": "tcp", "containerPort": 80 } ], "essential": true, "entryPoint": [ "" ], "command": [ "" ], "environment": [ { "name": "", "value": "" } ], "mountPoints": [ {

How to extract a particular Key-Value Tag from ec2 describe-instances

自作多情 提交于 2019-12-11 04:46:10
问题 I've got the following from describe-instances: { "Reservations": [ { "Instances": [ { PublicDnsName": "ec2-xxxxx.amazonaws.com", "Tags": [ { "Value": "yyyyy", "Key": "Name" }, { "Value": "zzzzz", "Key": "budget_cluster" }, { "Value": "aaaaaaa", "Key": "poc" }, For each instance, I would like to extract the PublicDnsName and the value of the "budget_cluster" tag key. How to do this either with ec2 describe-instances or with jq ? 回答1: Modifying Frédéric's answer: aws ec2 describe-instances -

How to find out information about an EC2 instance from AMI id?

我们两清 提交于 2019-12-11 03:46:18
问题 This gives me information about all the snapshots I have: aws ec2 describe-snapshots From this, I can extract AMI id and find out more about the ami using: aws ec2 describe-images --image-ids "ami-xxxxxxxx" My question is, can we relate the ami id and instance that are using that ami id and find more information about it? 回答1: Run describe-instances with the image-id aws ec2 describe-instances --filters "Name=image-id,Values=ami-xxxxxxx" For text output: aws ec2 describe-instances --filters

Probable quoting issue using the stdin argument of ansible's shell module

谁说我不能喝 提交于 2019-12-11 02:54:25
问题 I've got a playbook with the following tasks: - set_fact: asg_filter: > .AutoScalingGroups[] | select(.Tags[] | select(.Key == "Role").Value == "myrole") - shell: aws autoscaling --region us-west-2 describe-auto-scaling-groups | jq --compact-output "{{ asg_filter }}" register: asgs_result - set_fact: stale_instance_filter: > .LaunchConfigurationName as $lc | .Instances[] | select(.LaunchConfigurationName != $lc) | .InstanceId Now I want to use stale_instance_filter on asgs_result.stdout . The

correct aws cli syntax to find a VPC security group in a non default VPC

孤街醉人 提交于 2019-12-10 21:25:52
问题 This is a follow on question from What is the correct syntax for filtering by tag in describe-vpcs?. Using the answer provided and referencing 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. I have constructed the cli request aws --profile myProfile --region eu-west-1 ec2 describe-security-groups --group-name MyVpcSecGroup --filters Name=tag

Filter LoadBalancer By VPC ID

孤街浪徒 提交于 2019-12-10 20:58:10
问题 I have two loadbalancers associated with two different VPC. I am able to list all loadbalancers using AWS CLI. Now I need to retrieve the name of the loadbalancer in a particular VPC. Is it can be done via AWS CLI ?? 回答1: It is true that the ELB service provides no service side filtering of results. However, you don't need to write a script to get what you want. You can use the built-in jmespath querying capability of AWSCLI. $ aws elb describe-load-balancers --query 'LoadBalancerDescriptions

Using AWS CLI from EC2 instance without internet access

三世轮回 提交于 2019-12-10 15:40:06
问题 Is there a way to use AWS CLI to call different services such as SQS, EC2, SNS from EC2 linux instance? The EC2 instance from where the AWS CLI command are invoked does not have access to internet. It is in private subnet. It is not using internet gateway or NAT. Thanks, 回答1: Not possible. The CLI has to access the API endpoints for all the services you mentioned. For that the CLI needs internet access. Only service it can access without internet is the internal metadata server. AWS Regions

Getting specific version of file from S3 bucket

旧时模样 提交于 2019-12-10 13:43:26
问题 I have a file in a S3 bucket with versioning turned on. Using the aws-cli is there a way to copy a specific version of this file, rather than the latest version? 回答1: Yes you can do that see this example you will need the version ID for the object. aws s3api get-object --bucket mybucket --key file1.txt --version-id Mj1.PcWG8e.C._7LhvFU131pXJ98abIl foo.txt Also you can list the version for getting the version ID using this commands. aws s3api list-object-versions --bucket mybucket 回答2: Yes,

EC2 instance from AWS command line

走远了吗. 提交于 2019-12-10 11:52:03
问题 I am very new to AWS. I've got a Windows instance running and have my aws command line configured. I've read through the AWS docs but can't seem to find exactly what I'm looking for. How do I view my current instances from the command line? 回答1: If by view your current instances, you mean list all running instances from the command line, you can call the describe-instances command: aws ec2 describe-instances This will list all of your current instances. See describe-instances 回答2: As noted in

How can I select all elastic IPs that are not assigned to an EC2 instance?

ε祈祈猫儿з 提交于 2019-12-09 16:23:44
问题 I'm trying to get all Elastic IPs that are not currently assigned to instances. It's easy to get all of the Elastic IPs using this: aws ec2 describe-addresses From here, it would be easy to filter out any results that do not have an "AssociationId" . However, I'm not sure how to do that using --query . I know that the --query option uses JMESPath to filter results, but I have no idea how to tell it to return me all results that do not have an AssociationId . Any help? Thanks. 回答1: You can