amazon-ec2

Is there a way to confirm user_data ran successfully with Terraform for EC2?

喜夏-厌秋 提交于 2020-07-09 17:11:55
问题 I'm wondering if it's possible to know when the script in user data executes completely? data "template_file" "script" { template = file("${path.module}/installing.sh") } data "template_cloudinit_config" "config" { gzip = false base64_encode = false # Main cloud-config configuration file. part { filename = "install.sh" content = "${data.template_file.script.rendered}" } } resource "aws_instance" "web" { ami = "ami-04e7b4117bb0488e4" instance_type = "t2.micro" key_name = "KEY" vpc_security

How can an ECS task know in which region is runs?

落花浮王杯 提交于 2020-07-09 14:58:42
问题 I have a python application using boto3 in a task launched by ECS (in a docker container). The boto3 command I use need a region to work properly, but I only know the region at runtime (multi-region application). The idea was then to define the AWS_DEFAULT_REGION environment variable by retrieving the region in the dynamic document provided by Amazon from URI http://169.254.169.254. However, whereas the call works fine from the instance, I cannot access the endpoint from within the task

AWS RDS Database show timeout error

喜你入骨 提交于 2020-07-07 11:29:36
问题 When accessing RDS from an EC2 instance that time show me timeout error Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] Connection timed out in i have try to specifying the IP address of the EC2 instance and specify the internal IP of the RDS instance but error is same. 回答1: The most probable reason is that your RDS Security Groups are not configured to allow incoming traffic. You need to change those security groups and allow inbound traffic. Would recommend that inbound traffic's

aws boto - how to create instance and return instance_id

这一生的挚爱 提交于 2020-06-29 11:28:20
问题 I want to create a python script where I can pass arguments/inputs to specify instance type and later attach an extra EBS (if needed). ec2 = boto3.resource('ec2','us-east-1') hddSize = input('Enter HDD Size if you want extra space ') instType = input('Enter the instance type ') def createInstance(): ec2.create_instances( ImageId=AMI, InstanceType = instType, SubnetId='subnet-31d3ad3', DisableApiTermination=True, SecurityGroupIds=['sg-sa4q36fc'], KeyName='key' ) return instanceID; ## I know

I can't do bundle install because of gem pg(0.18.4)

Deadly 提交于 2020-06-29 10:53:45
问题 I am using ec2 on aws and trying to deploy my rails app. I successfully git cloned my app to my ec2-user then tried bundle install but which didn't work because of gem pg. I don't know why I can't do bundle install. I tried several solutions on stack overflow but anything didn't work. need your help. Fetching gem metadata from https://rubygems.org/........... Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Rubygems 2.0.14.1 is

Connecting to MySQL on AWS via Query Browser While Outside the U.S

心不动则不痛 提交于 2020-06-29 09:58:49
问题 I am running MySQL on an Amazon AWS Instance. I was able to previously connect to the MySQL Database via MySQL Query Browser. Now I am traveling outside the U.S. and I am having trouble connecting via the Query Browser. I am able to use Terminal to create an ssh connection and then login to MySQL, so it does not appear to be a larger issue with the MySQL Database. Has anyone else had a similar problem? Any ideas how I can fix this? This is the error I get from the MySQL Browser Your

psycopg2.errors.InsufficientPrivilege: permission denied for relation django_migrations

微笑、不失礼 提交于 2020-06-29 06:41:17
问题 What my settings.py for DB looks like: ALLOWED_HOSTS = ['*'] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'fishercoder', 'USER': 'fishercoderuser', 'PASSWORD': 'password', 'HOST': 'localhost', 'PORT': '5432', } } I have created a new and empty db named "fishercoder" this way: psql -U postgres create database fishercoder; ALTER USER postgres with password 'badpassword!'; CREATE USER fishercoderuser WITH PASSWORD 'password'; ALTER ROLE fishercoderuser

mysqlclient installation error in AWS Elastic Beanstalk

让人想犯罪 __ 提交于 2020-06-29 05:34:09
问题 I am deploying a django with mysql app on AWS Elastic Beanstalk, so mysqlclient library is needed. mysqlclient needs python3-devel and mysql-devel package to be installed, so I have the custom config file for it 01_packages.config : packages: yum: python3-devel: [] mysql-devel: [] Deployment fails and the log file /var/log/cfn-init.log (mentioned in Beanstalk logs) shows the error: 2020-05-31 02:17:37,565 [INFO] -----------------------Starting build----------------------- 2020-05-31 02:17:37

Running Python Script in an existing EC2 instance on AWS

半城伤御伤魂 提交于 2020-06-28 07:09:14
问题 I have an API (in python) which has to alter files inside an EC2 instance that is already running. I'm searching on boto3 documentation, but could only find functions to start new EC2 instances, not to connect to an already existing one. I am currently thinking of replicating the APIs functions to alter the files in a script inside the EC2 instance, and having the API simply start that script on the EC2 instance by accessing it using some sort of SSH library. Would that be the correct

Terraform EC2 networking broken

匆匆过客 提交于 2020-06-28 03:38:32
问题 I'm using Terraform 0.12.26 and I want to build an AWS Ubuntu machine instance. When I run terraform apply , everything looks right... but I can't ssh to the new EC2 machine. My home firewall allows ssh everywhere, and I can ssh to any other internet resources. If I manually install an EC2 instance in the same region / az, ssh works fine... this problem seems to be limited to Terraform. $ terraform apply ... Do you want to perform these actions? Terraform will perform the actions described