amazon-ec2

Terraform fails remote-exec (aws/ec2)

有些话、适合烂在心里 提交于 2020-06-27 09:20:32
问题 When trying to execute a shell script throw provisioner "remote-exec" in terraform connection not establish I'm using ami for ubuntu-xenial-16.04 so the user is ubuntu This is the last code that I use to execute the shell script: resource "aws_instance" "secondary_zone" { count = 1 instance_type = "${var.ec2_instance_type}" ami = "${data.aws_ami.latest-ubuntu.id}" key_name = "${aws_key_pair.deployer.key_name}" subnet_id = "${aws_subnet.secondary.id}" vpc_security_group_ids = ["${aws_security

How to execute PowerShell command through Terraform

自作多情 提交于 2020-06-26 14:12:02
问题 I am trying to create a Windows Ec2 instance from AMI and executing a powershell command on that as : data "aws_ami" "ec2-worker-initial-encrypted-ami" { filter { name = "tag:Name" values = ["ec2-worker-initial-encrypted-ami"] } } resource "aws_instance" "my-test-instance" { ami = "${data.aws_ami.ec2-worker-initial-encrypted-ami.id}" instance_type = "t2.micro" tags { Name = "my-test-instance" } provisioner "local-exec" { command = "C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\

How to execute PowerShell command through Terraform

天大地大妈咪最大 提交于 2020-06-26 14:11:26
问题 I am trying to create a Windows Ec2 instance from AMI and executing a powershell command on that as : data "aws_ami" "ec2-worker-initial-encrypted-ami" { filter { name = "tag:Name" values = ["ec2-worker-initial-encrypted-ami"] } } resource "aws_instance" "my-test-instance" { ami = "${data.aws_ami.ec2-worker-initial-encrypted-ami.id}" instance_type = "t2.micro" tags { Name = "my-test-instance" } provisioner "local-exec" { command = "C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\

Invoke a script on EC2 termination

妖精的绣舞 提交于 2020-06-26 06:39:28
问题 I have to take certain actions during AWS autoscaling scale-in event.The ec2 instance should be able to save some logs and reports to S3 bucket. This can take anywhere between 5 to 15 mins. I already have a script that gets called on termination: ln -s /etc/ec2-termination /etc/rc0.d/S01ec2-termination However the script ends abruptly within 5 mins. I am looking at leveraging AWS LifeCycle hooks to extend the EC2 lifetime. The documentation is not clear on invoking a script in a way similar

Why does applying a condition to ec2:DescribeInstances in an IAM policy fail?

浪尽此生 提交于 2020-06-26 05:55:41
问题 When trying to configure which instances can be listed using policies, I remark the following issue: When the condition is not implemented, all instances are visible. When any condition is implemented, nothing is visible. The example policy with condition is included: { "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1461235889000", "Effect": "Allow", "Action": [ "ec2:DescribeInstances" ], "Resource": [ "*" ], "Condition": { "StringEquals": { "ec2:InstanceType": "r3.xlarge" } } } ] }

Why does applying a condition to ec2:DescribeInstances in an IAM policy fail?

戏子无情 提交于 2020-06-26 05:54:21
问题 When trying to configure which instances can be listed using policies, I remark the following issue: When the condition is not implemented, all instances are visible. When any condition is implemented, nothing is visible. The example policy with condition is included: { "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1461235889000", "Effect": "Allow", "Action": [ "ec2:DescribeInstances" ], "Resource": [ "*" ], "Condition": { "StringEquals": { "ec2:InstanceType": "r3.xlarge" } } } ] }

Getting IAM username in terraform

筅森魡賤 提交于 2020-06-25 17:04:44
问题 We have many IAM users, all creating self-serve infrastructure on EC2 using Terraform. Users don't necessarily set the key for their instances, so it's hard to tie an instance to a particular user. I realize we could dig through CloudTrail to find out which users are creating instances, but it seems like it would be simpler to tag the instances with the current IAM username. The problem is Terraform doesn't appear to expose this - I can use aws_caller_identity or aws_canonical_user_id , but

Get permission to work with files on my Amazon EC2 Ubuntu server using FTP-WinSCP

有些话、适合烂在心里 提交于 2020-06-25 09:48:12
问题 I have an Ubuntu server on Amazon, I installed everything for working with it (php, mysql, phpmyadmin, apache..), The problem is that I cant move around or edit files using the FTP. I get the error message: Permission denied. Error code: 3 Error message from server: Permission denied from my WINSCP. The only way I can trancefer/edit file is using 'putty' with the sudo/nano command. I found a lot of information about this on google, but there are no updated soulution I can find. Linux isn't my

How to monitor EC2 instances by memory?

余生长醉 提交于 2020-06-25 09:36:09
问题 Using Cloudwatch you can monitor your EC2 instances by several criteria, such as network usage, CPU usage, and so on… Unfortunately, there is no metric for memory consumption. First of all, just out of curiosity, I would like to know, why? Can anybody explain why it is possible to, e.g., monitor CPU usage, but not memory usage? At least to me, that's not obvious. And then, my actual question: Okay, given that Cloudwatch doesn't allow monitoring the EC2 instances' memory usage - what is the

Kubernetes: mount: special device does not exist when attaching AWS EBS volume

血红的双手。 提交于 2020-06-25 04:02:33
问题 dear Kubernetes guru's! I have spinned kube 1.4.1 cluster on manually created AWS hosts using 'contrib' Ansible playbook (https://github.com/kubernetes/contrib/tree/master/ansible). My problem is that Kube doesn't attach EBS drives to minion hosts. If I define the pod as follows: apiVersion: extensions/v1beta1 kind: Deployment metadata: name: kafka1 spec: replicas: 1 template: spec: containers: - name: kafka1 image: daniilyar/kafka ports: - containerPort: 9092 name: clientconnct protocol: TCP