90
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Webinar https://amzn.to/JPWebinar https://amzn.to/JPArchive

AWS Webinar ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS Webinar

https://amzn.to/JPWebinar https://amzn.to/JPArchive

Page 2: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

2

Page 3: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

3

Page 4: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

4

Page 5: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

5

Page 6: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

6

Page 7: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

7

Page 8: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

8

StackTemplate

作成/変更/削除

作成するリソースの定義 リソースの集合

VPCリソースの作成/変更/削除

Page 9: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

9

Page 11: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

11

Page 12: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

12

Page 13: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

13

Page 14: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

14

Page 15: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

15

Stack

Template

Page 16: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

16

AWSTemplateFormatVersion: 2010-09-09

Description: Sample

Parameters:

KeyName:

Description: "Sample key"

Type: String

Mappings:

RegionMap:

ap-northeast-1:

”AMI": "ami-xxxxxxxxxx"

Resources:

Ec2Instance:

Type: "AWS::EC2::Instance"

Properties:

SubnetId: "subnet-xxxxxxxxxx"

SecurityGroupIds:

- “sg-xxxxxxxxxx”

KeyName: !Ref KeyName

ImageId: !FindInMap [ RegionMap, !Ref "AWS::Region", AMI ]

Page 17: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

17

AWSTemplateFormatVersion: "version date"

Description:

String

Metadata:

template metadata

Parameters:

set of parameters

Mappings:

set of mappings

Conditions:

set of conditions

Transform:

set of transforms

Resources:

set of resources

Outputs:

set of outputs

Page 18: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

18

Resources:

MyInstance:

Type: "AWS::EC2::Instance"

Properties:

SubnetId: "subnet-xxxxxxxxxx"

SecurityGroupIds:

- !GetAtt InstanceSecurityGroup.GroupId

KeyName: !Ref KeyName

ImageId: !FindInMap [ RegionMap, !Ref "AWS::Region", 64 ]

Page 19: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

19

Resources:

MyEC2Instance:

Type: "AWS::EC2::Instance”

Properties:

SubnetId: "subnet-xxxxxxxxxxxxxxxx"

Outputs:

MyEC2PhysicalID:

Value: !Ref MyEC2Instance

Page 20: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

20

Resources:

MyInstance:

Type: "AWS::EC2::Instance”

Metadata:

MyInstance:

Description: "Information about the instance"

Database:

Description: "Information about the database"

Page 21: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

21

Metadata:

AWS::CloudFormation::Interface:

ParameterGroups:

-

Label:

default: "Network Configuration"

Parameters:

- VPCID

- ApplicationSubnetId

-

Label:

default: "EC2 Configuration"

Parameters:

- KeyName

Page 22: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

22

Parameters:

Age:

Description: "input your age."

Type: Number

Default : 30

MinValue: 20

MaxValue: 60

FirstName:

Description: "input your first name."

Type: String

KeyName:

Description: "Sample key"

Type: String

Page 23: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

23

Page 24: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

24

• Resources:

Ec2Instance:

Type: "AWS::EC2::Instance"

Properties:

KeyName: !Ref KeyName

Tags:

-

Key: OwnerAge

Value: !Ref: Age

-

Key: OwnerName

Value: !Ref: FirstName

Page 26: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

Resources:

Ec2Instance:

Type: "AWS::EC2::Instance"

Properties:

ImageId: !FindInMap [ RegionMap, !Ref "AWS::Region", AMI ]

Outputs:

ApplicationURL:

Value: !Join ["", [ "http://", !GetAtt Ec2Instance.PublicDnsName , "/index.html"] ]

26

Page 27: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

27

Resources:

Ec2Instance:

Type: "AWS::EC2::Instance"

Properties:

KeyName: !Ref "AWS::StackName"

Tags:

-

Key: region

Value: !Ref “AWS::Region”

Page 28: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

28

Mappings:

RegionMap:

us-east-1:

"KEYPAIR": "myKey-east"

us-west-1:

"KEYPAIR": "myKey-west”

ap-northeast-1:

"KEYPAIR": "myKey-tokyo"

Page 29: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

29

Resources:

Ec2Instance:

Type: "AWS::EC2::Instance"

Properties:

KeyName: !FindInMap [ RegionMap, !Ref "AWS::Region", KEYPAIR ]

Mappings:

RegionMap:

us-east-1:

"KEYPAIR": "myKey-east"

us-west-1:

"KEYPAIR": "myKey-west”

ap-northeast-1:

"KEYPAIR": "myKey-tokyo"

Page 30: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

Parameters:

EnvType:

Description: "Environment type."

Default: "development"

Type: String

AllowedValues: ["production", "staging", "development"]

ConstraintDescription: "must specify."

Conditions:

CreateProdResources: {"Fn::Equals" : [{"Ref" : "EnvType"}, “production"]}

Resources:

Ec2Instance:

Type: "AWS::EC2::Instance"

Condition: "CreateProdResources"

30

Page 31: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

31

Transform: AWS::Serverless-2016-10-31

Resources:

MyServerlessFunctionLogicalID:

Transform:

Name: 'AWS::Include'

Parameters:

Location: 's3://MyAmazonS3BucketName/MyFileName.yaml'

Transform: [EchoMacro]

Resources:

FancyTable:

Page 32: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

32

Resources:

Ec2Instance:

Outputs:

PublicDNS:

Description: EC2 public DNS

Value: !GetAtt Ec2Instance.PublicDnsName

Outputs:

TSSG:

Value: !Ref TroubleShootingSG

Export:

Name: AccountSG

Page 33: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

33

Page 34: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

34

Template

Stack

Page 35: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

35

DB App Server Web Server Hosted zoneS3

Stack

Page 37: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

37

Page 38: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

38

Page 39: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

39

Page 40: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

40

Stack

Stack Stack Stack

Stack

Page 41: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

41

VPC

Public subnet 1

Availability zone 1

Private subnet 1

Availability zone 2

Public subnet 2

Private subnet 2

Stack

DB Instance

AP Server

Auto

Scaling

group

Page 42: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

42

Outputs:

SecGrpWebID:

Description: Security Group for Web

Value: !Ref SecGrpWeb

Export:

Name: !Sub ${AWS::StackName}-SecGrpWeb

Resources:

BastionSrv:

Type: "AWS::EC2::Instance"

Properties:

ImageId: !Ref OSImage

InstanceType: t2.micro

KeyName: !Ref KeyPair

NetworkInterfaces:

- DeleteOnTermination: true

Description: Primary network interface

DeviceIndex: 0

SubnetId:

Fn::ImportValue: !Sub ${BaseStackName}-PubSub1

GroupSet:

- Fn::ImportValue: !Sub {SecStackName}-SecGrpWeb

Page 43: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

43

Page 44: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

44

AWSTemplateFormatVersion: '2010-09-09’

Transform: AWS::Serverless-2016-10-31

Page 45: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

45

Page 46: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

46

AWSTemplateFormatVersion: "2010-09-09"

Resources:

Macro:

Type: "AWS::CloudFormation::Macro"

Properties:

FunctionName: arn:aws:lambda:us-east-1:1234567:function:EchoFunction

Name: EchoMacro

AWSTemplateFormatVersion: '2010-09-09'

Transform: [EchoMacro, 'AWS::Serverless-2016-10-31']

Resources:

FancyTable:

Type: AWS::Serverless::SimpleTable

Page 47: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

47

Parameter

Store

Template

Page 48: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

48

MyIAMUser:

Type: AWS::IAM::User

Properties:

UserName: 'MyUserName'

LoginProfile:

Password: '{{resolve:ssm-secure:IAMUserPassword-A:1}}'

Page 49: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

49

Parameters :

LatestAmiId :

Type : 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'

Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2’

Resources :

Instance :

Type : 'AWS::EC2::Instance'

Properties :

ImageId : !Ref LatestAmiId

Page 50: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

50

Template

Page 51: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

51

const cdk = require('@aws-cdk/cdk');

const s3 = require('@aws-cdk/aws-s3');

class MyStack extends cdk.Stack {

constructor(parent, id, props) {

super(parent, id, props);

new s3.Bucket(this, 'MyFirstBucket', {

versioned: true

});

}

}

Page 52: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

••

52

Page 53: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

53

Page 54: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

• のマネージドルールにより、差分が発生したらすぐに検知可能

• テンプレートに記載されていないプロパティについては差分をチェックしない

54

Template Stack

Page 55: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

55

Page 56: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

56

1

Stack

Template

2

Stack

3

Stack

1

Stack

2

Stack

3

Stack

StackSet

AWS Region - A

AWS Region - B

Page 57: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

57

Page 58: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

58

Page 59: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

59

Page 60: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

60

Template

DB Instance

Instance Instance

Page 61: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

61

{

"Statement" : [

{

"Effect" : "Deny",

"Action" : "Update:*",

"Principal": "*",

"Resource" : "*",

"Condition" : {

"StringEquals" : {

"ResourceType" : ["AWS::RDS::DBInstance"]

}

}

},

{

"Effect" : "Allow",

"Action" : "Update:*",

"Principal": "*",

"Resource" : "*"

}

]

}

Page 62: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

62

AWSTemplateFormatVersion: '2010-09-09'

Resources:

myS3Bucket:

Type: AWS::S3::Bucket

DeletionPolicy: Retain

Page 63: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

63

{"Effect":"Allow","Action":["cloudformation:CreateStack"]},{"Effect":"Deny","Action":["cloudformation:CreateStack"]

“Condition”:{‘ForAnyValue:StringLike”:{

“cloudformation:ResourceType”: [“AWS::IAM::*”]}

}}

Page 64: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

64

Page 65: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

65

Page 66: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

66

Cross Stack Reference

Page 67: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

IAM

67

Page 68: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

68

Page 69: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

69

VPC

Public subnet 1

Availability zone 1

Private subnet 1

Availability zone 2

Public subnet 2

Private subnet 2

Stack

DB Instance

AP Server

Role

Auto

Scaling

group

Role

Page 70: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

70

Page 71: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

71

Page 73: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

73

Page 75: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

75

Page 77: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

77

Page 78: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

./cfn-validate.sh yaml-eip.yaml

./cfn-update.sh create yaml-stack-r53 yaml-r53.yaml

./cfn-update.sh create yaml-stack-eip yaml-eip.yaml R53StackName=yaml-stack-r53

./cfn-status.sh yaml-stack-eip -v

78

Page 79: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

79

Page 80: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

80

Page 81: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

81

Page 82: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

82

AWS CloudFormation

AWS CloudFormation

Page 83: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

• •

• •

••

••

83

Page 84: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

{

"Version": "2012-10-17",

"Statement": [

{

"Sid": "ClodFormationResourceManagementPolicy",

"Effect": "Allow",

"Action": [

"cloudformation:CreateStack",

"cloudformation:UpdateStack"

],

"Resource": "*",

"Condition": {

"StringLike": {

"cloudformation:TemplateUrl": "https://<S3 endpoint>.amazonaws.com/<bucket>/*"

}

}

},

{

"Sid": "PermissionDelegation",

"Effect": "Allow",

"Action": [

"iam:PassRole"

],

"Resource": "arn:aws:iam::xxxxxxxxxxxx:role/CloudFormationServiceRole"

}

]

}

84

AWS CloudFormation

S3

AWS CloudFormation

Page 85: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

85

Page 86: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

86

Page 89: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

89

Page 90: AWS Webinar   ... · 16 AWSTemplateFormatVersion: 2010 -09 Description: Sample Parameters: KeyName: Description: "Sample key" Type: String Mappings: RegionMap: ap-northeast-1:

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

AWS Webinar

https://amzn.to/JPWebinar https://amzn.to/JPArchive