我正在使用 API 网关,这是我的 api 网关:
所以这只是一种post方法,其更多细节如下:
该问题与方法响应中的 200 响应中缺少 og application/json 有关,如以下链接中所述:
为了解决这个问题,我尝试手动添加
现在我将 application/json 添加为空。但当我尝试启用 cors 时,我仍然收到指定的无效状态代码。知道如何修复它吗?
我是 cloudformation 的新手,我正在为我的项目的基础架构编写一些 cfn 代码。但是有一个问题在我编写代码时一直困扰着我。假设我有以下资源要创建:
Resources:
MyEC2Instance:
Type: "AWS::EC2::Instance"
Properties:
ImageId: "ami-79fd7eee"
KeyName: "testkey"
BlockDeviceMappings:
- DeviceName: "/dev/sdm"
Ebs:
VolumeType: "io1"
Iops: "200"
DeleteOnTermination: "false"
VolumeSize: "20"
- DeviceName: "/dev/sdk"
NoDevice: {}
Run Code Online (Sandbox Code Playgroud)
如您所见,我正在创建一个名为 MyEC2Instance 的资源。现在假设我有另一个名为 stg 的环境,它与上面的完全相同,所以一个简单的方法是使用上面的代码和不同的堆栈名称,但我被告知我需要按如下方式重命名我的资源名称:
Resources:
MyEC2InstanceStg1:
Type: "AWS::EC2::Instance"
Properties:
ImageId: "ami-79fd7eee"
KeyName: "testkey"
BlockDeviceMappings:
- DeviceName: "/dev/sdm"
Ebs:
VolumeType: "io1"
Iops: "200"
DeleteOnTermination: "false"
VolumeSize: "20"
- DeviceName: "/dev/sdk"
NoDevice: {}
Run Code Online (Sandbox Code Playgroud)
但对我来说,这看起来并不专业,因为如果我有 10 个环境,这是否意味着我需要复制我的代码 10 次并重命名资源。有什么更好的方法吗?
我使用以下内容将我在dynamodb中的数据添加到弹性搜索中:
https://aws.amazon.com/it/blogs/aws/category/amazon-elasticsearch-service/?nc1=h_ls
var AWS = require('aws-sdk');
var path = require('path');
//Object for all the ElasticSearch Domain Info
var esDomain = {
region: process.env.RegionForES,
endpoint: process.env.EndpointForES,
index: process.env.IndexForES,
doctype: 'onboardingrecords'
};
//AWS Endpoint from created ES Domain Endpoint
var endpoint = new AWS.Endpoint(esDomain.endpoint);
//The AWS credentials are picked up from the environment.
var creds = new AWS.EnvironmentCredentials('AWS');
console.log('Loading function');
exports.handler = (event, context, callback) => {
//console.log('Received event:', JSON.stringify(event, null, 2));
console.log(JSON.stringify(esDomain));
event.Records.forEach((record) => {
console.log(record.eventID);
console.log(record.eventName);
console.log('DynamoDB Record: %j', record.dynamodb); …Run Code Online (Sandbox Code Playgroud) 我正在使用Web Pack在服务器上的管道上构建我的React代码。但是最近发生了重大变化,现在一切都坏了。这是我用的:
npm install -g webpack
Run Code Online (Sandbox Code Playgroud)
但是我需要像这样用版本全局安装webpack:
npm install -g webpack 1.14.0
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我在启用 https 协议的情况下为 beanstalk 设置 cloudformation 时遇到问题。
这是我的配置设置:
configurationTemplateUI:
Type: AWS::ElasticBeanstalk::ConfigurationTemplate
DependsOn: BeanstalkAppUI
Properties:
ApplicationName:
Ref: BeanstalkAppUI
Description: AWS ElasticBeanstalk Sample Configuration Template
OptionSettings:
- Namespace: aws:autoscaling:asg
OptionName: MinSize
Value:
Ref: MinEc2s
- Namespace: aws:autoscaling:asg
OptionName: MaxSize
Value:
Ref: MaxEc2s
- Namespace: aws:elasticbeanstalk:environment
OptionName: EnvironmentType
Value: LoadBalanced
- Namespace: aws:autoscaling:launchconfiguration
OptionName: InstanceType
Value:
Ref: InstanceType
- Namespace: aws:ec2:vpc
OptionName: VPCId
Value:
Fn::ImportValue: !Sub ${BusinessUnit}-${EnvironmentInfra}-vpc-VpcId
- Namespace: aws:ec2:vpc
OptionName: Subnets
Value:
Fn::ImportValue: !Sub ${BusinessUnit}-${EnvironmentInfra}-vpc-SubnetIdPrivate${SubnetAvNumber}
- Namespace: aws:ec2:vpc
OptionName: ELBSubnets
Value:
Fn::ImportValue: …Run Code Online (Sandbox Code Playgroud) amazon-web-services aws-cloudformation aws-opsworks amazon-elastic-beanstalk