when to use AWS Copilot or AWS SAM - amazon-web-services

In my organisation there are deployments using both SAM and Copilot. I am unable to work out what is the criteria or best use cases to use one or the other, and can't find any direct comparisons online?
So my question is are they comparable, if so when is it best to use each, and if not, why?

Copilot deploys to AWS ECS. SAM deploys to AWS Lambda. So if you want to use ECS, then Copilot is an option. If you want to use Lambda then SAM is an option.
So my question is are they comparable, if so when is it best to use each, and if not, why?
They aren't really comparable. They deploy to different AWS compute services with different runtime architectures.

Related

How to decide which ECS tool to use?

I am at a bit of a crossroads here. My goal is to automate creating my ECS architecture and deploying my docker-compose services to ECS Fargate, but there are so many ways to do it!
Hoping to get some insight from the community on picking the right tool for the job. What are the use cases for each of these? When should I pick one over the other?
Docker ECS integration
https://docs.docker.com/cloud/ecs-integration/
ecs-cli
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI.html
AWS Copilot
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Copilot.html
AWS CLI ecs
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/index.html
This is how I am breaking it down:
Docker Compose / ECS integration: use this if you are deep into Docker already are in love with the compose syntax. If you are not already in love with it you should because it's a very simple syntax
ECS CLI: this is the previous version of the Copilot CLI. ECS CLI had native ECS components/workflows to it + some level of docker compose compatibility. We have since improved the workflows in Copilot and forked compose support into the Docker Compose / ECS integration above. TL/DR: don't use ECS CLI
Copilot CLI: this is a very easy way to start with containers on AWS ECS. If you don't know much about Docker and you don't need to become an expert in containers Copilot is the right approach. Only drawback (IMO) is that it doesn't really support a proper IaC pattern yet (example).
AWS CLI (ecs namespace): this is just the CLI manifestation of the 1:1 mapping of the core ECS APIs. This is most likely way too low level for you to extract value (unless you are doing very deep things). For example one Copilot command or a few Docker Compose lines could easily be exploded in dozens of AWS CLI commands.
I'd add CDK to your list: CDK is a representation of AWS constructs (including ECS) that could be represented with standard programming languages. The good thing about CDK is that it could map 1:1 raw API/Cloudformation constructs but it also ships with higher level and more abstracted libraries that allows you to express in a few lines of code content that would require hundreds of lines of CFN.
If you are deep into compose (as it seems from your original message) you may want to have a look at this approach.

What is the best way to set up a CI/CD pipeline on ECS?

There are so many options:
Docker-compose with ECS cli looks the easiest solution
Terraform
CloudFormation (looks complex!)
Ansible
I am only interested in setting up a basic ECS docker set-up with ELB and easily updating the Docker image version.
We all love technology here, but we're not all super geniuses when it comes to tech. So I'm looking to keep my set-up as simple as possible. We run Jenkins, 2 NodeJS applications, 2 Java applications in ECS and I know it involves IAM, Security Groups, EBS, ELB, ECS Service/Task, ECS Task Definition, but that already gets complex quickly in CloudFormation.
What are good technologies that will allow us to use Docker, keep things simple and don't require us to be very intelligent to understand our own programming code?
I would suggest you start by trying to setup your pipeline using Terraform. Learning it will give you experience in a non-vendor specific infrastructure as code.
Another possibility is to avoid using CloudFormation directly and prefer using the AWS CDK (https://docs.aws.amazon.com/cdk/latest/guide/home.html) as IaC.
Best regards

AWS Serverless vs versioning?

I am wondering about how does entire AWS Serverless feature set work with VCS tools?
I mean, assume I'd like to build a complex HA, scalable system basing as much on serverless tech stack as possible. I would create some VPC, subnents, S3 buckets, Elasticache, Aurora, SNS, SQS, etc... and of course a bunch of Lambdas triggering one another. Naturally that would be efficient (both in terms of performance and cost), I know I could enable CloudWatch, CloudTrail and use AWS X-Ray for debugging.
But what about storing my application in GIT? Should I implement entire setup of my app using AWS CLI or is there a better/easier way?
Yes, you can store your application in GIT with all it's ressources if you use Infrastructure as Code.
Take a look at tools like CloudFormation and Terraform

AWS CLI vs Console and CloudFormation stacks

Is there any known downside to creating resources on aws through the CLI? Is it more reliable/easier/error prone/largely accepted/recommended to use one method over the other? While setting up recurring scripts, is there a reason why i would want to use CloudFormation or the AWS Console over the AWS CLI to run commands directly?
For example, if I were to create an ECS Fargate Task Definition, is there any reason why I might want to use AWS CloudFormation or the Console over AWS CLI? Cli syntax is straightforward and easy to use, and there are a few things (like setting up event rules/targets for a fargate task specifically) that are not supported via cloudformation yet.
The AWS CLI and AWS CloudFormation are two different tools that can be used to create infrastructure on AWS. The CLI is more powerful and has finer grained control than CloudFormation. CloudFormation makes it very easy to use yaml or json text files that can describe an entire enterprise in the cloud.
One of the strong benefits of CloudFormation is the automatic support for rolling back changes if anything fails while deploying a stack. The CLI in comparison would require you to figure out the details of what went wrong and how to get back to where your state was. Updating infrastructure using CloudFormation is another benefit. Make the change in the template and update the stack.
For small setups, using the CLI is fine. However, once you get past launching an EC2 instance and start building VPCs, Instances, KeyPairs, Security Groups, RDS, etc. etc. you will find that the CLI has some real limitations: mostly being too manual of a process, not easily repeatable, difficult to put the process into version control, ....
If you are constantly building, testing and deleting complex setups, CloudFormation is absolutely one of the best tools from AWS. Note that there are a number of third party solutions that have a huge number of followers such as Bamboo, Octopus, Jenkins, Chef, etc.
If your job is SysOps or DevOps then you absolutely want to master the CLI and CloudFormation. These are amazing tools for working with AWS. Also master Beanstalk, maybe OpsWorks and one of the third party tools like Jenkins.

CloudFormation Template for ElasticTranscoder

As part of infra automation we are using cloudformation for automating the AWS infrastructure. We are utilising the service ElaticTranscoder as well, as i understand cloudformation yet does not provide support for ElasticTranscoder, is there any efficient way to automate ElasticTranscoder using cloudformation.
Custom resources provide a way for you to write custom provisioning logic in AWS CloudFormation template and have AWS CloudFormation run it during a stack operation, such as when you create, update or delete a stack.
Check out this example.
Also, a quick google search gives me this result.
Another option is not using CloudFormation. You can use Terraform which does support Elastic Transcoder.
https://www.terraform.io/docs/providers/aws/r/elastic_transcoder_pipeline.html
Ansible also has third-party support for it.
https://github.com/wimnat/ansible-modules/blob/master/elastictranscoder/elastictranscoder.py
Last but not least, you can vote for this feature in AWS wish list by liking or retweeting the request.
https://twitter.com/search?q=%23awswishlist%20transcoder&src=typd
https://awswishlist.com/