I am trying to deploy a CloudFormation stack with this template.
---
Resources:
# This has already been deployed successfully.
ConnectInstance:
Type: AWS::Connect::Instance
Properties:
Attributes:
InboundCalls: True
OutboundCalls: True
IdentityManagementType: CONNECT_MANAGED
InstanceAlias: !Ref AWS::StackName
# This keeps failing to deploy.
PhoneNumber:
Type: AWS::Connect::PhoneNumber
Properties:
CountryCode: US
TargetArn: !GetAtt ConnectInstance.Arn
Type: TOLL_FREE
Outputs:
PhoneNumber:
Value: !GetAtt PhoneNumber.Address
However, the AWS::Connect::PhoneNumber instance keeps failing to deploy with the following message.
Resource handler returned message: "Resource of type 'AWS::Connect::PhoneNumber' with identifier 'ARN_REDACTED' did not stabilize." (RequestToken: 77acda15-2de4-3152-ff11-0e972d1840d1, HandlerErrorCode: NotStabilized)
Can anyone help with this?
I tried deploying multiple times but still got the same result every time. I also tried claiming a phone number manually on another instance that I created by hand, but I got an error saying I had reached the quota, even though I've never successfully claimed any numbers.
Related
I'd like to expose the TopicArn Value (referenced in the outputs section at the bottom of my code snippet) of my SNStopic via Cloudformation template in the outputs tab of my stack in a similar manner to the way it's exposed in the resources when I create an SNStopic through the service catalog. I tried to access it by referencing it in the outputs section of my yaml script using dot notation but have been unsuccessful thus far. How might I be able to do so? I'm looking to do this so others using my script in the future won't have to go searching for the TopicArn in another place in order to subscribe to it.
Another important thing to note is that the provisioned product id below, under the properties section of the resources code block generates an SNSTopic.
Resources:
LabTrainingSnsTopic:
Type: "AWS::ServiceCatalog::CloudFormationProvisionedProduct"
Properties:
ProductId: prod-4iafsjovqrsrm # Sns Topic
ProvisioningArtifactName: "v1.1" # Must be an actual version number.
ProvisionedProductName: !Ref ProvisionedProductName
...
Outputs:
AccountID:
Description: The account in which this was built.
Value: !Ref 'AWS::AccountId'
TopicArn:
Description: Arn of the topic we created
Value: !GetAtt LabTrainingHigSnsTopic.ProvisionedProductName.Resources.SNSTopic
service catalog screenshot
cloudformation screenshot
I am trying to create a Workflow object using AWS CloudFormation. This workflow will be used with AWS File Transfer Family so that files get copied to S3 upon uploading.
AWSTemplateFormatVersion: "2010-09-09"
Resources:
SftpToS3Workflow:
Type: AWS::Transfer::Workflow
Properties:
Description: 'Workflow used by AWS File Transfer Family. Copies the files to S3'
Steps:
- Type: COPY
CopyStepDetails:
Name: copt-to-s3-wf-step
DestinationFileLocation:
S3FileLocation:
Bucket: !ImportValue GenesysS3BucketName
Key: "genesys/"
OverwriteExisting: 'TRUE'
Outputs:
SftpToS3WorkflowId:
Description: 'Id of the Workflow'
Value: !GetAtt SftpToS3Workflow.WorkflowId
Export:
Name: SftpToS3WorkflowId
Unfortunately, this script fails with the below error. The error does not say what property is failing validation. Can someone help, please? I could not find even one single example on GitHub.
Properties validation failed for resource SftpToS3Workflow with message: #/Description: failed validation constraint for keyword [pattern]
I have used this CloudFormation schema to write the code:
https://github.com/APIs-guru/openapi-directory/blob/0380216a44c364b4517b31a93295089a6f4f23b9/APIs/amazonaws.com/transfer/2018-11-05/openapi.yaml
The Description can only be
^[\w- ]*$
So it should be:
Description: 'Workflow used by AWS File Transfer Family - Copies the files to S3'
I am trying to set up the Inventory configuration for an S3 bucket with CloudFormation. I want to get daily inventories of data in one subfolder, and have the inventories written to a different subfolder in the same bucket. I have defined the bucket as follows:
S3Bucket:
Type: AWS::S3::Bucket
Properties:
# ...other properties...
InventoryConfigurations:
- Id: runs
Enabled: true
Destination:
BucketAccountId: !Ref AWS::AccountId
BucketArn: !GetAtt S3Bucket.Arn
Format: CSV
Prefix: inventory/runs/
IncludedObjectVersions: Current
OptionalFields: [ETag, Size, BucketKeyStatus]
Prefix: runs/
ScheduleFrequency: Daily
Unfortunately, the !GetAtt S3Bucket.Arn line seems to be failing, causing an error message like "Error: Failed to create changeset for the stack: , ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Circular dependency between resource". If I use the actual ARN of the bucket in place of !GetAtt S3Bucket.Arn (it already exists from a previous version of the stack), then the deploy succeeds, so I know buckets can write Inventories to themselves.
So I guess my question is, is there a way to let Cfn resources call !GetAtt on themselves, so I don't have to hard-code the bucket ARN in InventoryConfigurations? Thanks in advance!
Can AWS CloudFormation resources call !GetAtt on themselves?
Unfortunately no, as the !GetAtt is used to reference other resources in the stack as you've experienced (other as in concrete resources that have already been created).
However, in your case, considering you know the bucket name, you could just construct the bucket ARN yourself directly.
Format:
arn:aws:s3:::bucket_name
e.g. if the name is test, you can use arn:aws:s3:::test
Destination:
BucketAccountId: !Ref AWS::AccountId
BucketArn: 'arn:aws:s3:::test'
I have deployed successfully this stack:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
some decription
Parameters:
ImageUri:
Type: String
Resources:
SomeLambda:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
ImageConfig:
Command: ["src/something"]
ImageUri: !Ref ImageUri
Events:
IoTRule:
Type: IoTRule
Properties:
Sql: SELECT * FROM 'something/+/+'
AwsIotSqlVersion: 2016-03-23
I deploy the above stack as a nested stack of my root stack.
When im trying to delete the stack, the "AWS::IoT::TopicRule" resource gives me a "DELETE IN PROGRESS" status for about 15 minutes and then "DELETE FAILED" status.
The error message on cloudformation is:
Resource handler returned message: "Exceeded attempts to wait" (RequestToken: ***********, HandlerErrorCode: NotStabilized)
I looked at the cloudformation docs of the error codes(https://docs.aws.amazon.com/es_es/cloudformation-cli/latest/userguide/resource-type-test-contract-errors.html),
it says that:
NotStabilized
The downstream resource failed to complete all of its ready-state checks.
Type: Terminal
does anyone know how to solve this ?
Thanks
I found a bypass:
This problem occurred when I attempted to delete the cloudformation stack with python boto3 lib.
later, I tried to use aws-cli to delete the stack - and it was deleted successfully.
I'm creating a Nodejs microservice for AWS Lambda. I scaffolded by project using AWS Codestar, and that set me up with a CI/CD pipeline that automatically deploys the lambda function. Nice.
The issue is that every time it deploys the lambda function it must delete and recreate the function, thus deleting any versions or aliases I made.
This means I really can't roll back to other releases. I basically have use git to actually revert the project, push to git, wait for the super-slow AWS Code Pipeline to flow through successfully, and then have it remake the function. To me that sounds like a pretty bad DR strategy, and I would think the right way to rollback should be simple and fast.
Unfortunately, it looks like the CloudFormation section of AWS doesn't offer any help here. When you drill into your stack on the first CloudFormation page it only shows you information about the latest formation that occurred. Dear engineers of AWS CloudFormation: if there was a page for each stack that showed a history of CloudFormation for this stack and an option to rollback to it, that would be really awesome. For now, though, there's not. There's just information about the latest formation that's been clouded. One initially promising option was "Rollback Triggers", but this is actually just something totally different that lets you send a SNS notification if your build doesn't pass.
When I try to change the CodePipeline stage for deploy from CREATE_CHANGE_SET to CREATE_UPDATE I then get this error when it tries to execute:
Action execution failed UpdateStack cannot be used with templates
containing Transforms. (Service: AmazonCloudFormation; Status Code:
400; Error Code: ValidationError; Request ID:
bea5f687-470b-11e8-a616-c791ebf3e8e1)
My template.yml looks like this by the way:
AWSTemplateFormatVersion: 2010-09-09
Transform:
- AWS::Serverless-2016-10-31
- AWS::CodeStar
Parameters:
ProjectId:
Type: String
Description: AWS CodeStar projectID used to associate new resources to team members
Resources:
HelloWorld:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs8.10
Environment:
Variables:
NODE_ENV: staging
Role:
Fn::ImportValue:
!Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']]
Events:
GetEvent:
Type: Api
Properties:
Path: /
Method: get
PostEvent:
Type: Api
Properties:
Path: /
Method: post
The only options in the CodePipeline "Deploy" action are these:
It would be really great if someone could help me to see how in AWS you can make Lambda functions with CodePipeline in a way that they are easy and fast to rollback. Thanks!