2. AWS CloudFormation
• AWS CloudFormation dá aos desenvolvedores e
administradores de sistemas uma maneira fácil de
criar e gerenciar recursos da AWS, provisionando
e atualizando a infra-estrutura de uma maneira
ordenada e previsível.
3. AWS CloudFormation
Templates para descrever os recursos da
AWS e qualquer dependência relacionada
ou parâmetros requiridos para executar a
sua aplicação
4. AWS CloudFormation
Você não precisa descobrir a ordem em
qual os serviços precisam ser
provisionados ou como fazer essas
dependências funcionarem.
5. AWS CloudFormation
Uma vez executado, você pode modificar
e atualizar os recursos de uma maneira
controlada e previsível, permitido você
versionar a sua infraestrutura do mesmo
jeito que você faz com o seu código
7. AWS CloudFormation
• Templates que descrevem os recursos da AWS
• Modifique e atualize os seus recursos AWS de uma
maneira controlada e previsível.
• Tenha controle de versão da sua infraestrutura na
AWS
13. {
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template EC2InstanceSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example uses the default security group, so to
SSH to the new instance using the KeyPair you enter, you will need to have port 22 open in your default security group. **WARNING** This template an Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type" : "String"
}
},
"Mappings" : {
"RegionMap" : {
"us-east-1"
: { "AMI" : "ami-7f418316" },
"us-west-1"
: { "AMI" : "ami-951945d0" },
"us-west-2"
: { "AMI" : "ami-16fd7026" },
"eu-west-1"
: { "AMI" : "ami-24506250" },
"sa-east-1"
: { "AMI" : "ami-3e3be423" },
"ap-southeast-1" : { "AMI" : "ami-74dda626" },
"ap-northeast-1" : { "AMI" : "ami-dcfa4edd" }
}
},
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"UserData" : { "Fn::Base64" : "80" }
}
}
},
"Outputs" : {
"InstanceId" : {
"Description" : "InstanceId of the newly created EC2 instance",
"Value" : { "Ref" : "Ec2Instance" }
},
"AZ" : {
"Description" : "Availability Zone of the newly created EC2 instance",
"Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] }
},
…
14. "AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template EC2InstanceSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example uses the default security group, so to
SSH to the new instance using the KeyPair you enter, you will need to have port 22 open in your default security group. **WARNING** This template an Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type" : "String"
}
},
"Mappings" : {
"RegionMap" : {
"us-east-1"
: { "AMI" : "ami-7f418316" },
"us-west-1"
: { "AMI" : "ami-951945d0" },
"us-west-2"
: { "AMI" : "ami-16fd7026" },
"eu-west-1"
: { "AMI" : "ami-24506250" },
"sa-east-1"
: { "AMI" : "ami-3e3be423" },
"ap-southeast-1" : { "AMI" : "ami-74dda626" },
"ap-northeast-1" : { "AMI" : "ami-dcfa4edd" }
}
},
Parâmetros
Mapeamentos
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"UserData" : { "Fn::Base64" : "80" }
}
}
},
"Outputs" : {
"InstanceId" : {
"Description" : "InstanceId of the newly created EC2 instance",
"Value" : { "Ref" : "Ec2Instance" }
},
"AZ" : {
"Description" : "Availability Zone of the newly created EC2 instance",
"Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] }
},
…..
Recursos
Saídas
Cabeçalho
31. AWS CloudFormation
Recursos: Quase todos os serviços AWS
– O que está faltando (até agora)?
• Amazon Elastic MapReduce (EMR)
•
•
•
•
•
Amazon Simple Workflow Service (SWF)
Amazon Simple Email Service (SES)
Amazon Glacier
Amazon CloudSearch
Pequenas novidades de outros serviços ainda não
implementadas
50. AWS CloudFormation
Versionamento!
• Você rastreia as atualizações no seu código
• Mesma coisa com a infraestrutura:
–
–
–
–
O que está sendo mudado?
Quem fez a atualização?
Quando foi feita?
Porquê?(atrelada a um ticket/bug/sistema de projetos?)
51. AWS CloudFormation
Testando:
–
Validação via API/linha de comando
$ aws --region=us-east-1 cloudformation validate-template --template-body file://$PWD/Lab1-nat_stack.template
{
"ResponseMetadata": {
"RequestId": "174228cc-2c59-11e3-a4b8-8d0a0ca6c09c"
},
"Description": "Builds a NAT host. **WARNING** This template creates Amazon EC2 instance(s). You will be billed for the
AWS resources used if you create a stack from this template.",
"Parameters": [
{
"NoEcho": false,
"Description": "SubnetId of an existing Public facing subnet in your Virtual Private Cloud (VPC)",
"ParameterKey": "SubnetId"
},
……..
],
"Capabilities": []
52. AWS CloudFormation
Publicação e atualização via console ou API/linha
de comando:
– Alguns cliques
OU
– aws cloudformation create-stack --stack-name myteststack
--template-body
file:////home//local//test//sampletemplate.json --parameters
ParameterKey=string,ParameterValue=string
----- Meeting Notes (11/19/12 10:02) -----give more personal story around this.
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow.[1] Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than describing how to go about accomplishing it[2] (the how is left up to the language's implementation). This is in contrast with imperative programming, which in algorithms are implemented in terms of explicit steps.Declarative programming often considers programs as theories of a formal logic, and computations as deductions in that logic space. Declarative programming has become of particular interest recently, as it may greatly simplify writing parallel programs.[3]Common declarative languages include those of database query languages (e.g., SQL, XQuery), regular expressions, logic programming, and functional programming.http://en.wikipedia.org/wiki/Declarative_programming
----- Meeting Notes (11/5/12 19:58) -----iceberg #1 next
----- Meeting Notes (10/9/12 17:50) -----End of Metadata, next up RDS
----- Meeting Notes (10/9/12 17:50) -----Speaking of VPC
----- Meeting Notes (10/9/12 17:52) -----You now have a fully functioning virtual private cloud that can receive instances/other services, and be internet facing if need be.