Questions tagged [boto]
23 questions
6
votes
2 answers
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(**kwargs) and authorize_ingress(**kwargs)?
The…
Tom
- 616
- 8
- 13
3
votes
2 answers
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 says it is possible, however it does not indicate…
hafichuk
- 762
- 2
- 5
- 18
2
votes
0 answers
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, grabs the instances you want based on tags, and then…
UtahJarhead
- 908
- 7
- 14
2
votes
1 answer
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-time 2017-01-04T02:00:00 --period 60 --statistics…
Putnik
- 2,095
- 3
- 23
- 40
2
votes
1 answer
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 Windows 2012? (preferably with python)
nu everest
- 907
- 3
- 13
- 27
2
votes
1 answer
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 using shell command( python -c "filename").I am…
Abinaya Sadhasivam
- 121
- 4
2
votes
4 answers
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/
While running ec2.py, I am getting the following…
user321079
1
vote
1 answer
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 modifying tags and e.g. to set an empty value but I need…
Putnik
- 2,095
- 3
- 23
- 40
1
vote
1 answer
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-west-2')
instances = ec2.instances.filter(Filters=[
…
fredley
- 555
- 1
- 5
- 14
1
vote
0 answers
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 possible w/o using 3d-party tools like pipework…
Anzor A. Khoutov
- 11
- 1
1
vote
3 answers
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. Without sudo rights it works. I have no idea why it…
SPRBRN
- 561
- 4
- 12
- 27
1
vote
1 answer
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 get_all_reserved_instances(), then for each…
Vikas Saini
- 163
- 3
0
votes
1 answer
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",
"Effect": "Allow",
"Action":…
user31415629
- 301
- 2
- 12
0
votes
1 answer
How to show if ip address exists in AWS instances with AWS SDK on python?
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 == '192.168.1.1':
print('yes')
else:
…
Piduna
- 501
- 3
- 10
- 23
0
votes
1 answer
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.
What I want is to not have anything remotely related…
Nishant Dixit
- 101
- 1