Page 3 of 6

How to add a specific IP to your RDS security group on command line

Facebooktwittergoogle_pluslinkedinmailby feather

 

If you go towards DevOps, automated provisioning, you definetely will need to do things in automation.

 

Here is the command line, in case you need the new automated provisioned server to be added in your RDS security group:

aws rds rds-authorize-db-security-group-ingress –db-security-group-name mydbsecuritygroup –cidrip 192.168.1.10/27

How to block an IP on AWS?

Facebooktwittergoogle_pluslinkedinmailby feather

 

Security Groups on AWS by default blocks all, so you can just define what you allow. As a result, you cannot block an IP using Security Group, e.g. to prevent a specific IP to access to your web port

ACL is right there for that need. You need to define the IP/IPs which you want to block and remember to keep the rule 100 always in place:)

AWS ACL

AWS Elasticbeanstalk NewRelic agent installation

Facebooktwittergoogle_pluslinkedinmailby feather

Credits for @umitunal_

packages:
  yum:
    newrelic-sysmond: []
  rpm:
    newrelic: http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
  commands:
    "01":
      command: nrsysmond-config –set license_key=xxxxxxxxxxxxxx
    "02":
      command: echo hostname=NameOfYourServer >> /etc/newrelic/nrsysmond.cfg
    "03":
      command: /etc/init.d/newrelic-sysmond start

AWS SSL Certificate cannot be added

Facebooktwittergoogle_pluslinkedinmailby feather

Although the private and public keys are valid (Already tested on another platform), AWS Web Console is giving error while i am trying to define under ELB Listeners.

In order to debug the situtation, the following command line will be helpful:

aws iam upload-server-certificate –server-certificate-name my-server-cert –certificate-body file://my-certificate.pem –private-key file://my-private-key.pem –certificate-chain file://my-certificate-chain.pem –debug

AWS instance metadata

Facebooktwittergoogle_pluslinkedinmailby feather

Just a simple best-practice for you to know in case you need to get instance related data during automation:

curl http://169.254.169.254/latest/meta-data/

For example, if you want to use the hostname in your automation, just use the output:

$ curl http://169.254.169.254/latest/meta-data/hostname

WordPress and CloudFront Access-Control-Allow-Origin problem a.k.a. CORS

Facebooktwittergoogle_pluslinkedinmailby feather

You may be having the following type of error after you enable CDN on your WordPress:

Font from origin 'http://xxxxxxx.cloudfront.net' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.domain.com' is therefore not allowed access.

That's because you do not have the "Access-Control-Allow-Origin" header set by the web-server of the origin, which is Apache or Amazon S3.

You can verify this with the following command and you will not see the header:

curl -I -s -X GET -H "Origin: www.domain.com" http://xxxxxx.cloudfront.net/yyy.png

1- With S3: In order to set that header in S3, refer to the AWS Documentation.

2- Without S3: 

2-a: CloudFront:

– Edit Behaviors

– Change "Allowed HTTP Methods" to GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE

– Change "Forward Forward" headers to "Whitelist"

– Add "origin" to Whitelist headers

2-b: Apache

You need to You just need the following to be added under the Document section in your httpd.conf:

Header set Access-Control-Allow-Origin "*"

and gracefuly restart your http server:

apachectl -k graceful

Check if the header appeared with the "curl" command previously we used.

 

HTTP/1.0 200 OK

Content-Type: image/png

Content-Length: 299245

Date: Wed, 16 Dec 2015 22:28:00 GMT

Server: Apache

X-Frame-Options: SAMEORIGIN

Last-Modified: Wed, 09 Dec 2015 15:07:22 GMT

ETag: "490ed-52678727d1480"

Accept-Ranges: bytes

Access-Control-Allow-Origin: *

X-Cache: Miss from cloudfront

X-Amz-Cf-Id: e14A-xV0D-ajm0S7wLe696YombjT8zKCmbr0LL8NmqlMarArJo1jnw==

X-Cache: MISS from 213.155.126.5

X-Cache-Lookup: MISS from 213.155.126.5:3128

Via: 1.1 cxxxxxx4.cloudfront.net (CloudFront), 1.0 213.155.126.5 (squid/3.1.23)

Connection: keep-alive

Building Microservices

Facebooktwittergoogle_pluslinkedinmailby feather

I have recently finished reading Sam Newman's "Building Microservices" book, from which i learned so many topics that were questions in my mind towards building micro services.

Micro Services

Although there are so many lessons i learned, but the most remarkable ones are:

– Services are communicated between each other on service-level rather than via DB

– Although there is no restriction, but having seperate DB for each/set of services is ok

– Service orchestration and scaling

– Breaking monolith into pieces

 

 

 

git repository from scratch

Facebooktwittergoogle_pluslinkedinmailby feather

 

I just need to bring up a git repo from scratch and push to github on a computer where there was initially

– NO git repo

– NO ssh keys to connect to github

 

So here are the straightforward steps:

1. Initializing git repo on the directory where you want:

git init

2. Adding all the files to the git repository:

git add .

3. First commit:

git commit -m "First commit"

4. Adding a remote repository:

git remote add origin [email protected]/funkydorian/ansible.git

5. You can check the effect of the previous step by:

cat .git/config

6. Check if you have ssh keys in order to connect to github:

ls ~/.ssh/id_rsa

7. If yes, check if you can connect to github:

ssh -T [email protected]

7. If not, create the keys:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

8. Add your private key identities to the authentication agent:

ssh-add ~/.ssh/id_rsa.pub

9. Copy the key to your clipboard:

pbcopy < ~/..ssh/id_rsa.pub

10. Login to your github.com from your browser

Settings –> SSH Keys –> Add Key –> Paste the content of id_rsa.pub

11. Create the repository on github.com

12. Check again if you can connect to github:

ssh -T [email protected]

You must see the output like:

"You've successfully authenticated…."

13. Try to push to github:

git push -v origin master

 

n11.com DevOps Presentation

Facebooktwittergoogle_pluslinkedinmailby feather

 

The images are from today's n11.com DevOps presentation

 

n11 DevOps 20151026_173203

Docker –link

Facebooktwittergoogle_pluslinkedinmailby feather

I was trying to find a use-case of the "–link" functionality in Docker in terms of a "Service Discovery" perspective and i found the following repo:

https://github.com/benschw/docker-service-discovery-with-links

Seems some way through… I will be going deeper, any comments are appreciated….

 


visited 27 states (12%)
Create your own visited map of The World