Questions tagged [boto]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
0 answers
376 views

AWS SSM deleting its own files as part of its execution. Any way to safely do it?

Is there a safe way to delete all of an AWS SSM runRemoteScript directory as part of execution? Details below. We've got a very robust AWS SSM setup working involving a python app that polls AWS, ...
1 vote
1 answer
2k views

How to delete tag from EBS using boto3?

I want to delete a tag from EBS volume using boto3/lambda. At this doc https://boto3.readthedocs.io/en/latest/reference/services/ec2.html#volume I see 'create_tags()' only. It is suitable for ...
  • 2,185
1 vote
1 answer
1k views

Using boto in an AWS lambda function in a VPC

I have a lambda that accesses EC2. I want to assign it to a VPC for security purposes, but when I do boto just stops working. Here's a minimal example: ec2 = boto3.resource('ec2', region_name='eu-...
  • 565
0 votes
1 answer
163 views

IAM policy doesn't let me start instances

I've attached the following policy to a user, so that they can start and stop one specific instance. { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", ...
0 votes
1 answer
44 views

How to show if ip address exists in AWS instances with AWS SDK on python? [closed]

i have a easy question. I need to show, if ip address exists or if ip address does not exists in simple condition. Little part of my code: for i in ec2.instances.all(): if i.public_ip_address == '...
  • 531
0 votes
1 answer
74 views

How to not install google cloud sdk by default while creating a Compute Engine instance?

Whenever I create a Compute Engine instance, it installs the google-cloud-sdk by default on the server. And that installs and configures BOTO on the server and set environment variables for that. ...
0 votes
1 answer
301 views

Ansible EC2 Dynamic Library Boto Error

I'm trying to run ansible with the ec2.py inventory file to make some updates on a fleet of servers. But I keep receiving the error message: ERROR! Attempted to execute "inventories/ec2.py" as ...
  • 249
0 votes
2 answers
1k views

Ansible - dynamic aws inventory: read vault variable for ec2.py key and secret

I know for ec2.py I can either specify environment variables via export before calling ec2.py or use a boto config file with plain-text passwords (or python keyring). As I have the aws key and secret ...
  • 177
1 vote
1 answer
2k views

Fastest way to terminate an EC2 instance

I have a requirement to be able to terminate EC2 instances in under a minute. The current process takes just under 2 minutes per instance because the OS shutdown process takes 60 seconds. I want to ...
  • 268
0 votes
0 answers
163 views

Cannot Connect to EC2-VPC

I would like to configure an EC2 instance in a public subnet within a VPC. To accomplish this, I have the code below, using boto3. To summarize, I create a VPC, enable DNS support and hostnames for it,...
2 votes
1 answer
4k views

access to custom cloudwatch metrics using lambda+boto3?

I have a custom metrics, and I can get data from bash: aws cloudwatch get-metric-statistics --namespace System/Detail/Linux \ --metric-name LoadAverage1Min --start-time 2017-01-04T00:00:00 \ --end-...
  • 2,185
1 vote
0 answers
36 views

How to specify an iface to map container port on AWS?

I have an EC2 instance with eth0 and eth1 interfaces that runs 2 docker containers. Now I want to map port 5000 of container0 to port 5000 on host to eth0 and port 5000 from container1 to eth1. Is it ...
2 votes
1 answer
5k views

Programmatically Check AWS EC2 CPU and Memory usage

Does boto3 make it possible to access EC2 CPU and Memory usage? I looked here, but couldn't find anything in the docs. How do I programmatically check memory and CPU usage on an EC2 server running ...
0 votes
1 answer
646 views

Boto3 error on authorize_security_group_egress

When I try to update egress rule using boto3. I get the following error: client.authorize_security_group_egress( GroupId=group_id,CidrIp="0.0.0.0/0", IpProtocol='tcp', FromPort=from_port, ...
  • 171
2 votes
1 answer
618 views

How to get the output of the python script executed in aws instance

I am trying to automate the aws instance setup using boto. I have a python script in which I will do the ssh to the instance. After ssh,I am executing a python function which is in remote python file ...
0 votes
2 answers
4k views

AWS boto filters

Below is the JSON result (for one volume) I get from running aws ec2 describe-volumes: { "AvailabilityZone": "eu-west-1a", "Attachments": [ { "AttachTime": "2015-02-23T15:...
  • 571
1 vote
3 answers
21k views

Pip / boto problems - ImportError: No module named boto3

I want to get boto3 working in a python3 script. I can execute aws commands from the cli. After updating pip, it doesn't run with sudo rights unless I use the absolute path: /usr/local/bin/pip. ...
  • 571
0 votes
1 answer
550 views

How to find total number of reserved instances under particular tag?

I am query AWS using boto ec2 in python. Firstly I find all reserved instances by get_all_reserved_instances then I am also able to find total count of each instance_type by instance_count. I am ...
1 vote
1 answer
100 views

Getting different number of AWS instances depending on how I count

I am calculating my total number of reserved instance on the basis of instance_type and I'm storing this in a dictionary by instance_type as a key. Firstly, I'm finding my all reserved instances by ...
2 votes
4 answers
4k views

Error while creating EC2 Dynamic Inventory in Ansible

I am new to Ansible. I had been using the following tutorial to set up dynamic inventory- https://aws.amazon.com/blogs/apn/getting-started-with-ansible-and-dynamic-amazon-ec2-inventory-management/ ...
user avatar
3 votes
2 answers
1k views

Using IAM roles to generate a dynamic inventory for Ansible

I'm looking at setting up a deploy server within our VPC and am trying to use an IAM role instead of keys for Ansibles dynamic ec2.py inventory script. An answer at Can I use IAM Roles for Ansible ...
  • 762
6 votes
2 answers
10k views

python boto3 allow ingress security groups

I am developing a simple python script to add rules to securitygroups, and I am wondering what is the difference between the two methods available within boto3: authorize_security_group_ingress(**...
  • 616
0 votes
2 answers
1k views

Use boto to update ElasticBeanstalk environment options

Boto has a function, update_environment, that allows the user to update options in an AWS ElasticBeanstalk environment. Using the AWS CLI, this would typically be actioned as follows: aws ...