Friday, 15 June 2018

Supercharging your Pardot with AWS Serverless Content Delivery Network (CDN)


So I ran a talk at the Pardot London User Group on how to use a CDN to help speed up your pages and delivery content pages quicker.

This is me converting that talk into a step by step guide for a hopefully a Pardot Admin to setup there on CDN (Content Delivery Network) on AWS (Amazon Web Services).

Setup an AWS Account


Step 1: Setup an AWS Account .


Register a Domain 

Choice Number 1: Address for your content delivery. i.e static.pardotlondondemo.com  If you already have a domain setup and hosted you would need to adapt these steps in places, if there is demand I will write a blog post showing the difference. . i.e You want to use the company domain for me that would be ebsta.com for example. But for the purpose of this blog post I am going to show an end to end solution.

For most people in Marketing this will not be in there control so for today I am going to also show you how to setup using a domain bought from Amazon. This will smooth the process of setup and also means you content setup is completely separate from any corporate domain name setup.  This should help you test and also configure before you decided to use a corporate domain in the future.

Step 2: Let's setup a Domain (Website Address i.e pardotlondondemo.com) . In the services Drop down type : Route 53




This will be the way find all the services we need in AWS.

Select Route 53.  This is Domain Name Services (I have linked explanation) in AWS.

Step 3: Register a domain.  Once you have decided on  a domain it is time to register it.



Step 4:
In the box Type a Domain type in a domain name you would like to use. i.e in my case pardotlondondemo I have chosen also .co.uk  from the drop down.



We run a check first to see that it is not already registered to someone else and once we find a name that is not we are able to purchase it.


We "Add to Cart" and click Continue at the bottom.

Step 5:
We then go through the next two steps Register the domain . If this company you may want to make sure you check to register it to a company address and company details. It is important you get these correct. So if in doubt ask I.T department. Once you have completed the Contact Details and you will be asked move onto the Verify Purchase process check your details are 100% correct here.


Once happy with your details. Check the Terms and Conditions box and "Complete Purchase".


Note the this :


This will be different depending on the type of domain your registered i.e .com / .co.uk / .net so worth reading this.

We click to "Go to Domains"


Right This might be Cup of Tea time or Coffee.. But we can do at least one thing while we wait. Lets setup S3 Bucket.

Setup a S3 Bucket

Step 1:
We go to Services drop down again and type s3



What is S3 while in simple terms it like a Cloud Hard Drive services.  It allows you store massive amounts of files easily.

We then get to the screen that looks at bit like this.




Step 2: We want to push the button Create bucket

Step 3 : Enter a bucket Name i.e I am using "pardotlondonuk"  and make sure the region is US East (N. Virginia)



Click Next

Don't make any chances on the "Set Properties"  just click Next button again.

Don't make any chances on the "Set Permissions"  just click Next button again.  Very important you don't change the defaults here.

On the Review click "Create Bucket" and you are good.

Bucket Creations is generally very quick and you should see in your view the new bucket and specifically on the dashboard you should see 0 Public.  We don't want our bucket to be public. 


You can click on the bucket and you should see that is empty.



Let's leave it there and go check on our domain.

Check on Domain Registered Successfully. 


In the services drop down type : Route 53





We should now hopefully have an Alert that says the following:


"Domain registration successful" for your chosen domain.

If not then we need to wait or review what problems we might have missed in the Pending Requests under the Domains left side menu.


Often this is because we have received a verification email to the address we provided and we need to click on it. Sometimes though it can simply be a matter of time for a request to go through. This now a cup of tea time or go enjoy the sunshine.

Once you domain is successful. Then lets move on the magical bit of Cloud front Services and SSL.

Setting up SSL certificate using Amazon Certificate Manager


1) In the services drop down type : certificate manager




2) Make sure we are in North Virginia  We want to make sure we create certificates in N. Virginia  US EAST (N. Virginia)

Check you are in the right area. in the top right should see the follow next to your name.



If not select the drop down and make sure you are on it.

3)
Right once we are happy we are there let's get started with Request a certificate request.

Push the button: Request a Certificate

We should see the following :



Check the box if not already checked:  "Request a public certificate"  click the button Request a Certificate

4) Enter our domain of our Certificate.

This will be the address for your static content on your domain. i.e https://static.pardotlondondemo.co.uk/

Decisions decisions. For static content I like use the name static. instead of for example www. If you cannot decided now your can use a wildcard certificate by using a * instead.

For my case though I am going to use static.pardotlondondemo.co.uk as the address I am going to server by content from. But I will put in also a provision for images.pardotlondondemo.co.uk  by clicking on the "Add another name to this certificate"

It looks like this:



Once you are happy click Next

5) Validation Method:

We now chose our validation method for validating the ownership of the certificate in our case we are going to use DNS validation because we already have our Domain hosted in AWS.  We click Review

We review the domain and confirm it.


Make sure you don't have typo's in here and click Confirm and Request. 

6) We then get to confirm our SSL by Validation, after the loading has finished we can the use the Create Record in Route 53 buttons. This is pretty simple we just drop the domains tab icon down and this gives us the details and the button. Push the Create Record in Route 53.




It will then give you a create record box pre filled in and your push the create button like so.



We do this for each record we want.

You should then end up with a screen like so :


We click Continue 

Validation can now take up to 30 mins this time to go get a cup of tea or do something else.  (in my case it took less than 5 mins)

We will need to SSL certificate to be validated before we can start Cloud Front setup the last bit of magic.

We waiting for a status of Issued:

It should look like this :



Setup Cloud Front 

1) Now that we have all the building blocks in places lets gets the CDN up and running. 


Type in cloudfront from the in the drop down menu on services.

2) Click the button "Create Distribution"

3) Select chose the button "Get Started" under the Web description.



4) Now we get Create Distribution screen. Which looks a touch scary to say the least.

So lets break it down settings by settings

Have highlighted what I changed in the origin settings.

Lets work our way down.

The Origin Domain Name is our S3 bucket you will be able to see this on the dropdown.

We don't set a Origin Path because we will use the root of the buckets as the base for serving content.

We want to "Restrict Bucket Access" so we check the Yes.

We want Origin Access Identity, so we check the Create a New Identity

"To require that users always access your Amazon S3 content using CloudFront URLs, you assign a special CloudFront user - an origin access identity - to your origin. You can either create a new origin access identity or reuse an existing one (Reusing an existing identity is recommended for the common use case). Additional configuration is required. In the Help, see "Serving Private Content through CloudFront"."


For Grant Read Permissions on the Bucket . Yes, Update Bucket Policy . We want the policy to connect to be updated for us. 

We set one Origin Custom Headers 

Allowed Origin and value of https://go.pardot.com 

This is for Pardot to serve content off. 


Default Cache Behavior Settings

In the Default Cache Behavior Settings we only make one change. 




We just want to check the Viewer Protocol Policy to be "Redirect HTTP to HTTPS"

We want to always make sure sure our content gets served from HTTPS. 

We will everything as standard in this section. 


Distribution Settings




We set the alternative name to our SSL certificate address i.e static.pardotlondondemo.co.uk 

We set the SSL Certificate to be a Custom SSL Certificate and we select our certificate in this case static.pardotlondondemo.co.uk 

We can now leave everything else in the default state.


We get to the bottom and click Create Distribution

At this point see the status of Cloud Front Distribution we click on Distributions




At this point we need to copy the address of the Cloud Front Domain name and use it to create a CNAME in our Route 53 DNS .  (Yeah that sound scary, but steps below should help) . 

So I have copied into notepad : d3sbaaz616zlsl.cloudfront.net

Setting our CNAME in our Route 53. 

In the services Drop down type : Route 53




We click on Hosted Zones from the left hand side menu 




You can now click on your selected domain in my case "pardotlondondemo.co.uk" 

This will bring you to screen where we can press Create Record Set



The create Record Set button will give you a side bar. 

You want to add in prefix you set for your domain. in my case static in the name section

We then select a type of CNAME from the Type dropdown. 

We select Alias to No 

We then in the Value section set the name that we got from our cloudfront domain name in my case this was d3sbaaz616zlsl.cloudfront.net

Once we are happy push the Create button at the bottom of the side bar. 

We should now have created a CNAME to our cloud front distribution. 

We now have a line that looks like this: 



We have to wait for new line to register so in the mean time lets add some content to our S3 bucket. 


Adding Content to our S3 bucket

1)
We go to Services drop down again and type s3




2) Select our bucket by clicking on the name. 

3) Push the Upload Button




4) Drag image or Click the add files button to select a image to upload. In my case I just uploaded a ebsta-logo.png. 

5) 




Because I want to keep all the default settings I just click Upload

6) My bucket now has 1 file in it and it looks like this. 




The address of my file should everything have worked should be 

https://www.pardotlondondemo.co.uk/ebsta-logo.png



If I now try to navigate to this image it gives me the following in Chrome: 

Great Success ;) 

Notice it is https served so we get a our nice secure message.  

OR 





This is because I have to wait for Domain name setup to still run through and Cloud front to finish it setup. Sometimes depending on your ISP this can take several hours.  Hold tight and this will be cup of tea of in my case time to watch a football game time. (If you look closely though you can see I am using www.pardotlondondemo.co.uk as my address instead of static.pardotlondondemo.co.uk, this because typically my setup ran through in no time at all and so I was not able to replicate this) 

If you manage to see your image then you are in business.

The next blog post will be how you get this into your pardot landing pages ;)



Bonus Next Steps


1) Enable MFA Device on your account
2) Setup a User with only Access to S3 bucket.

Sunday, 25 June 2017

AWS Redshift Useful Commands

This is basically for me but should anyone else find them useful, here is a set of commands I find useful in AWS Redshift.

I am going to keep adding as I run into them.

Show all Tables 

SELECT DISTINCT tablename
FROM pg_table_def
WHERE schemaname = 'public'
ORDER BY tablename;

Describe a table 

desc <<TABLENAME>>; i.e desc mytablename;

Saturday, 17 June 2017

Passing AWS Certifications





I took two AWS certifications last year, the Developer and the Solutions Architect both at Associate level.

I basically took them because I wanted to make sure I rounded out my AWS experience, I had been working in AWS for about 2 years already.

A couple of things I learnt in the process that I wanted to share.

1) If you have worked in AWS for a year or more try the practice exams first is a good way to gauge what you are missing and gives you an idea of the standard. I was for some reason really worried about taking them and failing it. But I was so glad I did it, it made such a huge difference when I went onto study for them seriously, it just gave me the insight I needed to understand the detail of learning needed.

2) Online resources are easily the best place to learn the information you need to pass the exams.

I cannot tell you how much A Cloud Guru made a difference in terms of getting my head around the areas that I had never touched in my day to day experience with AWS.

3) FAQs are the way forward. I would suggest giving the FAQs a full read over to supplement any online training that you do. Any service that comes up in the exam read the FAQ for it.

4) A Cloud Guru make a test IOS app to help you get into the swing of answering multiple choice questions. See the link here : Exam Guru: AWS Solution Architect - Associate I noticed today it has not been updated since 2015 . ;( Back last year I found questions that were out of date, so be warned.

Please see the message from A Cloud Guru : Which is great news:
"The questions are constantly updated to keep in-sync with our online quizzes. While the app content is always updated, the app itself (the skin) hasn't been updated which is why the date is still listed as 2015. Apple only updates the date when enhancements are made, not when content is updated."

Apologies A Cloud Guru. Thanks for putting me straight. Great to hear also. ;)

What I also did like about it though was it just got me into the practice of multiple choice and remembering to read the full question before pressing A or B. ;)  It was great for train journeys and building a bit of confidence.

5) AWS Conference events. If you can make it to any of the conference events AWS run then they normally have a certification and training team there. It is a great place to go and ask direct questions about what stuff will be in the exam, especially about new stuff  AWS had just introduced.

6) Make sure you do the training multiple choices that AWS give out as a feel of the exam. Some of the questions asked can be very close in to the real test. Make sure you research and nail out those answers. They don't give you the answers but you can find them online with a bit of Google magic.

7) If you have a Kindle download all the books that AWS publish for free on the services.  I read loads of them and they are generally well written and short enough for you not to get to lost in. Reading the best practices books really helped me and I would say is recommended.

Being certified made a huge difference in me understand AWS working and also opened my eyes to services that I did not know existed.  I would encourage anyone who works with AWS to study for the exams, it forces you learn the limits of AWS and best practices.

Sunday, 11 June 2017

The problem I am trying to solve : A new hope for snails.

So I am trying to work on a process of identifying snails in a picture.

Why am I trying to do this? I want to create an alert when a Snail appears on my plants so I can go out and remove it before it eats all the leaves.. No seriously, I know I could be solving bigger issues but this seemed like a good place to start.

But I don't want to use pesticides in my garden and I have great patch at the back of the garden that the snails can happily eat so I spend some time picking up snails and relocating them to this home...Yes I know that is slight madness..

So I took some pictures of a snail in locations and some without in my gardening they look roughly like this:






















So ideally my program would give me a tag of snail .

So before I decided to use anything else I looked at third party solutions, I decided I would try some programs that were already out there. Why build when maybe someone has already nailed the snail issue.

Quick Google: Image recognition

AWS Rekognition
Results from AWS Rekonition:   https://aws.amazon.com/rekognition/


Very impressive, but no snail, I was though super impressed.


clarifai https://www.clarifai.com/



Again these are very impressive, when you consider the picture I sent, but still no snail.

Google Vision  https://cloud.google.com/vision/



So like any solid person I stopped there...Yeah I know.. Well to be honest I wanted to try and solve this problem with Tensorflow https://www.tensorflow.org/ and try Meta Mind https://metamind.io/ .

If I was in some sort of production world I would have probably looked at greater depth for other solutions.

I would encourage anyone to try these services and I will probably run basic a blog on how to get started with all three in the future.  But if anyone has any further suggestions for services to try I am happy to give them a go and post here.

So this is the problem I am trying to solve.