amazon-cloudformation

using Cloudformation ref with awscli in userData

我与影子孤独终老i 提交于 2020-01-04 09:17:30
问题 "aws ec2 create-tags --resources xxxxxx --tags Key=Team,Value=everybody --region { \"Ref\" : \"region\" } --out text\n" The above line/command I am using in my Cloudformation userData, It is not getting executed , I am getting the following error when I debugged : aws: error: argument --region: Invalid choice, valid choices are: ap-southeast-1 | us-gov-west-1 ap-northeast-1 | eu-west-1 fips-us-gov-west-1 | us-west-1 us-west-2 | us-east-1 cn-north-1 | ap-southeast-2 sa-east-1 My region name is

Cloud Formation AWS::Cognito::UserPoolUser temporary password

时光毁灭记忆、已成空白 提交于 2020-01-04 07:42:12
问题 I'm creating Cognito user using Cloud Formation template for Kibana cognito authentication. How to provide temporary password in the template? 回答1: Far as I know, you can't do this via AWS::Cognito::UserPoolUser which I believe you are using. Set up a password policy in the UserPool creation and it should do the job. Type: AWS::Cognito::UserPool DeletionPolicy: Retain Properties: UserPoolName: UserPoolName AdminCreateUserConfig: AllowAdminCreateUserOnly: true Policies: PasswordPolicy:

AWS CloudFormation and Windows Server 2008 R2 for Bootstrap file downloads

夙愿已清 提交于 2020-01-03 03:03:24
问题 AWS released a new AMI recently which has CloudFormation tools installed by default on their Windows Server 2008 R2. The AMI itself can be found here : [https://aws.amazon.com/amis/microsoft-windows-server-2008-r2-base-cloudformation] When using this AMI directly within a CloudFormation template and launching the stack, I am able to launch my stack easily and the instance downloads my files located in S3 without any problem during boot up, all the folders created by cfn-init command can also

CloudFormation - Security Group VPC issue

巧了我就是萌 提交于 2020-01-02 09:31:26
问题 I have a template which creates an ELB and attaches an existing subnet within a VPC. This creates just fine but when I then update my stack and add a security group with a VpcId property with a value equal to the existing VPC ID in which my attached subnet belongs the stack fails with the following error: "You have specified two resources that belong to different networks" If I remove the VpcId property from my security group it creates it in my default VPC and the stack creation works. I

Configure Connection Draining for AWS Load Balancer v2 in CloudFormation

萝らか妹 提交于 2020-01-02 07:15:27
问题 This blog post (here specifically) details how to configure connection draining for a 'classic' version 1 load balancer using the AWS::ElasticLoadBalancing::LoadBalancer type, like so: "ElasticLoadBalancer": { "Type": "AWS::ElasticLoadBalancing::LoadBalancer", "Properties": { "ConnectionDrainingPolicy": { "Enabled": "true", "Timeout": "300" }, ... } } How can I do this using the version 2 load balancer with type AWS::ElasticLoadBalancingV2::LoadBalancer ? My best guess from the documentation

Can AWS CloudFormation call the AWS API?

99封情书 提交于 2020-01-02 07:03:43
问题 I'm trying to use CloudFormation to create my AWS environment and part of that is setting up Elastic Transcoder. Unfortunately it seems like ET is not part of the existing CloudFormation system, but it can be created via API calls. Is there any way to call the API from CloudFormation? 回答1: You can create custom resources, in particular you can create lambda backed custom resources. With these your lambda function is called with data from the template passed in the event object and a presigned

Passing userdata file to AWS Cloudformation stack

怎甘沉沦 提交于 2020-01-01 10:05:13
问题 I have a shell script(userdata file) and wondering is there a CLI command parameter that allows user to launch Cloudformation stack with userdata file? 回答1: Inside your template, use a CloudFormation parameter for the instance userdata: { "Parameters": { "UserData": { "Type": "String" } }, "Resources": { "Instance": { "Type" : "AWS::EC2::Instance", "Properties" : { "UserData" : { "Ref" : "UserData" }, ... } }, ... } } Assuming you're using a Unix-like command line environment, create your

Passing userdata file to AWS Cloudformation stack

牧云@^-^@ 提交于 2020-01-01 10:05:03
问题 I have a shell script(userdata file) and wondering is there a CLI command parameter that allows user to launch Cloudformation stack with userdata file? 回答1: Inside your template, use a CloudFormation parameter for the instance userdata: { "Parameters": { "UserData": { "Type": "String" } }, "Resources": { "Instance": { "Type" : "AWS::EC2::Instance", "Properties" : { "UserData" : { "Ref" : "UserData" }, ... } }, ... } } Assuming you're using a Unix-like command line environment, create your

Crontab in AWS CloudFormation Userdata

谁说我不能喝 提交于 2020-01-01 03:38:11
问题 How to set crontab when using AWS CloudFormation Userdata? I am setting (crontab -l ; echo "0 * * * * wget -O - -q http://www.example.com/cron.php") | crontab - But the cron is not setting. Is there a specific format which I should be using? 回答1: This will work, set this in your template, for your instance: "UserData": { "Fn::Base64": { "Fn::Join": [ "", [ "#!/bin/bash\n", "echo '0 * * * * wget -O - -q http://www.example.com/cron.php' > /tmp/mycrontab.txt\n", "sudo -u ubuntu bash -c 'crontab

How do I cloudform an API gateway resource with a lambda proxy integration

喜你入骨 提交于 2020-01-01 01:35:50
问题 I've been trying to work out how to express (in cloudformation) an API Gateway Resource that has a Lambda function integration type using the Lambda Proxy integration. This is easy to do in the AWS console as there is a check box that you can select: However there is no corresponding field in the AWS::ApiGateway::Method CloudFormation resource (it should be in the Integration property). How can I configure this in cloudformation? 回答1: The Integration type should be set to AWS_PROXY . An