The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

This policy will still matter for any EC2s running non-Linux OS. Windows, MAC OS, and RedHat Enterprise Linux all are billed hourly and this would matter there. "Pricing is per instance-hour consumed for each instance, from the time an instance is launched until it is terminated or stopped. Each partial instance-hour consumed will be billed per-second ...


1

Following steps to setup passwordless authentication on EC2. Login to you EC2 machine as a root user. Create a new user useradd -m <yourname> sudo su <yourname> cd mkdir -p ~/.ssh touch ~/.ssh/authorized_keys Append contents of file ~/.ssh/id_rsa.pub on you local machine to ~/.ssh/authorized_keys on EC2 machine. chmod -R 700 ~/.ssh chmod ...


1

You can use scp to transfer a file from the server. scp -i <ec2-ssh-key> ec2-user@your-instance:/path/to/rsa <local_path> It is also possible just to copy the content of a private key and paste into a local file. e.g. cat ~/.ssh/rsa


0

Create a user on your EC2 instance, then generate them a key. Grant that user permissions to access whatever they need access to. I have a tutorial on creating an EC2 user with a certificate. In short Create the user sudo su sudo useradd fred passwd fred Create the key su fred ssh-keygen -f rsa mkdir .ssh touch .ssh/authorized_keys chmod go-w ~/ chmod ...


1

You can use this Python tool to list security groups with their dependencies. It also allows for listing unused (obsolete) security groups: https://github.com/mingbowan/sgdeps


-1

The solution will work if you are sharing an AMI in the same region. If not, you need to copy the AMI to the target region first. I wrote a blog explaining all these steps in detail at https://medium.com/@gmusumeci/how-to-move-an-ec2-instance-to-another-aws-account-e5a8f04cef21 Guillermo


1

1) Why would an instance start to gradually impair after 24 hours? There is no issue with EC2 instances that run >24hrs. Your application is probably buggy, and slowing down over time. Perhaps there is a memory leak leading to increased swapping? 2) How can I auto-terminate instances that run longer than 24 hours? There are many ways. The simplest is ...


1

You need to use the describe-spot-fleet-instances command: aws ec2 describe-spot-fleet-instances --spot-fleet-request-id <value> For more info read the aws-cli help: aws ec2 describe-spot-fleet-instances help


0

You can put this in userdata: #cloud-config system_info: default_user: name: otherusername


1

Use the detach-instances api to remove the instance from the autoscale group 1-2 minutes before your shutdown. The detach-instances api will also remove the instance from a load balancer if attached, see https://docs.aws.amazon.com/en_pv/autoscaling/ec2/userguide/detach-instance-asg.html for more information. Exanple: aws autoscaling detach-instances -...


1

Unfortunately I suspect this is impossible. This is because both in the AWS-CLI and in boto3 for python on which the AWS CLI is based the platform option in describe images is designed to return a blank if it is not in windows and "windows" if it is a windows machine. Citations: For Boto3, for the CLI.


1

You might want to double-check your php version. I have php7.0 as the bundled version in my Ubuntu 16.04 installs. IIRC, PHP5 has been deprecated/left-for-dead Also, this suggests you're running out of RAM: apache2 invoked oom-killer: gfp_mask=0x24201ca, order=0, oom_score_adj=0 Possibly add more RAM, disk swap, or at least a swap file and see if ...


0

Question is answered here: https://stackoverflow.com/questions/18344390/how-do-i-get-aws-ec2-to-not-reset-my-sshd-config-file Configuration is in the /etc/cloud/cloud.cfg file


0

I have also faced this problem a few times and found a solution that works for me and hope will work for you too. Most of the time when we ssh into an ec2 instance(say instance 1) from another ec2 instance(say instance 2) that is connect via ssh from our local machine we need a private key file i.e a ".pem" file to authenticate the identity of instance-2 to ...


1

The reason for what you are seeing is documented, but there is not a lot of detail or discussion of the implications provided in the documentation. The CloudFront network has two tiers. There's the outer "global" tier and the inner "regional" tier. Most AWS regions have a regional CloudFront edge in them, but not all -- and Hong Kong is currently an ...


0

Couple of problems with your CFN template: The RDS subnets have default route pointing to the Web instance - I doubt you want to do that. Generally you'll only have 2 or 3 Public subnets using IGW for 0.0.0.0/0 and 2 or 3 Private subnets using NAT GW for 0.0.0.0/0. All your instances and databases should be in the Private subnets and the ALB should be in ...


0

Check: routing tables security groups VPC flow logs etc. Try to fix it in the console and when it works do the same in TerraForm or CloudFormation. Hope that helps :)


0

I faced the same issue in AWS. I am trying to access the instance from a private subnet through public. Whenever i run the command ssh -i key.pem ec2-user@**private ip** (from a linux terminal), I get the following prompt: Enter passphrase of key.pem: So what I did was to run the following command on the file: $vi key.pem I saw whatever .pem (private ...


0

If you already have a key in ~/.ssh/id_rsa on your local computer then you should be able to use the command ssh-copy-id to install the key on the remote computer. ssh-copy-id Usage: /usr/bin/ssh-copy-id [-h|-?|-f|-n] [-i [identity_file]] [-p port] [[-o <ssh -o options>] ...] [user@]hostname -f: force mode -- copy keys without trying to check ...


0

I ran into the same problem as OP. My problem was that I was specifying the role ARN instead of the roleName. This was causing me to get the same 404 error that OP is getting. The 404 error made it appear as if I was providing the wrong S3 path but really it was the role that cfn-init was using.


1

You can connect and login on the default FTP port (TCP 21) but can't establish the second TCP connection, the data connection, that is required for passive FTP data transfers (and a directory listing is a data transfer). The PORT response typically contains 6 octets that encode the server address the passive data connection needs to be made to. eg PORT h1,...


2

Outbound connections are not blocked by default, usually 0.0.0.0/0 Can you browse the ftp site from your EC2 instance? ftp://site.com They may have allowed a certain IP to connect on their side (your home), but not your VPC in AWS.


1

The information is right there in your graph. For all days (September 1 to October 1), you were charged: EUW2-BundleUsage:0.5GB EUW2-DiskUsage This looks like 2x 500 MB instances + disk in eu-west-2 region (London). On September 28, you launched another 2x Lightsail instances: EU-BundleUsage:4GB EU-BundleUsage:1GB So a 1GB instance and a 4GB instance ...


0

A legit way around this is to use the API to change the ELB healthcheck timeouts. You can't disable or suspend it but you can change the path OR the timeout and interval. If you are using Ansible you can use a task before and after deployment. Here are modules to do this for an ELB and ALB (via Target Groups): https://docs.ansible.com/ansible/latest/...


1

There are a few different methods depending on what OS you're using. With Amazon Linux AMI 2017.09.01 or later (including Amazon Linux 2), you can run the ebsnvme-id command as follows to map the NVMe device name to a volume ID and device name sudo /sbin/ebsnvme-id /dev/nvme1n1 Which will provide output like this: Volume ID: vol-01324f611e2463981 /...


2

Your EBS block device was paritioned with MBR partitioning scheme, which allows partitions to have a maximum size of 2 TB. To have larger partitions you must use GPT partitioning scheme when creating the disk partitions. If you're booting from the volume, you should consider making a new volume to hold your data instead of extending the size of the boot ...


0

Using Packer to make AMIs, I had the same problem - when I launched an AMI made by Packer, any drives added were offline. I fixed it by adding to an existing PowerShell script provider in Packer the following line: Set-StorageSetting -NewDiskPolicy OnlineAll As this is a security sensitive environment, it's possible that a security scan will find that and ...


0

If your utilization of the EC2 server is a spiky one (i.e. long times of inactivity and then a sudden spike followed by inactivity again), then it would be a good idea to move to lambda functions. A faster cost saver would be to move to a smaller burstable machine type (eg t2). These types let your CPU go beyond 100% for a period of time. Also, staying ...


1

When a request comes in via the ELB the response is effectively returned via the ELB. You don't need to do anything to enable this. You only need to use a NAT if you want instances in private subnets to be able to initiate connections to the internet. Based on what you've asked NAT is not required. However, if your question doesn't quite describe your ...


0

I just ran into the same "problem" with an VPS from OVH. In my case (and many others I found while Googling) the only changes were whitespaces. Where they come from I don't know, but if you select show the differences between the versions and the answer is No non whitespace changes detected just take the maintainers version.


0

So essentially you want to run your jobs only once, either on A or B, but not on both, correct? You'll need some locking / semaphore mechanism, election of the "cron master", or something like that. One way that I have done in the past is have events generated by AWS CloudWatch Rule every X-minutes, send those events to SQS Queue and all the servers in the ...


1

If you're pulling via SSH, and if you use ssh-agent to manage your keys on either the laptop or tower (or both), this could be due to SSH agent forwarding: SSH agent forwarding can be used to make deploying to a server simple. It allows you to use your local SSH keys instead of leaving keys (without passphrases!) sitting on your server. Even with ...


0

I had a similar problem with a CentOS instance. This AWS support article gives quite a good overview. Here's how I and managed to solve my problem: Shut down the original EC2 instance and then detach the /dev/sda1 disk Start a new, temporary EC2 instance, and attach the disk as /dev/sdp to the new EC2 instance SSH into the new EC2 instance and mount /dev/...


0

I've been testing with so many things that I copied the wrong IP to fstab. This works.


0

I left out I was using Letsencrypt as certificate provider. I was able to fix the issue and would like to leave this answer up for others who might run into this issue as well. In my httpd.conf, there was IncludeOptional conf.d/*.conf IncludeOptional sites-enabled/*.conf Include /etc/httpd/sites-available/virtualhosts-le-ssl.conf Inside my virtualhosts-...


0

To do this you just add them in your EC2 Resource property directly under SecurityGroupIds: Resources: EC2Instance: Type: AWS::EC2::Instance Properties: InstanceType: Ref: InstanceType SecurityGroupIds: - sg-12345 - sg-12312 KeyName: Ref: ...


0

It appears they have Elasticsearch Service. That's where ElasticSearch is running.


0

To figure out which one is running you can run ps ax | grep -E '(apache2|httpd|nginx)' and see what comes out.


0

If you want to load balance between your front web tier and a back end tier you would need a load balancer between the public and private subnets. The public ELB does not connect to the private subnet. A feature of having a private subnet is that it isn't accessible from the internet, regardless of any load balancer - note that as per Michael's comment ...


1

Stumbled upon this question, EC2 Hibernation is now supported for Ubuntu 18.04. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html#hibernating-prerequisites


1

I have solved this issue by help the community here is the code. import boto3 ec2 = boto3.resource('ec2', region_name='us-east-2') def lambda_handler(event, context): images = ec2.images.filter( Filters=[ { 'Name': 'description', 'Values': [ 'lambdaami', ] ...


Top 50 recent answers are included