I 'm using many services in Alibaba Cloud like Container Service, VPC, RDS, DNS, OSS and many more.
Instead of importing 1 by 1 of Alibaba Cloud Product Services that used that would take a long time for that.
Is there any elegant and fast way to importing all of the cloud infrastructure to a statefile ?
Yes, you can make a resource list and then run terraform but make sure you can have
Related
Please help me understand why we say azure functions is a serverless compute service. It does require cloud to host it and run. Cloud is also a server still why we are saying it is serverless?
Serverless computing does not mean that servers are out of the picture. Servers are very much required, just like they have been for all these years, or else, where will your code run. The reason why the phrase was coined is that as a developer, you do not need to worry about what server your code runs on. In fact, you do not know which server it eventually runs on. Once your code is deployed, Azure assigns the responsibility of executing the code to the next available server. What Azure ensures, and what is ultimately important for you, is that your code will execute whenever required.
Ref: Serverless Computing with Azure Functions
Hope it makes sense :)
To get a better idea this is how we evolved. Cloud providers are making sure we should only worry about the business logic but nothing else.
IaaS (Infrastructure as a service)
You get a running VM somewhere in the data centre but you are required to maintain everything. From Deployment to patching your VMs or anything running on the VM.
PaaS(Platform as a service)
You are not longer required to maintain platForm but you are still responsible to manage your server in terms of load balancing etc.
FaaS(Function as a service)
Servers are abstracted from you . You are only required to maintain your code without worrying about what's under the hood or how to load balance your servers. It's then cloud provider responsibility to package your code and run it for you. But servers are still there.
Going by the official documentation of Azure Serverless computing service, Azure Functions can be defined as;
Azure Functions is a serverless compute service that enables you to run code on-demand without having to explicitly provision or manage infrastructure. Use Azure Functions to run a script or piece of code in response to a variety of events.
Azure Functions is an event driven, compute-on-demand experience that
extends the existing Azure application platform with capabilities to
implement code triggered by events occurring in virtually any Azure or
3rd party service as well as on-premises systems. Azure Functions
allows developers to take action by connecting to data sources or
messaging solutions, thus making it easy to process and react to
events. Azure Functions scale based on demand and you pay only for the
resources you consume.
Here the serverless compute service is like a metaphor which implies, the end user doesn't need to manage the servers or infrastructure to run the applications over the Azure and can spend time to focus on managing and improving the business logic.
Few more points to consider,
Serverless in Azure builds on an open-source foundation, the core of
which is Azure Functions, an event-driven compute experience and open
source project. Community contributions include support for new
languages, integrations and deployment targets.
Azure Functions can be used on-premises, in hybrid environments such as Azure Stack, on IoT Edge devices and deployed on top of orchestrators such as Kubernetes – as well as in other clouds.
They enable faster time to market with lower infrastructure and operating costs.
There are heaps of definition of serverless which you can easily google. But I will share my understanding anyways.
1. It does require cloud to host it and run.
You are correct with this. But anything on Cloud requires Cloud, doesn't it? Azure being one of the cloud providers consists of hundreds of services to cater to different needs people are after from using Cloud.
2. Cloud is also a server still why we are saying is serverless
This is not quite right. Cloud is different from a server. Server is a physical box sitting somewhere. With hundreds of thousands of servers all over the world, Cloud hosts all sorts of different services on these servers.
The reason we say Functions are serverless is that the infrastructure of hosting a Function is abstracted away from devs. It is still deployed to some servers but Azure is responsible for all the resource managing, configuration, load balancing, scaling and networking etc. It allows developers to focus primarily on their code, not having to worry about servers.
Assuming a cloud infrastructure across multiple cloud provider accounts (AWS, Azure and GC) built with Terraform. Is there any way to reboot instances using Terraform? If not, how do people easily and centrally reboot their instances created with Terraform?
Thanks!
Terraform does not provide capacity to reboot your instances. At best, you could taint a resource, that means that terraform will destroy and recreate (which is obviously not the same the rebooting). Terraform is not the right tool to manage the lifecycle of your instance.
Usually, the best practice is to get your instance automatically rebooted, using cloudwatch on AWS. You need to configure it to detect unhealthy instances. I guess other cloud providers have a similar feature.
If you need to do it manually, next step would be to use the cloud API (such as aws cli) to perform this action. I am not aware of a tool that let you do that across cloud providers centrally.
I would like to know what is the difference between Terraform and Serverless. Arent they doing the same thing like managing your infrastructure, and representing your infrastructure as code?
Do you really need a serverless framework (serverless.com)?
Thanks
My understanding for serverless framework and other similar serverless-focus tools:
Both Serverless Framework and Terraform support different cloud providers. Use AWS as sample in next statements.
Compare Serverless framework to Terraform, serverless framework is serverless specialist, Terraform is GP
terraform is fully Infrastructure as Code which covered most resources.
Serverless framework is a middle layer only to generate Cloudformation template which mostly for serverless related resources, in aws, focus on lambda, api gateway, dynamodb, etc.
You can write all in Cloudformation template directly, but the template file will be huge, it is hard to maintain by its JSON/Yaml template as well. With a few dozen lines in serverless.yml, serverless framework can generate a thousand or several thousand lines of cloudformation template. It saves a lot of time to deal with the cloudformation coding. By the way, if you already knew cloudformation syntax, you can easily put the same cloudformation yaml codes directly in the resources part, serverless template knows how to create them.
You can write Terraform codes to manage lambda, api gateway, Dynamodb as well. Maybe you can get less codes than Cloudformation template, but still too complicated.
In another way, it doesn't make sense to let serverless framework deal with all AWS resources, that other tools do most well already, such as EC2, VPC, ECS, etc.
Serverless framework is still in developing, because of its popularity, many developers are involved to add features into it daily. Maybe one day you can get what you need, but now you have to mix serverless framework with Cloudformation or Terraform or other tools together in some case.
The most obvious difference is that serveless architecture focuses on function-as-a-service and terraform is designed to manage infrastracture including your EC2 and ECS instances.Serveless.com might be more suited for AWS Lambda deployments (and it's equivalents in other clouds) but it can't manage your virtual machines, load balancers and all the other.
I find that Serverless just handles the configuration of Lambda and API Gateway better. The deployment is less of a hassle as well.
In fact, I have a few projects where Serverless handles Lambda functions + endopints, and any other resource is handled by Terraform.
You could even use Terraform to deploy Serverless projects using local-exec commands.
2021 update: the Serverless team explained the difference themselves in this blog post.
The gist of it is that the two can be used together:
Serverless is more suitable to manage application specific infrastructure that gets torn down and re-created at every deploy
Terraform is more suitable to handle shared, more stateful infrastructure
From the blog post:
For example
If you have a shared database and two Serverless applications that create tables in it, the database should be managed by Terraform. The specific tables should be created and destroyed by the Serverless Framework during the app deployment and teardown process.
I need to implement scheduled tasks, so that every X time the job will start running and will start an .exe file.
I did this those tasks in Azure very easily, but can't find something appropriate in Amazon Web Services.
Can you tell me if there is something similar in AWS for Azure WebJobs?
The most similar piece of AWS services that fits your needs is AWS Lambda. But as your comment states you do not want to code.
When comparing AWS to other cloud services it pops out that AWS focus on a very primitive services that can be connect and build complex systems. This is an advantage as one can tailor the cloud to its needs. However it can be more complex to setup when compared to a PaaS.
Is there any technology like CloudFormation for aws that would work on any IaaS based cloud to do the same thing? I mean you write it once and then it runs on any IaaS based cloud platform like azure, aws, openstack, and so on?
I think what you are looking for is exactly OpenStack Heat Project http://wiki.openstack.org/Heat The project is under active development.
Your question is making some assumptions that isn't quite correct - there's a lot of different types of clouds - Google AppEngine, OpenShift, Heroku and Azure (for example) work at a very different layer than the cloud services you get from Amazon AWS, CloudStack, OpenStack, etc.
The first is more of an platform as a service (PaaS) play, the later are more infrastructure as a service (IaaS). That said, and given that you're asking about Amazon's CloudFormation, it's worth mentioning that there's an equivalent of that technology for OpenStack clouds called HEAT (although I'm not aware of one that works with CloudStack).
To answer you're higher level of question of "is there a way to write it once and run it on any cloud?", today the answer is a qualified "no". There's lots of APIs and helper libraries you can use to bring several cloud provider options more into compatibility, and some companies are making all their pennies of exactly this game (enStratus, for example). But none of them go so far as to allow you to "run it anywhere" - especially when you lump IaaS style clouds in with PaaS style clouds.
What you are describing is a Platform-as-a-Service (PaaS) that works on multiple clouds. There is a similar question here: Cloud Mangement for Amazon IaaS
The answers also link to a comparison of PaaS options.
Check out enstratus. It's a UI for interfacing with multiple Cloud APIs. So you can store and shift images between different clouds then spin them up and down. Might be what you want.