amazon-cloudformation

how to add “manually created” resources to the cloudformation template

孤街浪徒 提交于 2019-12-11 00:46:31
问题 I initially created all my resources in AWS manually. Now I'm trying to use CloudFormation (SAM) templates to create all my new resources. Is there any way I can all my old (manually created) resource to this CF template and hence forth use this CF to make modification to those old resources? 回答1: Not possible to add existing resources to a cloudformation template and have them managed from there on in with Cloudformation - but you can have a look at using CloudFormer (https://docs.aws.amazon

Latest AMI ID in a given Region using a set of filters

若如初见. 提交于 2019-12-11 00:37:12
问题 I am trying to run the code in the below, however I have errors while executing, could you please advise on the changes. latest-ami [ec2-user@ip-XXXXXXXX ~]$ python latest-ami.py us-west-2 {u'Images': [], 'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': '01ef1583-e7bc-4279-9081-28cbf9345f7c', 'HTTPHeaders': {'date': 'Wed, 01 Aug 2018 12:00:01 GMT', 'content-length': '219', 'content-type': 'text/xml;charset=UTF-8', 'server': 'AmazonEC2'}}} [ec2-user@ip-172-31-19-75

Can an Elastic Beanstalk environment be updated in Cloudformation without affecting the version deployed to it?

青春壹個敷衍的年華 提交于 2019-12-10 18:09:40
问题 I am creating an Elastic Beanstalk environment using Cloudformation. I have to create an ApplicationVersion just to get it started and feed it into the definition of the environment. I create other ApplicationVersions and deploy them to the cluster in other ways (CodePipeline). Now, every time I need to update the Cloudformation stack to change some other infrastructure, even though it doesn't list that as a potential resource change, it rolls back the ApplicationVersion to the initial one,

How to set a dynamic RoleMappings key for a IndentityPoolRoleAttachment in CloudFormation

好久不见. 提交于 2019-12-10 15:53:15
问题 I am building a stack to initialize a Cognito installation. As part of this I have setup user groups with associated roles. I need to set the Choose role from token option, allowing identities to use roles from the group(s) to which they are assigned. This is done through the RoleMappings object in the IndentityPoolRoleAttachment object. This mappings object is a string -> object map, where the string represents the identity provider. In my case, this is: cognito-idp.${some-region}.amazonaws

How to allow only email as username alias with CloudFormation?

早过忘川 提交于 2019-12-10 14:03:22
问题 Following this guide, it says: On the Attributes tab, select Email address or phone number and select Allow email addresses. Which looks like this: But I'm having trouble accomplishing the same thing with CloudFormation. Tried a couple of the obvious attributes but did not work. Thoughts? 回答1: It's now possible to do this by setting the UsernameAttributes property to an array of strings containing either email , phone_number or both: Type: AWS::Cognito::UserPool Properties: UsernameAttributes

DynamoDB auto scaling with Cloudformation

帅比萌擦擦* 提交于 2019-12-10 13:43:04
问题 AWS released auto scaling for DynamoDB. I would like to know how to create a Table with auto scaling via Cloudformation. 回答1: Here is the ClodFormation auto-scaling policy for DynamoDB table. Hope it gives you some idea about how to form the policy script. { "Type" : "AWS::ApplicationAutoScaling::ScalingPolicy", "Properties" : { "PolicyName" : "MyScalingPolicy", "PolicyType" : "TargetTrackingScaling", "ResourceId" : "arn:aws:dynamodb:us-east-1:123456789012:table/books_table",

How can I access protected S3 files in a CFN script?

被刻印的时光 ゝ 提交于 2019-12-10 13:35:12
问题 I am trying to retrieve a file in my cloudformation script. If I make the file publicly available, then it works fine. If the file is private, then the cfn script fails, but with a 404 error in /var/log/. Trying to retrieve the file via wget results in the appropriate 403 error. How can I retrieve private files from S3? My file clause looks like: "files" : { "/etc/httpd/conf/httpd.conf" : { "source" : "https://s3.amazonaws.com/myConfigBucket/httpd.conf" } }, I added an authentication clause

AWS AMI deprecation (API: ec2:RunInstances Not authorized for images)

▼魔方 西西 提交于 2019-12-10 12:49:26
问题 So I've been using AWS AMI in my cloud formation template. It seems they create new images every month and deprecate the old ones 2 weeks or so after the new one's released. This creates many problems: Old template stacks becomes broken. Templates need to be updated. Am I missing something? E.G. I'm staring at API: ec2:RunInstances Not authorized for images: [ami-1523bd2f] error in my cloud formation events. Looking it up that's the 02.12 image id: http://thecloudmarket.com/image/ami-1523bd2f

AWS: Cloud Formation: Is it possible to use multiple “DependsOn”?

不羁的心 提交于 2019-12-10 12:36:25
问题 Given i have this example template: { "AWSTemplateFormatVersion" : "2010-09-09", "Mappings" : { "RegionMap" : { "us-west-1" : { "AMI" : "ami-655a0a20" }, ... } }, "Resources" : { "Ec2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { ... }, "DependsOn" : "myDB" }, "myDB" : { "Type" : "AWS::RDS::DBInstance", "Properties" : { ... } }, "myDB2" : { "Type" : "AWS::RDS::DBInstance", "Properties" : { ... } } } } Is it possible to specify multiple DependsOn in any way? Would be great to

Can't install cloudwatch agent by cloudformation on Amazon ECS-optimized AMI

主宰稳场 提交于 2019-12-10 11:54:38
问题 I am creating a cloudformation template, which creates some resources as EC2 instance, autoscaling group and launchConfiguration . By the userData property of the launchConfiguration resource, I tried to install the Cloudwatch agent as follows: "UserData":{ "Fn::Base64" : { "Fn::Join" : ["", [ "#!/bin/bash -xe\n", "yum -y install aws-cfn-bootstrap\n", "/opt/aws/bin/cfn-init -v", " --stack ", { "Ref": "AWS::StackName" }, " --resource LaunchCongig", " --region ", { "Ref" : "AWS::Region" },"\n",