我正在研究 AWS CloudFormation,我创建了一个模板,我要求用户在其中选择环境。
根据选定的价值,我创建了资源。用户必须在 DEV、QA、PROD、UAT 等之间进行选择,但是当我将此值添加到 S3 存储桶名称 (-downloads.com) 后,这是不允许的,因为 S3 存储桶名称中不允许使用大写字母。
因此,我确实在 JSON 中进行了更改,其中我将fn::Transform与"Condition":"Lower" 一起使用, 但随后在创建以下资源时发生错误。
未找到名为 871247504605::String 的转换。用户请求回滚。
下面是我的 CloudFormation JSON
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Provides nesting for required stacks to deploy a full resource of ****",
"Metadata": {
"AWS::CloudFormation::Interface": {
"ParameterGroups": [
{
"Label": {
"default": "Enviroment Selection"
},
"Parameters": [
"selectedEnv"
]
}
],
"ParameterLabels": {
"selectedEnv": {
"default": "Please select Enviroment"
}
}
}
},
"Parameters": {
"selectedEnv": {
"Type": "String",
"Default": …Run Code Online (Sandbox Code Playgroud) json amazon-s3 amazon-web-services aws-cloudformation aws-cloudformation-custom-resource
当您在同一区域内运行多个 CloudFormation 堆栈时,您可以使用CloudFormation 输出跨堆栈共享引用
但是,正如该文档所强调的那样,输出不能用于跨区域引用。
您不能跨区域创建跨堆栈引用。您可以使用内部函数 Fn::ImportValue 仅导入已在同一区域内导出的值。
您如何在 CloudFormation 中跨区域引用值?
作为要遵循的示例,我有一个Route 53 托管区域部署在us-east-1. 但是,我有一个后端,us-west-2因为我想创建一个经过DNS 验证的 ACM 证书,该证书需要对托管区域的引用,以便能够创建适当的 CNAME 来证明所有权。
我将如何引用us-east-1从内部创建的托管区域 ID us-west-2?
amazon-web-services aws-cloudformation aws-cloudformation-custom-resource
我已经通过 CDK(使用 java 作为语言)创建了一个 RDS Aurora Postgres 数据库集群和数据库实例。现在我正在尝试通过 CDK 实现创建数据库模式。我试过了,但在任何地方都没有找到任何说明文件或帮助
如果有人已经做过或有知识,我会很感激为我指出正确的方向。
谢谢,地平线7
java amazon-web-services aws-cloudformation aws-cdk aws-cloudformation-custom-resource
我们可以更改 AWS CustomResource 的默认超时,因为它的默认超时为 1 小时,并且将向自定义资源返回 HTTP 响应的作业大约需要 2 小时才能发送响应,而自定义资源在此之前超时。
amazon-web-services aws-cloudformation aws-cloudformation-custom-resource
考虑 serverless.yml 文件上的这个 lambda 函数:
functions:
s3toEc2Lambda:
handler: s3toec2lambda.S3toEc2Lambda
name: "${self:service}-s3toEc2Lambda"
role: S3toEc2LambdaRole
Run Code Online (Sandbox Code Playgroud)
并考虑在资源部分创建的这个 SNS:有人知道如何从 lambda 函数 s3toEc2Lambda 通知 Sns ARN 端点吗?
resources:
Resources:
WordpressFrontEndSnsS3toEc2:
Type: AWS::SNS::Topic
Properties:
TopicName: "wordpress-front-end-s3-ec2"
WordpressFrontEndSnsS3toEc2Lambda:
Type: AWS::SNS::Subscription
Properties:
Endpoint: { "Fn::GetAtt": ["s3toEc2Lambda", "Arn" ] } <------ HERE <------
#Endpoint: ${self:functions.s3toEc2Lambda} <------ OR HERE <------
#Endpoint: { "Fn::GetAtt": ["${self:functions.s3toEc2Lambda}", "Arn" ] } <------ OR HERE <------
Protocol: lambda
TopicArn: !Ref 'WordpressFrontEndSnsS3toEc2'
Run Code Online (Sandbox Code Playgroud)
对我来说总是出现这样的错误消息:“模板错误:Fn::GetAtt 的实例引用未定义的资源 s3toEc2Lambda”
谢谢你 !
amazon-web-services amazon-sns aws-lambda aws-serverless aws-cloudformation-custom-resource
基于这个页面我可以做:
aws cloudformation delete-stack \
--stack-name my-stack
Run Code Online (Sandbox Code Playgroud)
它说我可以附加命令:
[--retain-resources <value>]
这是否意味着如果我不指定该行,堆栈创建的所有资源都将被删除?我试图删除堆栈生成的所有内容,数量很多。
我怎样才能实现这个目标?
谢谢
amazon-web-services aws-cloudformation aws-cli aws-cloudformation-custom-resource
我们有 Cloudformation 模板,通过它我们可以为我们的产品部署基础设施资源。以下是通过 CF 模板创建的 AWS 组件: 1. 网络组件。如 VPC、子网、安全组等。 2. IAM 角色和策略。3. EMR 4. EKS 5. MSK 6. RDS 7. 弹性疼痛
此外,在我们的 Cloudformation 模板中,我们几乎没有自定义资源,例如“Custom::KubeManifest”。我们通过它在 AWS EKS 集群中部署对象。我们的 kubernetes 对象之一是“Service”对象。它为内部服务创建一个服务端点,以便来自公共网络的请求可以到达我们的 kubernetes 集群。
我们想要检查是否可以在 Cloudformation 模板中引用现有的 ELB DNS 名称,以便我们可以将 ELB DnsName 显示为输出。
例如,当我们调用“Custom::KubeManifest”资源时,如下模板:
ServiceDeployment:
Type: "Custom::KubeManifest"
Version: '1.0'
Properties:
ServiceToken: !Ref KubeManifestLambdaArn
KubeConfigPath: !Sub "s3://${KubeConfigS3Bucket}/${KubeConfigS3Key}"
KubeConfigKmsContext: !Ref KmsContext
Manifest:
apiVersion: v1
kind: Service
metadata:
name: test
labels:
app: client
tier: master
spec:
selector:
app: client
tier: master
ports:
- name: client-api …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation kubernetes amazon-eks aws-cloudformation-custom-resource
我正在尝试学习 Aws cloud Formation ,我正在尝试创建 VPC,如图所示。它包含三个公共子网、私有子网、natgateway 和 Internetgateway,以及公共和私有路由表。我试图通过云形成来实现它,但获得弹性 IP 的例外。
我已经创建了模板,但是当我尝试在云形成上创建堆栈时,出现错误
"The elastic-ip ID 'xx.xxx.xx.xxx' is malformed (Service: AmazonEC2; Status Code: 400; Error Code: InvalidElasticIpID.Malformed; Request ID: 2e3a9f8c-5a7e-482e-869c-8a0e46a08f27; Proxy: null)"
Run Code Online (Sandbox Code Playgroud)
。我正在尝试将弹性 IP 连接到 NatGateway 并出现上述错误。请指导我该怎么做。
{
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"ExampleEc2Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
"InstanceType": "t2.micro",
"ImageId" : "ami-047a51fa27710816e",
"AvailabilityZone" : "us-east-1a",
"SecurityGroupIds" : [{
"Ref":"ExampleSecurityGroup"
}],
"SubnetId" : {
"Ref":"public2A"
}
}
},"ExampleEc2InstancePrivate": {
"Type": "AWS::EC2::Instance",
"Properties": {
"InstanceType": "t2.micro",
"ImageId" : "ami-047a51fa27710816e",
"AvailabilityZone" : "us-east-1a", …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation aws-nat-gateway aws-cloudformation-custom-resource
我正在创建一个 CloudFormation 模板来创建必要的基础设施来使用 S3 存储桶托管静态网站。该模板包括创建接口类型的 VPC 终端节点,然后创建负载均衡器。为负载均衡器创建目标组时,我需要将 VPC 终端节点的子网中的 IP 地址输入到Targets 属性中。创建 VPC 终端节点后可以检索的唯一属性是NetworkInterfaceIds,但不会返回 IP 地址。我发现这篇文章使用 Lambda 函数从NetworkInterfaceIds传入的属性中提取 IP 地址,但我不想创建 Lambda 函数只是为了在创建基础设施时从 VPC 终端节点获取 IP 地址。
My question is, is it possible to extract the created IP addresses of a VPC endpoint without creating a Lambda function, or is it at least possible to delete this function after creating the whole infrastructure? The Lambda function would logically be unused and therefore I …
amazon-web-services aws-cloudformation aws-cloudformation-custom-resource
在我们的项目中,我们使用AwsCustomResource:
const sdkCall: customResource.AwsSdkCall = {
service: 'KMS',
action: 'replicateKey',
physicalResourceId: cr.PhysicalResourceId.of('CustomResource::KeyReplicaCreation'),
parameters: {
KeyId: keyId,
ReplicaRegion: replicaRegion
}
};
new cr.AwsCustomResource(this, `example replica`, {
onCreate: sdkCall,
onUpdate: sdkCall,
policy: cr.AwsCustomResourcePolicy.fromStatements([
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['kms:*'],
resources: ['*']
})
])
});
Run Code Online (Sandbox Code Playgroud)
既然我们知道nodejs12.x不支持,我们可以在哪里提供 lambda 运行时值呢?
我们检查过道具,没有办法提供。
aws-cloudformation-custom-resource ×10
aws-cdk ×2
aws-lambda ×2
amazon-eks ×1
amazon-s3 ×1
amazon-sns ×1
aws-cli ×1
java ×1
json ×1
kubernetes ×1