Cloudformation AWS: Connect RDS to subnets - oracle

I am trying to build a cloudformation template but I have some trouble with how to connect my Oracle RDS instance with my two subnets.
My parameters are :
"3DCFDB": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBInstanceClass": "db.t2.micro",
"AllocatedStorage": "20",
"Engine": "oracle-se2",
"EngineVersion": "12.1.0.2.v13",
"MasterUsername": {
"Ref": "user"
},
"MasterUserPassword": {
"Ref": "password"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "*"
}
},
"DependsOn": [
"3DEXPSUBPU",
"3DSUBPRI"
]
}
What parameter am I supposed to add to connect my RDS to 2 subnets?

If I understand correctly, you need to create a resource with Type "Type": AWS::RDS::DBSubnetGroup, then inside your "Type": "AWS::RDS::DBInstance" you can refer to the subnet group with something similar to this
"3DCFDB": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBInstanceClass": "db.t2.micro",
"AllocatedStorage": "20",
"Engine": "oracle-se2",
"EngineVersion": "12.1.0.2.v13",
"DBSubnetGroupName": {
"Ref": "DBsubnetGroup"
}
"MasterUsername": {
"Ref": "user"
},
"MasterUserPassword": {
"Ref": "password"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "*"
}
},
"DependsOn": [
"3DEXPSUBPU",
"3DSUBPRI"
]
},
"DBsubnetGroup": {
"Type" : "AWS::RDS::DBSubnetGroup",
...
...
}
More info can be found here
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbsubnet-group.html

Related

how to set gateway for a pod using flannel + containerd

Ive been stuck for a while and not sure what am i possibly doing wrong. For some reason my pod gets the wrong gateway? its suppose to be 10.244.6.2 for the cbr0_ep but it is assigned 10.244.6.1. Is it my flannel config that is wrong?
{
"cniVersion": "0.2.0",
"name": "cbr0",
"type": "flannel",
"capabilities": {
"portMappings": true,
"dns": true
},
"delegate": {
"type": "sdnbridge",
"optionalFlags": {
"forceBridgeGateway": true
},
"AdditionalArgs": [
{
"Name": "EndpointPolicy",
"Value": {
"Type": "OutBoundNAT",
"Settings": {
"Exceptions": [
"10.96.0.0/12",
"10.244.0.0/16",
]
}
}
},
{
"Name": "EndpointPolicy",
"Value": {
"Type": "SDNROUTE",
"Settings": {
"DestinationPrefix": "10.96.0.0/12",
"NeedEncap": true
}
}
},
{
"Name": "EndpointPolicy",
"Value": {
"Type": "SDNROUTE",
"Settings": {
"NeedEncap": true
}
}
}
]
}
}
and my net-conf.json
{
"Network": "10.244.0.0/16",
"Backend": {
"name": "cbr0",
"type": "host-gw"
}
}

Any idea how to do custom supportedCookingModes in Alexa discovery?

I'm trying to return a Discovery Response, but the supportedCookingModes only seems to accept standard values and only in the format of ["OFF","BAKE"], not Custom values as indicated by the documentation. Any idea on how to specify custom values?
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"payloadVersion": "3",
"messageId": "asdf"
},
"payload": {
"endpoints": [
{
"endpointId": "asdf",
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.Cooking",
"version": "3",
"properties": {
"supported": [
{
"name": "cookingMode"
}
],
"proactivelyReported": true,
"retrievable": true,
"nonControllable": false
},
"configuration": {
"supportsRemoteStart": true,
"supportedCookingModes": [
{
"value": "OFF"
},
{
"value": "BAKE"
},
{
"value": "CUSTOM",
"customName": "FANCY_NANCY_MODE"
}
]
}
}
]
}
]
}
}
}
Custom cooking modes are brand specific. This functionality is not yet publicly available. I recommend you to choose one of the existing cooking modes:
https://developer.amazon.com/en-US/docs/alexa/device-apis/cooking-property-schemas.html#cooking-mode-values

ARM Template unable to set $connections

I have created an ARM template in Visual Studio project with connection to slack. When I connect to slack in Azure portal - everything is fine. My slack API connection is authorized and works. My problem is with deployment and setting $connections.
Here is my template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
<template-params>
},
"variables": {
"slack": "[concat(parameters('appPrefix'), '-slack-', parameters('environment'))]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"location": "[resourceGroup().location]",
"name": "[variables('slack')]",
"properties": {
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/slack')]"
},
"displayName": "Slack",
"parameterValues": {}
}
},
{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2016-06-01",
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Collecting_went_wrong": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/chat.postMessage",
"queries": {
"channel": "<channel>",
"text": "<message>",
"username": "<user>"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"parameters": {
"$connections": {
"type": "object",
"defaultValue": {
}
}
},
"triggers": {
<trigger>
}
},
"parameters": {
"$connections": {
"value": {
"slack": {
"id": "[resourceId('Microsoft.Web/connections', variables('slack'))]",
"connectionId": "[resourceId('Microsoft.Web/connections', variables('slack'))]",
"connectionName": "slack"
}
}
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/connections', variables('slack'))]"
]
}
],
"outputs": {}
}
The 'fun' part is validation of template during the deployment:
New-AzureRmResourceGroupDeployment : 17:08:51 - Resource Microsoft.Logic/workflows 'reporting-reminder-logic-app-dev'
failed with message '{
"error": {
"code": "ConnectionsParameterInvalid",
"message": "The provided API connection parameter 'slack' is missing the required property 'id'."
}
}'
I'm really confused here.
What I tried to deploy it as connection and added $connection parameter definition as well, deployment went through. Nevertheless, when I changed connection to $connections in template parameters, Azure portal throw at me the same validation error.
Any idea what am I doing wrong here?
Thanks
The issue was about different ID in resources -> Microsoft/Web.connections -> properties -> id and slack -> connection. Once this connection ids were the same, the validation passed.
So it's only confusing validation message.

Multiple searches with with json_query/jmespath filter in Ansible

I'm trying to parse out specifc subnet names in the following piece of json, while using contains_with or starts_with filters in json_query.
It contains two vnets each of which has multiple subnets:
{
"azure_virtualnetworks": [
{
"name": "test-vnet-172-17-0-0-19",
"properties": {
"subnets": [
{
"name": "test-confluent-subnet-172-17-0-0-28",
"properties": {
"addressPrefix": "172.20.88.0/28",
"networkSecurityGroup": {
"id": "/subscriptions/********/resourceGroups/test-confluent-rg/providers/Microsoft.Network/networkSecurityGroups/test-confluent-nsg"
},
"provisioningState": "Succeeded"
}
},
{
"name": "test-test-subnet-172-17-0-32-28",
"properties": {
"addressPrefix": "172.20.88.32/28",
"networkSecurityGroup": {
"id": "/subscriptions/********/resourceGroups/test-test-rg/providers/Microsoft.Network/networkSecurityGroups/test-test-nsg"
},
"provisioningState": "Succeeded"
}
}
]
}
},
{
"name": "test2-vnet-172-17-1-0-19",
"properties": {
"subnets": [
{
"name": "test-confluent-subnet-172-17-1-0-28",
"properties": {
"addressPrefix": "172.20.88.0/28",
"networkSecurityGroup": {
"id": "/subscriptions/********/resourceGroups/test-confluent-rg/providers/Microsoft.Network/networkSecurityGroups/test-confluent-nsg"
},
"provisioningState": "Succeeded"
}
},
{
"name": "test-qatesting-subnet-172-17-1-16-28",
"properties": {
"addressPrefix": "172.20.88.16/28",
"networkSecurityGroup": {
"id": "/subscriptions/********/resourceGroups/test-qatesting-rg/providers/Microsoft.Network/networkSecurityGroups/test-qatesting-nsg"
},
"provisioningState": "Succeeded"
}
}
]
}
}
]
}
I need to search for a subnet name after searching by virtual network name.
I can filter as far down as the list of subnets without problems. e.g
azure_virtualnetworks[?contains(name,`test2-vnet`)].properties.subnets[]
returns:
[
{
"name": "test-confluent-subnet-172-17-1-0-28",
"properties": {
"addressPrefix": "172.20.88.0/28",
"networkSecurityGroup": {
"id": "/subscriptions/********/resourceGroups/test-confluent-rg/providers/Microsoft.Network/networkSecurityGroups/test-confluent-nsg"
},
"provisioningState": "Succeeded"
}
},
{
"name": "test-qatesting-subnet-172-17-1-16-28",
"properties": {
"addressPrefix": "172.20.88.16/28",
"networkSecurityGroup": {
"id": "/subscriptions/********/resourceGroups/test-qatesting-rg/providers/Microsoft.Network/networkSecurityGroups/test-qatesting-nsg"
},
"provisioningState": "Succeeded"
}
}
]
However I'm having problems then searching the subnets. I had thought that some variation on following might work but haven't had any sucess:
azure_virtualnetworks[?contains(name,`test2-vnet`)].properties.subnets[?contains(name,`test-confluent`) ]
I'm struggling to figure out what the correcting syntax is here.
Select required subnets, stop projection with pipe expression, filter required items from the subnets list:
azure_virtualnetworks[?contains(name,`test2-vnet`)].properties.subnets[] | [?contains(name,`test-confluent`)]

EC2 Instance Cloudformation - Availablity Zone is passed as a parameter

I wrote a simple cloudformation template that has few parameters. All parameters work. But when I pass Availability zone, the template gives error during creation saying "not a valid availability zone". Here is my error and code below:
11:48:47 UTC-0700 CREATE_FAILED AWS::EC2::Instance EC2Instance Invalid availability zone:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "EC2 Head Node Instance ",
"Parameters": {
"AZ": {
"Description": "Availablity Zone",
"Type": "String"
},
"Region":{
"Description": "Dev/Test/Prod regions",
"Type": "String"
},
"AMI": {
"Description": "AMI to start virtual server",
"Type": "String",
"MaxLength": 12,
"MinLength": 12
},
"Subnet": {
"Description": "subnet to launch virtual server in",
"Type": "AWS::EC2::Subnet::Id"
}
},
"Resources": {
"EC2Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId": {"Ref": "AMI"},
"SubnetId": {"Ref": "Subnet"},
"AvailabilityZone": {"Ref":"AZ"},
"Tags": [
{
"Key": "Name",
"Value": "QRM Head Node in DEV region"
}
]
}
}
},
"Outputs": {
"InstanceId": {
"Value": {"Ref": "EC2Instance"},
"Description": "ID of virtual server"
},
"PublicIPAddress": {
"Value": {"Fn::GetAtt": ["EC2Instance", "PublicIp"]},
"Description": "public IP address of virtual server"
}
}
}
Just change your parameter to:
"Parameters": {
"AZ": {
Description": "Availability Zone of the Subnet",
"Type": "AWS::EC2::AvailabilityZone::Name"
},
....
}

Resources