{"id":2328,"date":"2019-02-18T08:00:56","date_gmt":"2019-02-17T23:00:56","guid":{"rendered":"https:\/\/www.itc109.com\/knowledge\/?p=2328"},"modified":"2021-09-30T08:57:30","modified_gmt":"2021-09-29T23:57:30","slug":"aws-cloudformation-vpc","status":"publish","type":"post","link":"https:\/\/www.itc109.com\/knowledge\/aws\/aws-cloudformation-vpc","title":{"rendered":"AWS &#8211; CloudFormation\u3067\u74b0\u5883\u69cb\u7bc9\u3000VPC\u7de8"},"content":{"rendered":"<h4>\u6982\u8981<\/h4>\n<p>\u4eca\u56de\u304b\u3089\u8907\u6570\u56de\u306b\u5206\u3051\u3066 CloudFormation \u3092\u5229\u7528\u3057\u305f\u74b0\u5883\u69cb\u7bc9\u306b\u3064\u3044\u3066\u9023\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u00a0<br \/>\n\u307e\u305a\u3001CloudFormation \u3067\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b\u969b\u306f\u4f9d\u5b58\u95a2\u4fc2\u306b\u7559\u610f\u3057\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n<p>\u305f\u3068\u3048\u3070\u3001VPC \u304c\u5b58\u5728\u3057\u306a\u3044\u3068\u30b5\u30d6\u30cd\u30c3\u30c8\u3082\u4f5c\u308c\u307e\u305b\u3093\u3057\u3001\u30b5\u30d6\u30cd\u30c3\u30c8\u304c\u306a\u3051\u308c\u3070EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3082\u8d77\u52d5\u3067\u304d\u307e\u305b\u3093\u3002\u307e\u305f\u3001IAM\u3067\u30e6\u30fc\u30b6\u30fc\u3084\u30ed\u30fc\u30eb\u304c\u306a\u3051\u308c\u3070\u3001S3\u306e\u30d0\u30b1\u30c3\u30c8\u306b\u30dd\u30ea\u30b7\u30fc\u3092\u5272\u308a\u5f53\u3066\u305f\u308a\u3001Lambda\u306b\u5b9f\u884c\u6a29\u9650\u3092\u4e0e\u3048\u308b\u3053\u3068\u3082\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<br \/>\n\u00a0<br \/>\n\u3057\u304b\u3057\u3001VPC \u304c\u306a\u304f\u3066\u3082 IAM \u3067\u30e6\u30fc\u30b6\u30fc\u306f\u4f5c\u6210\u3067\u304d\u307e\u3059\u3057\u3001IAM \u306b\u30e6\u30fc\u30b6\u30fc\u304c\u3044\u306a\u304f\u3066\u3082 VPC \u306f\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<br \/>\n\u4f8b\u5916\u3068\u3057\u3066 CloudFormation \u3092\u5b9f\u884c\u3059\u308b\u70ba\u306b\u30ed\u30fc\u30eb\u3092\u5272\u308a\u5f53\u3066\u308b\u7b49\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u5148\u306b IAM \u3067\u30ed\u30fc\u30eb\u3092\u4f5c\u308b\u4e8b\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u305d\u3046\u3044\u3063\u305f\u5236\u7d04\u304c\u306a\u3044\u306a\u3089\u3042\u308b\u7a0b\u5ea6\u4f9d\u5b58\u95a2\u4fc2\u3082\u7d5e\u308a\u8fbc\u307e\u308c\u307e\u3059\u3002<\/p>\n<p>\u00a0<br \/>\n\u672c\u7ae0\u300cVPC\u300d\u7de8\u3067\u306f\u4ee5\u4e0b\u306e\u74b0\u5883\u306b\u3064\u3044\u3066\u69cb\u7bc9\u3092\u884c\u3044\u307e\u3059\u3002<br \/>\n\u30fbVPC \u306e\u4f5c\u6210<br \/>\n\u30fb\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u306e\u4f5c\u6210<br \/>\n\u30fbVPC \u306b\u4f5c\u6210\u3057\u305f\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u3092\u30a2\u30bf\u30c3\u30c1<\/p>\n<p>\u7c21\u5358\u306b\u307e\u3068\u3081\u308b\u3068\u3001\u65b0\u898f\u306b VPC \u3068\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u3092\u4f5c\u6210\u3057\u3066\u3001\u65b0\u898f VPC \u306b\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u3092\u30a2\u30bf\u30c3\u30c1\u3059\u308b\u307e\u3067\u306e\u69cb\u6210\u3067\u3059\u3002<\/p>\n<p>\u00a0<br \/>\n\u30a4\u30e1\u30fc\u30b8\u56f3<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.itc109.com\/knowledge\/wp-content\/uploads\/sites\/2\/cloudformation-vpc.png\" alt=\"\" width=\"854\" height=\"524\" class=\"alignnone size-full wp-image-2347\" \/><\/p>\n<p>\u00a0<br \/>\n\u305d\u308c\u3067\u306f\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u78ba\u8a8d\u3057\u306a\u304c\u3089\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>\u30b3\u30fc\u30c9<\/h4>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>AWSTemplateFormatVersion: 2010-09-09\r\nDescription: Creation of VPC and Internet gateway.\r\n\r\n\r\nParameters:\r\n  ProjectCode:\r\n    Type: String\r\n    Default: itc109\r\n    Description: Project Code\r\n\r\n  IPv4CIDRblock:\r\n    Type: String\r\n    Default: 10.0.0.0\/16\r\n    Description: VPC CIDR Block\r\n\r\nResources:\r\n  VPC:\r\n    Type: AWS::EC2::VPC\r\n    Properties:\r\n      CidrBlock:\r\n            Fn::Ref IPv4CIDRblock\r\n      EnableDnsSupport: true\r\n      EnableDnsHostnames: true\r\n      InstanceTenancy: default\r\n      Tags:\r\n        - Key: Name\r\n          Value: \r\n            Fn::Sub: vpc-${ProjectCode}\r\n\r\n  InternetGateway:\r\n    Type: AWS::EC2::InternetGateway\r\n    Properties:\r\n      Tags:\r\n        - Key: Name\r\n          Value: \r\n            Fn::Sub: igw-${ProjectCode}\r\n\r\n  AttachGateway:\r\n    Type: AWS::EC2::VPCGatewayAttachment\r\n    Properties:\r\n      VpcId: !Ref VPC\r\n      InternetGatewayId: !Ref InternetGateway\r\n\r\n\r\nOutputs:\r\n  VPCId:\r\n    Value: !Ref VPC\r\n    Export:\r\n      Name: vpc\r\n\r\n  InternetGatewayId:\r\n    Value: !Ref InternetGateway\r\n    Export:\r\n      Name: igw\r\n<\/code><\/pre>\n<\/div>\n<p>\u5b9f\u884c\u5f8c\u306b\u51fa\u529b\u3055\u308c\u308b\u5024\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th>\u30ad\u30fc<\/th>\n<th>\u5024<\/th>\n<th>\u5024\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u540d<\/th>\n<\/tr>\n<tr>\n<td>VPCId<\/td>\n<td>vpc-*****************<\/td>\n<td>vpc<\/td>\n<\/tr>\n<tr>\n<td>InternetGatewayId<\/td>\n<td>igw-*****************<\/td>\n<td>igw<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0<br \/>\n\u30b9\u30bf\u30c3\u30af\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u304c\u30a2\u30bf\u30c3\u30c1\u3055\u308c\u305f VPC \u304c\u4f5c\u6210\u3055\u308c\u305f\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u51fa\u529b\u3067\u6c42\u3081\u3089\u308c\u308b\u300cVPCId\u300d\u306f\u4eca\u5f8c\u3044\u308d\u3093\u306a\u30b9\u30bf\u30c3\u30af\u304b\u3089VPCID\u306e\u5024\u3068\u3057\u3066\u53c2\u7167\u3055\u308c\u307e\u3059\u3002<br \/>\n\u300cInternetGatewayId\u300d\u306f\u30eb\u30fc\u30c8\u30c6\u30fc\u30d6\u30eb\u7b49\u304b\u3089\u306e\u53c2\u7167\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>AWS::EC2::VPC<\/code><\/pre>\n<\/div>\n<p>\u65b0\u898f\u306bVPC\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>AWS::EC2::InternetGateway<\/code><\/pre>\n<\/div>\n<p>\u65b0\u898f\u306bVPC\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-html\" data-lang=\"HTML\"><code>AWS::EC2::VPCGatewayAttachment<\/code><\/pre>\n<\/div>\n<p>\u65b0\u898f\u306b\u4f5c\u6210\u3057\u305fInternetGateway\u3092VPC\u306b\u30a2\u30bf\u30c3\u30c1\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001\u30b5\u30d6\u30cd\u30c3\u30c8\u4f5c\u6210\u7528\u306b\u5225\u30b9\u30bf\u30c3\u30af\u3092\u4f5c\u6210\u3057\u3066\u3001\u4eca\u56de\u306e\u30b9\u30bf\u30c3\u30af\u3092\u53c2\u7167\u3057\u3066\u69cb\u7bc9\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>\u88dc\u8db3<\/h4>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>Fn::Ref IPv4CIDRblock\r\n!Ref VPC<\/code><\/pre>\n<\/div>\n<p>\u300cFn:Ref\u300d\u300c!Ref\u300d\u306f\u5171\u306b\u6307\u5b9a\u3057\u305f\u30ea\u30bd\u30fc\u30b9\u3092\u53c2\u7167\u3057\u3066\u5024\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3069\u3061\u3089\u3067\u8a18\u8ff0\u3057\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>AWS CloudFormation\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<br \/>\n<a href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AWSCloudFormation\/latest\/UserGuide\/aws-resource-ec2-vpc.html\" target=\"_blank\" rel=\"noopener\">AWS::EC2::VPC<\/a><br \/>\n<a href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AWSCloudFormation\/latest\/UserGuide\/aws-resource-ec2-internetgateway.html\" target=\"_blank\" rel=\"noopener\">AWS::EC2::InternetGateway<\/a><br \/>\n<a href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AWSCloudFormation\/latest\/UserGuide\/aws-resource-ec2-vpc-gateway-attachment.html\" target=\"_blank\" rel=\"noopener\">AWS::EC2::VPCGatewayAttachment<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 \u4eca\u56de\u304b\u3089\u8907\u6570\u56de\u306b\u5206\u3051\u3066 CloudFormation \u3092\u5229\u7528\u3057\u305f\u74b0\u5883\u69cb\u7bc9\u306b\u3064\u3044\u3066\u9023\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u00a0 \u307e\u305a\u3001CloudFormation \u3067\u74b0\u5883\u3092\u4f5c\u6210\u3059\u308b\u969b\u306f\u4f9d\u5b58\u95a2\u4fc2\u306b\u7559\u610f\u3057\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002 \u305f\u3068\u3048\u3070\u3001VPC &#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2],"tags":[122],"class_list":["post-2328","post","type-post","status-publish","format-standard","hentry","category-aws","tag-cloudformation"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pacZwp-By","_links":{"self":[{"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/posts\/2328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/comments?post=2328"}],"version-history":[{"count":20,"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/posts\/2328\/revisions"}],"predecessor-version":[{"id":2677,"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/posts\/2328\/revisions\/2677"}],"wp:attachment":[{"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/media?parent=2328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/categories?post=2328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itc109.com\/knowledge\/wp-json\/wp\/v2\/tags?post=2328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}