Reddit DevOps
274 subscribers
66 photos
32.1K links
Reddit DevOps. #devops
Thanks @reddit2telegram and @r_channels
Download Telegram
AWS routing

Hi,

Suppose I have frontside(angular) in s3 and it is accessed by my domain [www.mydomain.com](https://www.domain.com).

For the backend I use Lambda.

Suppose I want to access the API using a path - [www.mydomain.com/api](https://www.domain.com/api) and not via a subdomain - [api.mydomain.com](https://api.domain.com).

Is the only way to handle routing on the same domain is by using CloudFront (Behaviors) or is there another way?

https://redd.it/fhd2ay
@r_devops
Comparing clouds: Billing for stopped machines

#Intro


Public clouds have grown considerably in size, complexity and sheer number of features. This makes it hard to answer even simple questions, especially when you are trying to compare clouds.

 

One of the questions we hear very often is some variation of the following:

 

**Does my cloud bill me for stopped machines, aka instances, linodes, droplets etc?**

 

The reasoning behind this question is quite simple. If I stop a machine, it means I’m not using it so I assume my cloud will not bill me for it. After all, public clouds are all about elasticity. If this is the case, then I could save a lot of money by stopping machines when they are not needed.

 

Unfortunately, things are not very straightforward.

 

#Comparison
Let’s go over a summary of what is happening with each cloud, in alphabetical order.

 

| Service | Bills for stopped machines? |
|------------------------|----------------------------:|
| Alibaba ECS | Yes (by default) |
| Amazon EC2 | No |
| Digital Ocean | Yes |
| Google Compute Engine | No |
| IBM Cloud | No |
| Linode | Yes |
| Microsoft Azure | Maybe |
| Vultr | Yes |

 

This is a very high level picture. For more details keep on reading or go [here](https://blog.mist.io/post/611039713030193152/billing-for-stopped-machines) for a more condensed view.

 

**Alibaba ECS**


ECS instances are billed per second. You could avoid billing for stopped instances connected to a VPC and which don’t have local disks. User action is required for that. If you turn this feature on and stop an instance, you will be billed for any of the following that apply:


* attached block storage
* associated elastic IPs
* bandwidth
* images


For more details, check the official documentation for PAYG pricing [here](https://www.alibabacloud.com/help/doc-detail/40653.htm) and specifically for stopped instances [here](https://www.alibabacloud.com/help/doc-detail/63353.htm?spm=a2c63.p38356.b99.17.418a7470ZwN0bN).

 

**Amazon EC2**


Linux instances are billed per second with 60 seconds minimum. All others are billed per hour. When you stop an instance, you will be billed for any of the following that apply:


* attached block storage
* associated elastic IPs


For more details, check the official documentation [here](https://aws.amazon.com/ec2/pricing/on-demand/) and “Billing and purchase options” in this [FAQ](https://aws.amazon.com/ec2/faqs/).

 

**Digital Ocean**


Droplets are billed per hour even if they are stopped. Check the relevant answers in their pricing [FAQ](https://www.digitalocean.com/pricing/#FAQs).

 

**Google Compute Engine**


Instances are billed per second with 60 seconds minimum. Some premium images follow a different model. When you stop an instance, you will be billed for any of the following that apply:


* persistent storage attached
* local SSDs
* associated static IPs


For more details, check the official documentation [here](https://cloud.google.com/compute/all-pricing).

 

**IBM Cloud**


Public Virtual Servers and billed per hour. IBM offers “Suspended Billing”. Servers after Nov 1st 2018 include suspended billing. Most servers created before this date don’t offer it. If suspended billing is available and you stop a server, then you will be charged for any of the following that apply:


* storage
* secondary public IP address


For more details, check the official documentation [here](https://cloud.ibm.com/docs/vsi?topic=virtual-servers-requirements).

 

**Linode**


Linodes are billed per hour even if they are stopped. Check the relevant answers in their pricing [FAQ](https://www.linode.com/pricing/#row--faqs).

 

**Microsoft Azure**


Virtual Machines are billed per
second and for the full number of minutes the machine was running. The documentation specifically mentions that if a machine was running for 6min and 45sec you will be charged for 6min.


If the machine status is “Stopped Deallocated”, you are not billed. If it is “Stopped” or “Stopped Allocated”, you are billed for allocated virtual cores but not for software licenses. Full details on virtual machine states are available [here](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/states-lifecycle).


In order to get to "Stopped Deallocated" state, you have to stop the machine from within Azure's management portal or over the API using a specific deallocation parameter. If you stop the machine from within the OS it will go into “Stop Allocated” state.


If you manage to get to "Stopped Deallocated" state, please keep in mind that you are still billed for any of the following that apply:


* attached Premium (SSD based) disks
* Attached Standard (HDD based) disks
* In ARM deployment model, you are billed for static public IP address unless it is part of the first five in the region. Read more regarding IPs under the FAQ section at the bottom of this [page](https://azure.microsoft.com/en-us/pricing/details/ip-addresses/).

For even more details, check the FAQ at the bottom of this [page](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/). The URL ends with /linux but you will also find the same FAQ under /windows…

 

**Vultr**


Vultr cloud instances are billed per hour even if they are stopped. Check the relevant answers in their pricing [FAQ](https://www.vultr.com/resources/faq/).

 

#Other parameters


The comparison includes only services that offer cloud machines. There are also a number of services that offer dedicated hosts and/or bare metals. We didn’t include such services above because they are inherently different and, as expected, they charge you regardless of machine state.

 

Also, please keep in mind that the comparison refers to pay-as-you-go (PAYG) pricing. Alibaba, Amazon, Google, IBM and Microsoft offer reserved and spot pricing as well. In the case of reserved pricing, you will be billed even if you don’t use your reserved capacity. In spot, stopping a machine will usually release it and return it to the pool. Billing stops at that point, but you can no longer use the machine. This happens in Amazon, Google and Azure. In Alibaba and IBM, stopping a spot will not release it, but you will continue to incur charges until they either claim it back or you release it yourself.

 

If things were not complicated enough, you also need to take special usage discounts into account. Such discounts are:


* Alibaba subscriptions
* Amazon saving plans
* Google committed-use and sustained-use discount

 

In the case of [Alibaba subscriptions](https://www.alibabacloud.com/help/doc-detail/56220.htm?spm=a2c63.p38356.b99.15.25cc166bYXiesi), things are rather simple. When you buy a subscription you pay a discounted price upfront for the entire billing cycle. Changing the status of the machine won't save you anything.

 

With [Amazon saving plans](https://aws.amazon.com/savingsplans/), things are simple too. You commit to certain usage over 1yr or 3yr term and get a discount. If you use it, you’re good. If you don’t use it, you still pay for it.

 

[Google’s committed-use discounts](https://cloud.google.com/compute/docs/instances/signing-up-committed-use-discounts) are very similar to Amazon saving plans.

 

[Google’s sustained-use discounts](https://cloud.google.com/compute/docs/sustained-use-discounts) are more complicated. First of all, Google follows an approach which they call [resource-based pricing](https://cloud.google.com/compute/resource-based-pricing). In this model, the base price of a machine is tied to the underlying resources it is using (vCPUs and memory). If during your billing cycle you continue to run the same total amount of resources, then you gradually earn a discount that’s increasing over time. This is the
sustained-use discount. The discount is irrelevant to the actual machines you run, it ties only into the total amount of resources used. This discount doesn’t increase linearly over time. To understand it better we strongly recommend reading the documentation pages linked above.

 

#Conclusion


Having said all of the above, let’s restate the initial question:

 

**Will I save money if I stop my cloud machines when they are not in use?**

 

The answer depends on a number of factors. To get to the bottom of this you need to:


1. Check if your service will charge you for stopped machines and how.
2. Check your reservations and long term commitments.
3. Don’t take spot into account.
4. If you are using Google Compute Engine, do the math for the sustained-use discount.

 

All these might sound disheartening, but you could potentially save a lot of money. Just to get a sense of ROI, one of our customers was recently able to reduce a 5-digit monthly bill for dev infrastructure by 50%. They did it by automatically tagging machines upon provisioning and then setting a schedule to stop them during off business hours.

 

Bottomline, the effort is well justified. Do your research and good luck!

 

We'd love to hear your feedback on other comparisons that will be useful.

https://redd.it/fhczhu
@r_devops
Cache Artifacts

I have an Nginx caching server that successfully caches anything we put on the origin. There is also a separate Artifactory repository that I'd like to start caching from (use the Artifactory instance as a separate origin). I'm looking for a way to get the Nginx caching server to cache any artifact, not just an rpm repo. Has anyone done this before or have any advice?

I have a *location {}* block and can successfully use the Nginx caching server to GET items but doesn't cache -- Is this because the artifact needs to be changed somehow to to allow caching?

https://redd.it/fi2onc
@r_devops
Terraform workflow/templates management, propagating changes advise

Hi there - I am working in a small DevOps team and trying to improve our Terraform workflow. We have a few environments, and I am trying to have the developers in the company use Terraform templates we are maintaining. How do you deal with that? Do you have ways to propagate changes to templates?

Also: tests. Do you guys run tests all the time? Do you have a way to automate that once the template is in use by team members?

Wondering about best practices, tooling and what can go wrong once we become a bit bigger

https://redd.it/fi1hkc
@r_devops
[Beginner] Simple devops process with Docker / Compose & one server ? I'm lost :-)

Hi there

Being freelancer, I develop applications (small projects) for my clients. Until now, I used to have a dev environment (eg my workstation :-)) and a preprod environment (a dedicated server) where the client can "test" the application on a permanent basis. My deployment process to the preprod consisted in pushing/tagging the code to my git repo, and then pulling it from the preprod environment, for each release of a new feature. So far, so good.

Recently I took the time to learn Docker and Docker Compose. I started to develop with Docker containers installed on my workstation. I like it, because i feel that my computer is not polluted anymore with many versions of various development stacks. I used a lot volumes, rather than bind mounts because I feel this is simpler to organize, and more "encapsulated".

But now I wonder what is the best way to manage the preprod and prod stuff. I had a look on Swarm, I don't know if it is my best bet as I don't need the cluster stuff in itself, I just need to update the preprod application from my dev environment (eg my workstation), very quickly and very often, but still following the good practices.

What would be the minimum devops stack and process to do that?

Many thanks for any advise

https://redd.it/fhyxjh
@r_devops
Google's COVID-19 Screening Website Sources?

I heard Google is working on a website for COVID-19 screening. Anyone familiar with the progress? Is it open-source? Any chance community can participate to make it live sooner?

https://redd.it/fi9imu
@r_devops
Best VPS provider to host a highly available websocket cluster (15TB monthly bandwidth)

As per the title, I'm looking for the best provider for this use-case.

\- AWS EC2 isn't an option as the bandwidth will cost $1500 per month.

\- AWS lightsail comes bundled with the bandwidth but the instances aren't designed for heavy usage + it's unclear if the lightsail loadbalancer can handle secure websocket connections + VPC communication to other AWS services like redis/elasticache is limited

\- Digital Ocean has cheap bandwidth ($100 for 10TB) and is reliable. But it's been confirmed their load balancer doesn't support websocket connections.

\- Hetzner has cheap bandwidth too but again no loadbalancer.

Could I use the cloudflare load balancer in conjunction with Digital Ocean?

Should I just put a single beefy HAproxy or nginx instance in front of my websocket cluster and pray for the best on digital ocean?

Any help appreciated!

https://redd.it/fhykse
@r_devops
April Fool's Pranks

Hey guys,

April Fool's Day is coming soon and as the DevOps guy in my department, I'm trying to find some good pranks to pull off, but I can't think of anything other than changing the profile pictures on our private git to some embarrassing picture of them.

If you have any ideas for harmless pranks that won't get me in trouble I would love to hear them!

https://redd.it/fhxxbg
@r_devops
Biggraphite

How much load(metrics/sec) biggraphite can handle.

Any suggestion how to test biggraphite with stresser?

https://redd.it/fhvsl3
@r_devops
Is being an extrovert required to excel in devops?

As the title states, do you think being an extrovert is required or at the least a big advantage in a "DevOps" position. At work I've been getting more involved (reluctantly) to present more about feature work we are doing that provides the company benefits, code demos, lunch & learns, etc. I'm fine with giving the occasional demo especially when it's about a feature I worked on. Ideally though I'm someone who just wants to provide quality heads down work in addition to quality documentation where applicable and then moves on to the next task. This does not mean I don't like to work collaboratively with others but I don't particularly enjoy presentations showcasing my work all the time.

Maybe "DevOps" is not for someone with my mindset?

https://redd.it/fh4ur7
@r_devops
Handling K8 deploymentswithout full CI/CD

I have two Kubernetes clusters - dev and prod - currently they have everything manually deployed to them as I am without full CI/CD thanks to being unable to connect Spinnaker to ECR but that's a whole different issue.

​

Right now when a service is done local development it's pushed to github which then triggers a Jenkins job which creates a container and pushes it to ECR. After it's in ECR I deploy it to Dev and run tests than if all good go to prod. This works meh in theory, in practice is terrible, not always am I deploying the latest container to the dev cluster nor do I have a way of knowing what was last deployed so I can deploy that exact one to prod.

​

I know a CI/CD pipeline would solve my issues, I can't get that working yet so I need a different plan that is more manual but is less shitty than my current - never know the current state of the cluster

https://redd.it/fh79b2
@r_devops
Monitoring the Incoming requests and responses Traefik with Grafana

Learn how to deploy Prometheus and Grafana to Docker swarm clusters to Monitor Traefik reverse proxy and how to build a Grafana dashboard to monitor Traefik service and the hosted services.

[https://medium.com/@wshihadeh/monitoring-traefik-with-grafana-1d037af5b952](https://medium.com/@wshihadeh/monitoring-traefik-with-grafana-1d037af5b952)

https://redd.it/fi6pts
@r_devops
Trying to add a Docker with maven installed as an agent/slave without any connection to the Docker Host

I've a master Jenkins running inside a Docker.

I want to connect it to a slave Docker with Maven & git installed in it. Will pull the code inside that agent and build and host the web application in that agent and it should be running all the time so that my app is always up.

However, I don't want to connect to the host of that slave Docker and spin up a slave using the Docker API but instead connect to the slave directly.

Is this possible?

https://redd.it/fh6g9w
@r_devops
What tools do you use for remote teams?

Currently our team is 100% remote. What tools do you use to assist with this? Mainly I want to be able to still have firewalls locked down, and internal tools locked down to only people inside the organization. I have setup own OpenVPN server and set up all employees with a configuration file which we then use tunnelblick / etc to connect with. I can then lock server firewalls down to the VPN public IP. However there seems like there should be a better way to do this. Any tools or recommendations on remote teams would be appreciated thanks!

https://redd.it/fh4vdm
@r_devops
What is your strategy to configure resources not exposed publicly with Terraform?

Hi,

We are using Terraform to setup infrastructure on AWS, and we would also like to use Terraform to configure things which are running inside our VPC, in private-only subnets, without exposing them publicly.

For example, we would like to use Terraform to setup our MySQL and PostgreSQL databases (running on AWS RDS), manage our Consul cluster ACLs, and configure whatever service is running within our VPC.
Basically, if a service has a Terraform provider, we would like to use Terraform to setup that service.

The AWS API is exposed publicly, so there's not so many constraints to configure its resources using Terraform.

However, although we could decide to expose publicly the other resources we want to configure which are running in our private networks (so we can access them easily via Terraform), we don't really feel good about that :) That increases the attack surface a bit too much to our liking.

The private services we would like to access provide either HTTP APIs or TCP endpoints (with or without TLS), and we already have a couple of ideas on how to do that, but I'd be interested to know what others are doing. (We already ruled out Terraform Cloud because we didn't have a to access these services without exposing them completely outside :/ )

For the moment, we have an initial setup where we manually start a couple of SSH tunnels, export new environment variables to reconfigure Terraform to contact internal services through the tunnels, then shutdown the tunnels once Terraform has run. It's a bit manual (we can script that), really ad-hoc and is not well integrated with Terraform itself.

What other methods are you using?

https://redd.it/figa0a
@r_devops
Help with sending local files on MacOS with Filebeat to ELK stack on AWS instance.

Hello devops,

I’m trying to learn ELK and ingesting logs with no problems within my AWS-ELK stack or even from another Ubuntu machine, however, I’m having troubles sending logs from my local MacOS to my ELK stack on AWS.

My filebeat config on the Mac (local):
https://pastebin.com/FCEyDvxW

If you guys need to see other configs on the ELK stack, please let me know. Any help is greatly appreciated.

https://redd.it/fh333s
@r_devops
Keycloak token service not working

Reposting it here

[https://www.reddit.com/r/selfhosted/comments/fh2wpi/keycloak\_token\_service\_not\_working/?utm\_source=share&utm\_medium=web2x](https://www.reddit.com/r/selfhosted/comments/fh2wpi/keycloak_token_service_not_working/?utm_source=share&utm_medium=web2x)

​

Do anyone have experience with keycloak? I am basically stuck.

https://redd.it/fh2y9c
@r_devops