Fn If in cf template and executing a command - amazon-web-services

I would greatly appreciate your help on this.
I am trying inside a AWS CF template to run a command when the env=QA
This is what I'm trying to achieve but there is no way
"Conditions" : {
"CreateQaResources" : {"Fn::Equals" : [{"Ref" : "Env"}, "AwsQaUs"]}
},
and then
"Fn::If": [
"CreateQaResources",
{
"echo \"10.0.0.0 DOMAIN.COMPANY.com \" >>/etc/hosts \n",
},
{
"Ref" : "Env::AwsQaUs"
}
]
Can you please tell me where is my mistake?
Thank you

Everything seems to be okay, but it would be nice to see more of your template to make sure it looks right. Are you getting some sort of error or is the end result just not what you're hoping? I realize this isn't an answer. Apparently I don't have permission to add comments, yet. Sorry!

Related

Adding pages to a multi-column notion database works flawlessly sometimes and gives a validation error sometimes for the same input

Basically, I'm using Postman to send POST requests to
https://api.notion.com/v1/pages
It works for 70% of the times and rest of the times it gives the following error sometimes. That is, for the same input.
{
"object": "error",
"status": 400,
"code": "validation_error",
"message": "body failed validation. Fix one: body.parent.type should be not present, instead was `\"database_id\"`. body.parent.page_id should be defined, instead was `undefined`."
}
Here's how my body starts
{
"parent": {
"type": "database_id",
"database_id": "a94c42320ef04b6a9c1a7e5e73455557"
},
"properties": {
"Title": {
..................
I'm not posting the entire body because it works flawlessly sometimes.
Please help me out. Is there a way to check logs of the requests that come to my page?
First, I found out that type: database_id is not necessary in parent.
I also found out that syntax errors in the payload returns a 400 error:
body failed validation. Fix one: body.parent.type should be not present, instead was `\"database_id\"`. body.parent.page_id should be defined, instead was `undefined`.
In my case, I wrongly added a value in the same level as parent, properties. Like this:
{
"parent": {
"database_id": "<database_id>"
},
"properties": {
...
},
"wrong_value": {}
}
Since the errors are not that specific, check if you made the same misktake like me, and please also double check if the parent you are trying to post to is actually a database, not a page.
The issue was with having "type: database_id" inside "parent" in the request data.
{
"parent": {
"type": "database_id",(REMOVE THIS LINE)
"database_id": "a94c42320ef04b6a9c1a7e5e73455557"
},
"properties": {
"Title": {
..................
After removing "type" it worked fine. Notion needs to update their docs.

How to apply lifecycle patters in AWS elasticsearch to many indexs

I am trying to do this in AWS elasticsearch, whereby I create a template for the pattern application-logs-*, and then I want to apply a index policy log-rotation-policy for all indexes which match that expression. I have created my policy successfully, but when I try to create a template like so:
PUT _template/application-logs
{
"index_patterns" : [
"application-logs-*"
],
"settings" : {
"index.lifecycle.name": "log-rotation-policy",
}
}
I get an error:
"type": "illegal_argument_exception",
"reason": "unknown setting [index.policy_id] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
The AWS documentation is extremely vague,
Ok sorry I thought I would post this answer anyway because as I was writing this I figured out the problem, the correct key o use is: opendistro.index_state_management.policy_id so it should be:
PUT _template/application-logs
{
"index_patterns" : [
"application-logs-*"
],
"settings" : {
"opendistro.index_state_management.policy_id": "log-rotation-policy",
}
}
I found the answer here.

RingCentral RingOut trouble

I’m having some RingOut API trouble. Everything was working out just fine but suddenly about a week ago one of the users claimed that the RingOut functionality was broken and from what I see she is correct. For the life of me I can’t figure out what the problem is. Below is what my request looks like. After polling the call the api errors out claiming that one or two lines is busy when I know for a fact they are not. Any ideas or direction on this would be greatly appreciated
Request URI:
https://platform.ringcentral.com/restapi/v1.0/account/279578017/extension/279580017/ring-out/Y3MxNjg2OTU1OTIyMDIwMzQ1NDI5QDEwLjE0LjIzLjQw
Post Variables:
{"from":{"phoneNumber":"+17606992007","forwardingNumberId":""},"to":{"phoneNumber":"+17602146463"},"callerId":{"phoneNumber":"+17604440557"},"playPrompt":false,"country":{"id":"1”}}
Result:
{
"uri" : "https://platform.ringcentral.com/restapi/v1.0/account/279578017/extension/279580017/ring-out/Y3MxNjg2OTU1NTIyNzE2MzY4NDQyQDEwLjE0LjIzLjA",
"id" : "Y3MxNjg2OTU1NTIyNzE2MzY4NDQyQDEwLjE0LjIzLjA",
"status" : {
"callStatus" : "InProgress",
"callerStatus" : "InProgress",
"calleeStatus" : "InProgress"
}
}
Result from polling the call:
{
"uri" : "https://platform.ringcentral.com/restapi/v1.0/account/279578017/extension/279580017/ring-out/Y3MxNjg2OTU1OTgxNjMyMzY1NjYwQDEwLjE0LjIzLjQ2",
"id" : "Y3MxNjg2OTU1OTgxNjMyMzY1NjYwQDEwLjE0LjIzLjQ2",
"status" : {
"callStatus" : "CannotReach",
"callerStatus" : "Busy",
"calleeStatus" : "InProgress"
}
}
I know it sound strange but i had the same error on my app, Removing the +1 from the number fixed the issue for me.
Hope that helps!
ringcentral

Can you connect a SqlActivity to a JdbcDatabase in Amazon Data Pipeline?

Using Amazon Data Pipeline, I'm trying to use a SqlActivity to execute some SQL on a non-Redshift data store (SnowflakeDB, for the curious). It seems like it should be possible to do that with a SqlActivity that uses a JdbcDatabase. My first warning was when the wysiwyg editor on Amazon didn't even let me try to create a JdbcDatabase, but I plowed on anyway and just wrote and uploaded a Json definition by hand, myself (here's the relevant bit):
{
"id" : "ExportToSnowflake",
"name" : "ExportToSnowflake",
"type" : "SqlActivity",
"schedule" : { "ref" : "DefaultSchedule" },
"database" : { "ref" : "SnowflakeDatabase" },
"dependsOn" : { "ref" : "ImportTickets" },
"script" : "COPY INTO ZENDESK_TICKETS_INCREMENTAL_PLAYGROUND FROM #zendesk_incremental_stage"
},
{
"id" : "SnowflakeDatabase",
"name" : "SnowflakeDatabase",
"type" : "JdbcDatabase",
"jdbcDriverClass" : "com.snowflake.client.jdbc.SnowflakeDriver",
"username" : "redacted",
"connectionString" : "jdbc:snowflake://redacted.snowflakecomputing.com:8080/?account=redacted&db=redacted&schema=PUBLIC&ssl=on",
"*password" : "redacted"
}
When I upload this into the designer, it refuses to activate, giving me this error message:
ERROR: 'database' values must be of type 'RedshiftDatabase'. Found values of type 'JdbcDatabase'
The rest of the pipeline definition works fine without any errors. I've confirmed that it activates and runs to success if I simply leave this step out.
I am unable to find a single mention on the entire Internet of someone actually using a JdbcDatabase from Data Pipeline. Does it just plain not work? Why is it even mentioned in the documentation if there's no way to actually use it? Or am I missing something? I'd love to know if this is a futile exercise before I blow more of the client's money trying to figure out what's going on.
In your JdbcDatabase you need to have the following property:
jdbcDriverJarUri: "[S3 path to the driver jar file]"

Installing Windows applications/extensions with Amazon CloudFormation

Amazon's Windows Roles and Features template demonstrates how to install features on a server. But can anyone tell me how would I install an application/feature that is not present in this list, such as WebDeploy? I appreciate I could create a custom AMI, but I'm looking to do this entirely at template-level.
Thanks in advance.
For your example of WebDeploy, you could add this:
"C:\\Webdeploy\\WebDeploy_amd64_en-US.msi" : {
"source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi"
}
as a element of this section of the template
"WindowsServer": {
"Type" : "AWS::EC2::Instance",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"files" : {
You could then add this command:
"1-installwebdeploy" : {
"command" : "msiexec.exe /i C:\\Webdeploy\\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart"
}
to the list of commands.
There's a slightly easier mechanism if it's just a bog stock msi installation...
"packages" : {
"msi" : {
"urlrewrite" : "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi"
}
},
Means you don't need the "command" section.