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 ...
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>
mkdir -p ~/.ssh
Append contents of file ~/.ssh/id_rsa.pub on you local machine to ~/.ssh/authorized_keys on EC2 machine.
chmod -R 700 ~/.ssh
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.
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 useradd fred
Create the key
ssh-keygen -f rsa
chmod go-w ~/
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
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 ...
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
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.
aws autoscaling detach-instances -...
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.
For Boto3, for the CLI.
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,
Possibly add more RAM, disk swap, or at least a swap file and see if ...
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 ...
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 ...
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 ...
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:
I saw whatever .pem (private ...
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.
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 ...
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.
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,...
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.
The information is right there in your graph.
For all days (September 1 to October 1), you were charged:
This looks like 2x 500 MB instances + disk in eu-west-2 region (London).
On September 28, you launched another 2x Lightsail instances:
So a 1GB instance and a 4GB instance ...
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):
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
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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 ...
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/...
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
Inside my virtualhosts-...
To do this you just add them in your EC2 Resource property directly under SecurityGroupIds:
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 ...
I have solved this issue by help the community here is the code.
ec2 = boto3.resource('ec2', region_name='us-east-2')
def lambda_handler(event, context):
images = ec2.images.filter(