Is there a way to reference an existing resource in cloudformation. I am looking for something similar to terraform’s datasource facility where I can find a resource by tag, etc. and then use a property such as Id.
I have an existing security group with a consistent name across accounts. If I could look up this SG in the template I could use the ID.
Azure does this. terraform does this.
something similar to terraform’s datasource facility where
Sadly, there is no such functionality in plain CFN. You would have to create a custom resource in a form of a lambda function. The function would use AWS SDK to query your existing resources and return their IDs or any other information you require back to your stack for further use.
Related
My goal is to write a Lambda function to attach a role to a EC2 instance based on tags. So whenever a new Ec2 instance is created, a role has to be attached to it automatically. I am looking to trigger a lambda function based on EC2 instance state change (running), and I also want to pass parameters of the IAM role to attch to EC2 for which I would have to use Custom Resources (IAM role creation is part of the same template).
Could someone help me with the best approach?
You question answer already contains the answer.
What you want to achieve can be done using custom resources.
To develop a custom resources, AWS's crhelper is very useful. It saves you from coding a lot of details that are needed for custom resources.
I have a working app I made using Amplify (with AppSync API and Cognito). I'd like to make another app which is different, but shares some data with my first project (same product, but different targets, usages and security rules).
Is there a clean way to use Amplify for that new project, telling the GraphQL API to fetch some data in the DynamoDB from my first Amplify project ?
This data will change often and will be heavy - so I'm not too much into any synchronization solution.
I thought about those solutions, but I'm not experienced enough to tell if one of them is good:
Not using Amplify but SAM for this new project (but I will lose all the build pipeline provided by Amplify)
Using Amplify for the Hosting and the Auth, but configure AppSync with SAM and plug it into my existing DataSource
Maybe CloudFormation can be the answer, but I don't see how to interact directly with it within Amplify
There is an article from Amazon about microservice architectures that might be useful for you
https://aws.amazon.com/blogs/mobile/appsync-microservices/
I'm not sure if Amplify supports adding multiple APIs to it, if so, you could add it and then pull only that api on it.
IMO the easiest approach would be just creating a query endpoint to fetch the data from your other datasource, using lambda.
So, in that case you would edit your schema to something like this
query
{
externalData [ExternalData] #function(name: "getExternalData")
}
Then you need to add the lambda function getExternalData, which will be responsible to query the data as needed.
The article above has more in-depth details about this architecture
I host my database on Azure. I would like to search data on the table in that database. I am trying to use B4I and the tech help their said I need to use REST API's. I am pretty sure I need to use ODATA. I have the auth token but I am not sure if this is even possible.
In order to query Azure SQL with an API you need to add a layer between it and the destination. As mentioned in this question, OData is a specification that can be implemented fairly easily as there are plenty of libraries that will take care of the bulk of the code for you.
As far as where to host the API, you have several options within Azure. The most common being App Services, Azure Functions, and Logic Apps.
For bill tracking purpose, given we have other solutions on AWS, we are asked to add a custom tag to all tagable resources created by Terraform AWS EKS, something like Tag key = "platform" tag value = "k8s". Practically a static tag that shows it is a kubernetes resource.
We are modeling our solution after this guide:
https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/eks-getting-started
It seems though as many resources on aws provider for eks on terraform do not provide the option for custom tags.
Is there any way we can get a custom tag across the board?
I'm still going through AWS EKS and Terraform AWS EKS guides but haven't been able that would help answer my question.
Any direction is highly appreciated!
Greg
Try here: https://github.com/terraform-aws-modules/terraform-aws-eks
Under the inputs of "terraform-aws-eks" you can find "Tags" - A map of tags to add to all resources.
Good luck.
What kind of custom tags you're looking for? If in case a Static tag. Modify the below AWS provided lambda function according to your need and add a hard coded value (key:value pair) inside the lambda function.
Look at this blog post, if you're looking for custom tags based on API calls.
https://aws.amazon.com/blogs/security/how-to-automatically-tag-amazon-ec2-resources-in-response-to-api-events/
According to Socrata's "Publisher Guide":
The Publisher API allows you to programatically:
Add, update, and delete records within a Socrata dataset
Maintain dataset metadata and privacy settings
But I can't see anywhere in the API docs that explains how to do this. It's all about creating, updating or removing individual rows - nothing to do with dataset metadata.
For instance - how do you add a tag to an existing dataset, using the API?
Sorry if that statement is a little misleading. Metadata update is available officially through the soda-java library and unofficially through sodapy.
To understand properly, you're looking to update the set of tags programmatically on a set of datasets, and if I've read your profile correctly, it looks like you'll have access to the Socrata platform as a data publisher. Correct?