Route 53 Cannot Find CloudFront Distribution

Problem

You have create a CloudFront distribution with a custom domain name (such as yourdomain.com).

Now if you try to link this distribution to your domain using Route 53, you get the following error message:

`No AWS resource exists with the Alias Target that you specified.`

error_message

Solution

Try the following to solve this problem:

  • Make sure that the CNAME you specified for the CloudFront distribution matches your domain name exactly. For instance, if your domain name is http://www.yourdomain.com, make sure that this is also the CNAME.
  • When creating the record set in Route 53, make sure to select the record type `A – IPv4 Address` and not CNAME.

ipv4

 

 

Solving ‘One or more of your origins do not exist’ for Cloud Front

Problem

You are trying to create a CloudFront distribution using Amazon’s API.

You get the error:

“One or more of your origins do not exist”

Solution

In my case, I provided a different value for these two properties:

DistributionConfig.DefaultCacheBehavior.TargetOriginId

and

DistributionConfig.Origins.Items[0].Id

Just make sure that the Id for one of your origins matches the TargetOriginId of the DefaultCacheBehavior and the error should disappear.

 

 

Sharing Folders with VirtualBox

Problem

You would like to share a folder between a VirtualBox Linux Guest and a Windows Host.

Solution

  • Start your VM
  • Switch to Windowed Mode
  • Select Devices / Shared Folders / Shared Folder Settings …
  • Create a New Folder on your Linux Guest. e.g.:
    • /home/[Your User]/WinDocuments
  • Add a new Shared folder there, e.g.
    • Share Name WinDocuments
    • Windows Folder: C:\Users\[Your User]\Documents
  • Open a Terminal and run the following:
sudo mount -t vboxsf -o rw,uid=1000,gid=1000 Documents /home/[Your User]/WinDocuments

Now you should be able to copy files to and from Windows from your Linux host.

windocs

Permission Problems

There are often tricky permission problems that prevent you from copying folders to Windows. You will get messages like ‘Access denied’ or ‘Error while copying’ or ‘You do not have permissions for this operation’.

There are many ways to fix this, but the easiest is to start your the file browser of your Linux system with sudo or, if your Linux doesn’t come with an UI, copy the files using sudo.

For instance, if you have the Nautilus file browser installed, run the following on the command line:

sudo nautilus

Then navigate to your shared folder and copy the files there.

Otherwise, copy files as follows:

sudo cp /local/file /home/[Your User]/WinDocuments

Unmounting the Folder

When you are done working with the files, simply run the following from the command line:

sudo umount /home/[Your User]/WinDocuments

References

Fix PhoneGap Shows Black Screen after Splash

In order to test how an ObjectHub Micro App can be packaged as a PhoneGap application, I used PhoneGap Build to package up a simple application.

Unfortunately, the application that I developed started off with a big, ugly black screen instead of a splash screen.

It took me quite some digging around to find out what was going on there. So here I have collected some potential solutions for the problem.

  • Do the src attributes in the splash elements point to valid files?
  • Are you using PhoneGap Build? In that case, follow the instructions on the PhoneGap Build documentation.
  • Did you include the following in your config.xml:
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="50000" />

  • You can try this workaround to have your app load quicker.
  • You can try to manually handle the splash screen lifecyle as shown here.

Further Links

 

Test if Firebase is Initialized on Node.JS / Lambda

Firebase is build on the assumption that it will only be initialized once.

This can be a problem in Node.JS applications sometimes, especially if they are run as part of an Amazon Lambda function.

This can lead to errors as the following:

Firebase App named '[DEFAULT]' already exists.

Thankfully, there is an easy way to check if Firebase has already been initialized (firebase.initializeApp). Just wrap your call to initializeApp in the following:

if (firebase.apps.length === 0) {
    firebase.initializeApp({
        serviceAccount: {
            ...
        },
        databaseURL: ...
    });
}

Sources

Testing Internet Connection Quality (with multiple hosts)

It’s always a good idea to test the speed of your Internet connection after getting a new router of Internet provider. However, my Internet connection sometimes becomes mysteriously slow.

In that case, it is great to verify that is a problem with the Internet connection or maybe with the services you are using.

There are plenty of tools available for testing your Internet connection speed. Some of these are:

However, all of these are not very reliable, since they only test the connection of your computer to one server.

Now, the Internet is a big and complex thing and that you can download quickly from one server does not mean that you can download well from others.

Thankfully, there is the service testmy.net which allows you to test your connection to a whole bunch of servers at the same time.

This can be done as follows:

servers

  • Click on the button Test My Internet

Note that sometimes there can be an error while you perform this. In that case, just run the test again.

You should soon receive an result as the following:

result.PNG

Don’t be too worried when you are getting the message ‘You might have a problem …’. Usually, if you have a DSL connection anything around 1 Mbps and above should be fine.

 

Automatically Make Snapshots for EC2

A quick Google search reveals that there are quite a few different approaches for automatically creating snapshots for EC2 images (such as herehere and here).

All of these are rather difficult to do.

Thankfully, after some more searching around I found a great way to schedule regular snapshots using AWS CloudWatch.

CloudWatch supports a built-in target for ‘Create a snapshot of an EBS volume’:

target

For details of how this can be set up, see the excellent step-by-step instructions on the CloudWatch Documentation.