amazon-cloudformation

CloudFormation, apply Condition on DependsOn

前提是你 提交于 2019-12-18 11:24:54
问题 The task that I need to do is make CDN depend on a S3 bucket. But we want to make it use the existing bucket rather than creating a new one. Here is the sample code that I am trying: "Parameters" : { "UseExistingBucket" : { "Description" : "Yes/No", "Default" : "yes", "Type" : "String", "AllowedValues" : [ "yes", "no" ] } }, "Conditions" : { "CreateS3Resources" : {"Fn::Equals" : [{"Ref" : "UseExistingBucket"}, "no"]} }, "Resources" : { "StaticBucket" : { "Type" : "AWS::S3::Bucket", "Condition

AppSync: Get user information in $context when using AWS_IAM auth

主宰稳场 提交于 2019-12-18 11:10:56
问题 In AppSync, when you use Cognito User Pools as your auth setting your identity you get identity: { sub: 'bcb5cd53-315a-40df-a41b-1db02a4c1bd9', issuer: 'https://cognito-idp.us-west-2.amazonaws.com/us-west-2_oicu812', username: 'skillet', claims: { sub: 'bcb5cd53-315a-40df-a41b-1db02a4c1bd9', aud: '7re1oap5fhm3ngpje9r81vgpoe', email_verified: true, event_id: 'bb65ba5d-4689-11e8-bee7-2d0da8da81ab', token_use: 'id', auth_time: 1524441800, iss: 'https://cognito-idp.us-west-2.amazonaws.com/us-west

Is there a way to run initial SQL when creating an RDS database instance using CloudFormation?

断了今生、忘了曾经 提交于 2019-12-18 10:47:20
问题 I am creating an RDS instance using CloudFormation using this: "Resources": { "myDB": { "Type": "AWS::RDS::DBInstance", "Properties": { "AllocatedStorage": "5", "DBInstanceClass": "db.m1.small", "Engine": "MySQL", "EngineVersion": "5.5", "DBName": "mydb", "MasterUsername": { "Ref": "DBUser" }, "MasterUserPassword": { "Ref": "DBPassword" }, "DBParameterGroupName": { "Ref": "myRDSParamGroup" } } } and it all works. But I need to run initial SQL on the DB when its created, to setup my apps

How to create a new version of a Lambda function using CloudFormation?

做~自己de王妃 提交于 2019-12-17 22:38:34
问题 I'm trying to create a new version of a Lambda function using CloudFormation. I want to have multiple versions of the same Lambda function so that I can (a) point aliases at different versions - like DEV and PROD - and (b) be able to roll back to an earlier version This is the definition of my Lambda version: LambdaVersion: Type: AWS::Lambda::Version Properties: FunctionName: Ref: LambdaFunction A version gets created when running "aws cloudformation create-stack" but the subsequent "aws

Set up S3 Bucket level Events using AWS CloudFormation

被刻印的时光 ゝ 提交于 2019-12-14 04:04:16
问题 I am trying to get AWS CloudFormation to create a template that will allow me to attach an event to an existing S3 Bucket that will trigger a Lambda Function whenever a new file is put into a specific directory within the bucket. I am using the following YAML as a base for the CloudFormation template but cannot get it working. --- AWSTemplateFormatVersion: '2010-09-09' Resources: SETRULE: Type: AWS::S3::Bucket Properties: BucketName: bucket-name NotificationConfiguration: LambdaConfigurations

service unable to place a task

半世苍凉 提交于 2019-12-14 03:53:25
问题 Ok, I am lost with where to to even troubleshoot this. I am trying to spin up a stack that has a basic app running in ECS. I will show the cloudformation below. But I keep getting: service sos-ecs-SosEcsService-1RVB1U5QXTY9S was unable to place a task because no container instance met all of its requirements. Reason: No Container Instances were found in your cluster. For more information, see the Troubleshooting section. I get 2 EC2 instances up and running but neither appear in the ECS

Share Values upstream in a nested cloudformation stack possible?

两盒软妹~` 提交于 2019-12-14 03:08:07
问题 Is there some way to pass on Values form a child stack to a parent stack? All I found was to pass values down, but never up, that would unfortunately not correspond with my stack architecture. I could use cross-referencing with eXport/Import but would rather keep the nested stack if possible. 回答1: You can definitely gather outputed values from a child stack and use them in the parent stack. For example: # parent stack AWSTemplateFormatVersion: 2010-09-09 Resources: SomeChildStack: Type: AWS:

How to resolve a circular dependency in AWS Cloudformation

前提是你 提交于 2019-12-13 15:26:12
问题 I created an AWS Cloudformation template and I'm having trouble getting over a circular dependency. I'm creating an EC2 instance and a load balancer, the load balancer depends on the EC2 instance because it references it in its Instances properties. Everything was working fine until I had to reference the load balancer's DNSName property inside the EC2 instance Init section. "AppServer": { "Type": "AWS::EC2::Instance", "Metadata": { "AWS::CloudFormation::Init" : { "configSets" : { "Install" :

How to get username in AWS Cloudformation template file?

只愿长相守 提交于 2019-12-13 13:28:49
问题 I have resources defined in my Cloudformation template file with tags defined like so: "Properties": { "Tags": [ { "Key": "Environment", "Value": {"Ref": "Environment"}}, { "Key": "Hello", "Value": "World"} ] } My IAM username is my.name . I would like to add a key named Creator to the Tags property with value my username ( my.name ). Moreover, I need this value to reflect the username of whoever runs this Cloudformation template. How can I do it? 回答1: I am not aware of any way of referencing

userData are not getting executed after launching the instance by cloudformation

馋奶兔 提交于 2019-12-13 12:21:08
问题 I created a AWS cloudformation, which creates a launch configuration and an autoscaling group. In the user Data in the launch Config I have configured the file system mount target, and I installed the cloudwatch agent: Code EDITED "LaunchConfig":{ "Type":"AWS::AutoScaling::LaunchConfiguration", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "files" : { "/etc/cwlogs.cfg": { "content": { "Fn::Join" : ["", [ "[general]", "state_file = /var/awslogs/state/agent-state", "[/var/log