{"id":844,"date":"2019-03-09T16:40:27","date_gmt":"2019-03-09T13:40:27","guid":{"rendered":"https:\/\/artem.services\/?p=844"},"modified":"2019-03-12T18:05:57","modified_gmt":"2019-03-12T15:05:57","slug":"aws-ec2-%d0%bf%d0%b5%d1%80%d0%b5%d0%b4%d0%b0%d1%82%d1%8c-%d0%ba%d1%80%d0%b5%d0%b4%d1%8b-%d0%be%d1%82-s3-%d0%b4%d0%be%d0%bf%d0%b8%d1%81%d0%b0%d1%82%d1%8c-%d0%b8-%d0%bf%d1%80%d0%be%d0%b2%d0%b5%d1%80","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=844","title":{"rendered":"CloudFormation &#8212; \u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u044b \u043e\u0442 S3 \u0432 EC2 Instance"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"size-full wp-image-214 aligncenter\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo.png\" alt=\"\" width=\"975\" height=\"450\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo.png 975w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-300x138.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-768x354.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2018\/11\/AWS-Logo-954x440.png 954w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 <strong>CloudFormation<\/strong> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u044c EC2 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 &quot;<strong>ACCESS_KEY<\/strong>&quot; \u0438 &quot;<strong>SECRET_KEY<\/strong>&quot; \u043f\u0440\u044f\u043c\u043e \u0438\u0437 <strong>IAM<\/strong> \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a <strong>S3 Bucket <\/strong>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f<strong> AWS-Cli<\/strong>.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nAWSTemplateFormatVersion: &quot;2010-09-09&quot;\r\nDescription: 'Auto create VPC with instance'\r\n\r\n########################################### BLOCK WITH ENVIRONMENTS ###########################################\r\nParameters:\r\n\r\n  ProjectName:\r\n    Type: String\r\n    Default: ArtemPool\r\n    Description: Name of project.\r\n\r\n  SSHKeyName:\r\n    Type: String\r\n    Default: artem\r\n    Description: Name of SSH key.\r\n\r\n  Image:\r\n    Type: String\r\n    Default: ami-0ff8a91507f77f867\r\n    Description: Image for instance (Default - Amazon Linux, if you changes it, you must install AWS-Cli manualy)\r\n    ConstraintDescription: (ami-0ff8a91507f77f867 - Amazon Linux)\r\n\r\n  Region:\r\n    Type: String\r\n    Default: us-east-1b\r\n    Description: Region (Default - U.S. Virginia)\r\n\r\n####################################### BLOCK WITH IAM FOR ACCESS TO S3  ######################################\r\n\r\nResources:\r\n  myaccesskey:\r\n    Type: AWS::IAM::AccessKey\r\n    Properties:\r\n      UserName: artem-s3\r\n\r\n########################################## BLOCK WITH EC2 INSTANCES  ##########################################\r\n\r\n  Ec2Instance:\r\n    Type: AWS::EC2::Instance\r\n    Properties:\r\n      ImageId: !Ref Image\r\n      InstanceType: t2.micro\r\n      KeyName: !Ref SSHKeyName\r\n      BlockDeviceMappings:\r\n        -\r\n          DeviceName: \/dev\/sdm\r\n          Ebs:\r\n            VolumeType: io1\r\n            Iops: 200\r\n            DeleteOnTermination: true\r\n            VolumeSize: 20\r\n      UserData:\r\n        Fn::Base64: !Sub ACCESS_KEY=${myaccesskey}&amp;&amp;SECRET_KEY=${myaccesskey.SecretAccessKey}\r\n\r\nOutputs: \r\n  AccessKeyformyaccesskey:\r\n    Value:\r\n      !Ref myaccesskey\r\n  SecretKeyformyaccesskey:\r\n    Value: !GetAtt myaccesskey.SecretAccessKey\r\n\r\n###############################################################################################################\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u043c\u0435\u0440 CloudFormation \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u044c EC2 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0430 &quot;ACCESS_KEY&quot; \u0438 &quot;SECRET_KEY&quot; \u043f\u0440\u044f\u043c\u043e \u0438\u0437 IAM \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a S3 Bucket \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f AWS-Cli.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[25,27,29,643,35],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/844"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=844"}],"version-history":[{"count":5,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":886,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions\/886"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}